wok-next view xcursor-human/stuff/symdup.sh @ rev 19503

Up firefox-official (50.0)
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu Nov 17 16:45:54 2016 +0200 (2016-11-17)
parents
children
line source
1 # substitute repeated files by symlinks
2 md5file=$(mktemp)
3 find $install -type f -exec md5sum {} \; | sort > $md5file
5 for md in $(uniq -d -w32 $md5file | cut -c1-32); do
6 # group of similar files
7 similar="$(grep $md $md5file | cut -c35-)"
9 # find shortest filename
10 shortest=$(echo "$similar" | cut -d' ' -f1)
11 for line in $(echo $similar); do
12 [ "${#line}" -lt "${#shortest}" ] && shortest="$line"
13 done
15 # make symlinks to the file with shortest filename
16 for file in $similar; do
17 [ "$shortest" != "$file" ] && ln -sf $shortest $file
18 done
19 done
20 rm "$md5file"
22 # make all symlinks relative
23 symlinks -crs $install