wok view xcursor-human/stuff/symdup.sh @ rev 20990
updated gperf (3.0.4 -> 3.1)
author | Hans-G?nter Theisgen |
---|---|
date | Thu Mar 07 15:57:07 2019 +0100 (2019-03-07) |
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