wok diff xcursor-human/stuff/symdup.sh @ rev 19528
harfbuzz: mv /usr/bin to harfbuzz-apps (hg add)
author | Xander Ziiryanoff <psychomaniak@xakep.ru> |
---|---|
date | Mon Nov 28 16:31:17 2016 +0100 (2016-11-28) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xcursor-human/stuff/symdup.sh Mon Nov 28 16:31:17 2016 +0100 1.3 @@ -0,0 +1,23 @@ 1.4 +# substitute repeated files by symlinks 1.5 +md5file=$(mktemp) 1.6 +find $install -type f -exec md5sum {} \; | sort > $md5file 1.7 + 1.8 +for md in $(uniq -d -w32 $md5file | cut -c1-32); do 1.9 + # group of similar files 1.10 + similar="$(grep $md $md5file | cut -c35-)" 1.11 + 1.12 + # find shortest filename 1.13 + shortest=$(echo "$similar" | cut -d' ' -f1) 1.14 + for line in $(echo $similar); do 1.15 + [ "${#line}" -lt "${#shortest}" ] && shortest="$line" 1.16 + done 1.17 + 1.18 + # make symlinks to the file with shortest filename 1.19 + for file in $similar; do 1.20 + [ "$shortest" != "$file" ] && ln -sf $shortest $file 1.21 + done 1.22 +done 1.23 +rm "$md5file" 1.24 + 1.25 +# make all symlinks relative 1.26 +symlinks -crs $install