wok-current view xcursor-human/stuff/symdup.sh @ rev 22977
updated kamailio (4.4.4 -> 5.3.2)
author | Hans-G?nter Theisgen |
---|---|
date | Sat Feb 29 16:18:56 2020 +0100 (2020-02-29) |
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