wok-current diff xcursor-obsidian/stuff/symdup.sh @ rev 25733
Accept licence PyQt-x11-gpl, bump firmware* to 20240610, build imagemagick (merge)
author | Stanislas Leduc <shann@slitaz.org> |
---|---|
date | Fri Dec 20 16:13:23 2024 +0000 (2 weeks ago) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xcursor-obsidian/stuff/symdup.sh Fri Dec 20 16:13:23 2024 +0000 1.3 @@ -0,0 +1,23 @@ 1.4 +# substitute repeated files by symlinks 1.5 +md5file=$(mktemp) 1.6 +find $install -type f -exec md5sum {} \; | sort > $md5file 1.7 + 1.8 +for md in $(uniq -d -w32 $md5file | cut -c1-32); do 1.9 + # group of similar files 1.10 + similar="$(grep $md $md5file | cut -c35-)" 1.11 + 1.12 + # find shortest filename 1.13 + shortest=$(echo "$similar" | cut -d' ' -f1) 1.14 + for line in $(echo $similar); do 1.15 + [ "${#line}" -lt "${#shortest}" ] && shortest="$line" 1.16 + done 1.17 + 1.18 + # make symlinks to the file with shortest filename 1.19 + for file in $similar; do 1.20 + [ "$shortest" != "$file" ] && ln -sf $shortest $file 1.21 + done 1.22 +done 1.23 +rm "$md5file" 1.24 + 1.25 +# make all symlinks relative 1.26 +symlinks -crs $install