"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "fslint/supprt/rmlint/fixdup.sh" between
fslint-2.44.tar.gz and fslint-2.46.tar.gz

About: fslint is a toolkit to find and clean various forms of lint on a filesystem (for e.g. duplicate files).

fixdup.sh  (fslint-2.44):fixdup.sh  (fslint-2.46)
#!/bin/sh #!/bin/sh
# Does the same as the python version only slower. # Does the same as the python version only slower.
# Systems without python can therefore use this. # Systems without python can therefore use this.
suffix=.fixdup.$$ suffix=.fixdup.$$
symlink=0
link=1 link=1
dryRun=0 dryRun=0
if [ "$#" = "1" ]; then if [ "$#" = "1" ]; then
if [ "$1" = "del" ]; then if [ "$1" = "del" ]; then
link=0 link=0
elif [ "$1" = "tdel" ]; then elif [ "$1" = "tdel" ]; then
link=0 link=0
dryRun=1 dryRun=1
elif [ "$1" = "tmerge" ]; then elif [ "$1" = "tmerge" ]; then
dryRun=1 dryRun=1
elif [ "$1" = "symlink" ]; then
symlink=1
elif [ "$1" = "tsymlink" ]; then
dryRun=1
symlink=1
fi fi
fi fi
keepfile='nextfile' keepfile='nextfile'
while read file; do while read file; do
if [ -z "$file" ]; then if [ -z "$file" ]; then
keepfile="nextfile" keepfile="nextfile"
elif [ "nextfile" = "$keepfile" ]; then elif [ "nextfile" = "$keepfile" ]; then
keepfile="$file" keepfile="$file"
if [ "$dryRun" = "1" ]; then if [ "$dryRun" = "1" ]; then
printf "\n\nkeeping: $keepfile\n" printf "\n\nkeeping: $keepfile\n"
if [ "$link" = "1" ]; then if [ "$symlink" = "1" ]; then
printf "symlinking: "
elif [ "$link" = "1" ]; then
printf "hardlinking: " printf "hardlinking: "
else else
printf "deleting: " printf "deleting: "
fi fi
fi fi
else else
if [ "$dryRun" = "1" ]; then if [ "$dryRun" = "1" ]; then
printf "$file " printf "$file "
else else
if [ "$link" = "1" ]; then if [ "$link" = "1" ]; then
ln -f -b --suffix="$suffix" -- "$keepfile" "$file" 2>/dev/null || {
test "$symlink" = 0 &&
ln -f -b --suffix="$suffix" -- "$keepfile" "$file" 2>/dev/null;
} ||
ln -sf -b --suffix="$suffix" -- "$keepfile" "$file" ln -sf -b --suffix="$suffix" -- "$keepfile" "$file"
rm -f "$file$suffix" rm -f "$file$suffix"
else else
rm -f "$file" rm -f "$file"
fi fi
fi fi
fi fi
done done
if [ "$dryRun" = "1" ] && [ "$keepfile" != "nextfile" ]; then if [ "$dryRun" = "1" ] && [ "$keepfile" != "nextfile" ]; then
echo echo
 End of changes. 4 change blocks. 
2 lines changed or deleted 13 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS