installs and uninstalls properly on windows

moveTools
Adam Veldhousen 9 years ago
parent 43b1617679
commit 7aaff1f1dc
Signed by: adam
GPG Key ID: 6DB29003C6DD1E4B

@ -3,7 +3,7 @@ IFS='\n\t'
set -euo pipefail
source="$(pwd)"
bkup="$source/../home_bkup"
bkup="$source/../.home_bkup"
dest="$source/.."
echo "Making a backup of old dotfiles into ${bkup}..."
@ -27,8 +27,12 @@ git submodule init
git submodule update
echo ""
echo "copying directories..."
ln -s ${source}/tools ${dest}/tools
echo "copying \"./tools\" directories..."
if [[ -z "${dest}/Tools" ]]; then
mkdir ${dest}/Tools
fi
#ln -fs ${source}/Tools ${dest}/tools
cp -R ${source}/tools ${dest}/tools
# sometimes its easier if you just change directories
pushd ${dest} 2&> /dev/null

@ -1,20 +1,28 @@
#!/bin/bash
src=$(pwd)
pushd .. 2&> /dev/null
echo "Uninstalling files..."
ls -lAp $src | grep "^-" | awk '{print $9}' | xargs -n 1 -I file rm -f file
dest=$(pwd)
echo ""
echo "Restoring from home bkup..."
ls -lA ./home_bkup | grep "^-" | awk '{print $9}' | xargs -n 1 -P 8 -I file cp home_bkup/file file
if [[ -d "$dest/.home_bkup" ]]; then
echo "Uninstalling files from ${dest}..."
ls -lAp $src | grep "^-" | awk '{print $9}' | xargs -n 1 -I file rm -f $dest/file
echo ""
echo ""
echo "Cleaning up home backup and tools..."
rm -rf ./home_bkup
rm -rf ./tools
echo "Restoring from .home_bkup..."
ls -lA ./.home_bkup | grep "^-" | awk '{print $9}' | xargs -n 1 -P 8 -I file cp ./.home_bkup/file ./file
echo ""
popd 2&> /dev/null
echo ""
echo ".ssh config has been left alone"
echo ""
echo "Restore completed"
echo "Cleaning up home backup and tools..."
rm -rf ./.home_bkup
rm -rf ./tools
popd 2&> /dev/null
echo ""
echo ".ssh config has been left alone"
echo ""
echo "Restore completed!"
else
echo "you don't have a home backup, aborting"
fi

Loading…
Cancel
Save