diff options
| author | Ibrahim Mkusa <ibrahimmkusa@gmail.com> | 2024-08-08 22:10:52 -0400 | 
|---|---|---|
| committer | Ibrahim Mkusa <ibrahimmkusa@gmail.com> | 2024-08-08 22:10:52 -0400 | 
| commit | c779f6097e9019c84ad7d237326c33fd7e846cb5 (patch) | |
| tree | 6337c3ce1db8b460dcfcc9ea605a48661f3769cc /install.sh | |
| parent | 5465298135919984374e2a79480feca93b504c31 (diff) | |
Allow undoing install script changes via options
Diffstat (limited to 'install.sh')
| -rwxr-xr-x | install.sh | 33 | 
1 files changed, 29 insertions, 4 deletions
@@ -5,6 +5,12 @@  set -e  # subshells inherit environment from parent +function usage() { +   echo "./install #installs and setups this environment" +   echo "./install undo  #removes all configs" +   echo "./install wipe #removes all configs and removes all installed packages" +} +  # detect which family of distro i'm on  if [[ -f /etc/os-release ]]; then    . /etc/os-release @@ -25,7 +31,26 @@ else    exit 1  fi -echo "Installing packages" -sudo $package_manager install -y $vim git stow curl ranger tmux -# use gnu stow to symlink config files to home directory -stow bash git ranger shellenv tmux vim +# could have used a case, but i prefer the if statement +if [[ -z "$1" ]]; then +  echo "Installing packages" +  sudo "$package_manager" install -y "$vim" git stow curl ranger tmux + +  # use gnu stow to symlink config files to home directory +  stow bash git ranger shellenv tmux vim + +elif [[ undo = "$1" ]]; then +  echo "undoing" +  stow -D bash git ranger shellenv tmux vim + +elif [[ wipe = "$1" ]]; then +  stow -D bash git ranger shellenv tmux vim +  sudo "$package_manager" remove "$vim" git stow curl ranger tmux +  echo "wiping" + +elif [[ "$1" = "help" ]]; then +  usage + +fi +   +  | 
