From b448030a3383653be7ce6aeb4aaf86b9fbff5a76 Mon Sep 17 00:00:00 2001 From: Matt Spurrier <3377029+digitalsparky@users.noreply.github.com> Date: Sun, 2 Dec 2018 23:05:16 +0800 Subject: [PATCH 1/3] Add some uninstall instructions, correct typo --- README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c80c99d..328cc25 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,19 @@ git clone https://github.com/flipsidecreations/dotfiles.git cd dotfiles ``` -### Run intstall +### Run install ``` ./install.sh ``` +# Uninstallation + +### Change to dotfiles folder +``` +cd ~/dotfiles +``` + +### Run uninstaller +``` +./uninstall.sh +``` From 73675cd237aba05a27217702d43f5bf6650db2fc Mon Sep 17 00:00:00 2001 From: Matt Spurrier <3377029+digitalsparky@users.noreply.github.com> Date: Sun, 2 Dec 2018 23:09:10 +0800 Subject: [PATCH 2/3] Update doco & add automation Add some automation into the apt install, so that you don't need to worry about that. Make sure the apt update runs successfully before doing the install Add documentation. --- install.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index d674c5e..b1389ca 100755 --- a/install.sh +++ b/install.sh @@ -1,15 +1,20 @@ #!/bin/bash + +# Find all dot files then if the original file exists, create a backup +# Once backed up to {file}.dtbak symlink the new dotfile in place 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 - if hash vim-addon 2>/dev/null; then - echo "vim-addon (vim-scripts) installed" - else - echo "vim-addon (vim-scripts) not installed, running 'sudo apt update; sudo apt install bc'" - sudo apt update; sudo apt install vim-scripts + +# Check if vim-addon installed, if not, install it automatically +if hash vim-addon 2>/dev/null; then + echo "vim-addon (vim-scripts) installed" +else + echo "vim-addon (vim-scripts) not installed, installing" + sudo apt update && sudo apt -y install vim-scripts fi echo "Installed" From e3c5b1fb095e34a2be8fb4df58469a626c53ee98 Mon Sep 17 00:00:00 2001 From: Matt Spurrier <3377029+digitalsparky@users.noreply.github.com> Date: Sun, 2 Dec 2018 23:10:16 +0800 Subject: [PATCH 3/3] Update doco --- uninstall.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/uninstall.sh b/uninstall.sh index 52b3c17..0db1bee 100644 --- a/uninstall.sh +++ b/uninstall.sh @@ -1,4 +1,7 @@ #!/bin/bash + +# Loop through all the dotfiles, if the file is a symlink then remove it +# Then if the backup file exists, restore it to it's original location for file in $(find . -maxdepth 1 -name ".*" -type f -printf "%f\n" ); do if [ -h ~/$file ]; then rm -f ~/$file @@ -7,4 +10,5 @@ for file in $(find . -maxdepth 1 -name ".*" -type f -printf "%f\n" ); do mv -f ~/$file{.dtbak,} fi done + echo "Uninstalled"