wok view xcursor-obsidian/stuff/symdup.sh @ rev 19234

httpfs-fuse-static: add fusermount (static)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jun 25 13:38:04 2016 +0200 (2016-06-25)
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