wok-next diff xcursor-comix/stuff/symdup.sh @ rev 19972
Up copyq (3.1.1), qedit (2.8.1)
author | Xander Ziiryanoff <psychomaniak@xakep.ru> |
---|---|
date | Tue Oct 17 19:29:54 2017 +0200 (2017-10-17) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xcursor-comix/stuff/symdup.sh Tue Oct 17 19:29:54 2017 +0200 1.3 @@ -0,0 +1,27 @@ 1.4 +# substitute repeated files by symlinks 1.5 +for path in $install/usr/share/icons/*; do 1.6 + # make symlinks separately for every cursor theme 1.7 + 1.8 + md5file=$(mktemp) 1.9 + find $path -type f -exec md5sum '{}' \; | sort > $md5file 1.10 + 1.11 + for md in $(uniq -d -w32 $md5file | cut -c1-32); do 1.12 + # group of similar files 1.13 + similar="$(grep $md $md5file | cut -c35-)" 1.14 + 1.15 + # find shortest filename 1.16 + shortest=$(echo "$similar" | cut -d' ' -f1) 1.17 + for line in $(echo $similar); do 1.18 + [ "${#line}" -lt "${#shortest}" ] && shortest="$line" 1.19 + done 1.20 + 1.21 + # make symlinks to the file with shortest filename 1.22 + for file in $similar; do 1.23 + [ "$shortest" != "$file" ] && ln -sf $shortest $file 1.24 + done 1.25 + done 1.26 + rm "$md5file" 1.27 +done 1.28 + 1.29 +# make all symlinks relative 1.30 +symlinks -crs $install