From a55b7199508ef21a5ebdf7f314aa6419b1333a02 Mon Sep 17 00:00:00 2001 From: Matt Spurrier Date: Tue, 3 Apr 2018 22:48:41 +0800 Subject: [PATCH] Add uninstaller, and make installer dynamic --- install.sh | 21 +++++++-------------- uninstall.sh | 10 ++++++++++ 2 files changed, 17 insertions(+), 14 deletions(-) create mode 100644 uninstall.sh diff --git a/install.sh b/install.sh index f075217..c805e3c 100755 --- a/install.sh +++ b/install.sh @@ -1,15 +1,8 @@ #!/bin/bash - -rm ~/.bashrc -rm ~/.bash_aliases -rm ~/.bash_exports -rm ~/.bash_wrappers -rm ~/.vimrc -rm ~/.screenrc -rm ~/.tmux.conf -ln -s dotfiles/.bashrc ~/ -ln -s dotfiles/.bash_aliases ~/ -ln -s dotfiles/.bash_exports ~/ -ln -s dotfiles/.vimrc ~/ -ln -s dotfiles/.screenrc ~/ -ln -s dotfiles/.tmux.conf ~/ +for file in $(find . -maxdepth 1 -name ".*" -type f -printf "%f\n" ); do + if [ -e ~/$file ]; then + mv -f ~/$file{,.dtbak} + fi + ln -s $PWD/$file ~/$file +done +echo "Installed" diff --git a/uninstall.sh b/uninstall.sh new file mode 100644 index 0000000..52b3c17 --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,10 @@ +#!/bin/bash +for file in $(find . -maxdepth 1 -name ".*" -type f -printf "%f\n" ); do + if [ -h ~/$file ]; then + rm -f ~/$file + fi + if [ -e ~/${file}.dtbak ]; then + mv -f ~/$file{.dtbak,} + fi +done +echo "Uninstalled"