The solve-stow now backups all conflicted files

This commit is contained in:
Tim 2017-02-07 14:03:16 +01:00 committed by Tim van Veenendaal
parent c6ec8d5031
commit eae4405d5b
3 changed files with 13 additions and 26 deletions

View File

@ -3,3 +3,6 @@ To make the files simlinks use
`stow <folder>`
For example:
`stow bash`
To solve all conflicts: (this will backup all conflicted files to file.back, to delete instead of backup simply uncomment the rm line and comment the mv line)
`./solve-stow.sh <folder>`

View File

@ -1,26 +0,0 @@
#! /bin/sh
# remove-stow-conflicts --
# remove all conflicts detected by stow, but that are
# already links to previous stow packages...
# $Id: remove-stow-conflicts,v 1.1 1997/10/17 21:19:03 cdua Exp cdua $
# Carlos Duarte, 970903/971017
stow -nvc $* 2>&1 \
| sed -n '/^CONFLICT/s/^.*vs\. //p' \
| while read i; do
test -L $i || {
echo Skipping $i ...
continue
}
point_to=`ls -ald $i | awk '{print $NF}'`
#echo $i points to $point_to
case $point_to in
..*/stow/* | ..*/?stow/* | stow/* )
echo "Deleting $i (link to $point_to)"...
rm -f $i
esac
done

10
solve-stow.sh Executable file
View File

@ -0,0 +1,10 @@
#! /bin/sh
stow -nv $1 2>&1 \
| sed -n 's/ \* existing target is neither a link nor a directory: //p' \
| while read i; do
echo Backup up ../$i to ../$i.back
mv ../$i ../$i.back
#rm -f ../$i
done
stow $1