tazlito rev 515

Fix deduplicate symlinks
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu May 23 11:09:57 2019 +0200 (2019-05-23)
parents 7c8e4ca19511
children 06217db0ecc0
files tazlito
line diff
     1.1 --- a/tazlito	Tue Feb 26 08:21:00 2019 +0100
     1.2 +++ b/tazlito	Thu May 23 11:09:57 2019 +0200
     1.3 @@ -868,11 +868,14 @@
     1.4  			_ '%s Kbytes saved in %s duplicate files.' "$save" "$hardlinks"
     1.5  		)
     1.6  
     1.7 -	find "$@" -xdev -type l -exec stat -c '%s-%u-%g-TARGET- %i %h %n' {} \; | sort | \
     1.8 +	find "$@" -xdev -type l -exec stat -c '%s-%u-%g %i %h %n' {} \; | \
     1.9 +		while read attr inode link file; do
    1.10 +			echo "$attr-$(readlink "$file" | uuencode -m - | \
    1.11 +				sed '1d;:b;{N;s/\n//;bb;}') $inode $link $file"
    1.12 +		done | sort | \
    1.13  		(
    1.14  			old_attr=""; hardlinks=0;
    1.15  			while read attr inode link file; do
    1.16 -				attr="${attr/-TARGET-/-$(readlink $file)}"
    1.17  				if [ "$attr" = "$old_attr" ]; then
    1.18  					if [ "$inode" != "$old_inode" ]; then
    1.19  						rm -f "$file"