wok diff xcursor-human/stuff/symdup.sh @ rev 18115

glib-dev,qcad: clean files.list.lzma, fix overwriting(for what?) get-scripts $depends
author Xander Ziiryanoff <psychomaniak@xakep.ru>
date Sat Jun 06 21:23:13 2015 +0200 (2015-06-06)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xcursor-human/stuff/symdup.sh	Sat Jun 06 21:23:13 2015 +0200
     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