diff --git a/bootstrap b/bootstrap index a912e13..4e58ba3 100755 --- a/bootstrap +++ b/bootstrap @@ -138,7 +138,7 @@ cleanup() { rm -rfv ~/{shellcheck,flarectl,LICENSE,README.txt,README.md} pkg uninstall clang --yes && apt autoremove --yes else - rm -rfv ~/{shellcheck,flarectl,LICENSE,README.txt,README.md} || true + rm -rfv ~/{shellcheck,flarectl,LICENSE,README.txt,README.md}* || true unset PREFIX fi success "Setting up a new Linux machine was succesfully executed. To ensure no secrets are leaked when logging utfrom shell session, please do 'history -c' to cleanup shell history." @@ -156,9 +156,9 @@ copyKeysSSH() { cp "$HOME/.dotfiles/secrets/ssh/launchpad.pub" "~/.ssh/launchpad.pub" chmod 600 "~/.ssh/launchpad" else - [ ! -f " ~/.ssh/launchpad" ] && cp "$HOME/.dotfiles/secrets/ssh/launchpad" "~/.ssh/launchpad" - [ ! -f " ~/.ssh/launchpad.pub" ] && "cp $HOME/.dotfiles/secrets/ssh/launchpad.pub" "~/.ssh/launchpad.pub" - chmod 600 "~/.ssh/launchpad" + [ ! -f "~/.ssh/launchpad" ] && cp "$HOME/.dotfiles/secrets/ssh/launchpad" "~/.ssh/launchpad" + [ ! -f "~/.ssh/launchpad.pub" ] && "cp $HOME/.dotfiles/secrets/ssh/launchpad.pub" "~/.ssh/launchpad.pub" + [ -f "~/.ssh/launchpad.pub" ] && chmod 600 "~/.ssh/launchpad" fi echoStageName "Linking config files" @@ -217,24 +217,24 @@ installShellCheck() { current_path_dir=$(dirname $current_shellcheck_path) wget -qO- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv -C "$HOME" if [[ $current_shellcheck_path == "" ]]; then - cp "shellcheck-${scversion}/shellcheck" "$PREFIX/bin" + cp "$HOME/shellcheck-${scversion}/shellcheck" "$PREFIX/bin" elif [[ $current_shellcheck_path == "$PREFIX/bin/shellcheck" ]]; then warn "Current ShellCheck install found in $PREFIX/bin, replacing with latest stable release..." if [[ $isOwnedByUser == "" ]]; then - warn "Owned by either other user/root, summoning root" - sudo rm "${PREFIX}/bin/shellcheck" + [ -f "$PREFIX/bin/shellcheck" ] && warn "Owned by either other user/root, summoning root" && sudo rm "${PREFIX}/bin/shellcheck" else rm "${PREFIX}/bin/shellcheck" fi - cp "shellcheck-${scversion}/shellcheck" "$PREFIX/bin" + cp "$HOME/shellcheck-${scversion}/shellcheck" "$PREFIX/bin" else warn "Current ShellCheck install found in $current_path_dir, will be removed..." if [[ $isOwnedByUser == "" ]]; then - sudo rm "${PREFIX}/bin/shellcheck" + warn "Owned by either other user/root, summoning root" + sudo rm "$current_path_dir/shellcheck" else rm "${PREFIX}/bin/shellcheck" fi - cp "shellcheck-${scversion}/shellcheck" "$PREFIX/bin" + cp "$HOME/shellcheck-${scversion}/shellcheck" "$PREFIX/bin" fi fi }