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

updated djview (4.10.3 -> 4.10.6)
author Hans-G?nter Theisgen
date Tue Jan 14 13:39:45 2020 +0100 (2020-01-14)
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