diff --git a/bootstrap.sh b/bootstrap.sh index 8d3621b..9369970 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -66,7 +66,7 @@ copy_file() { echo "Differences detected between $source_path and $dest_path:" diff --color $source_path $dest_path - read -p "$dest_path already exists. What should be done? [O:overwrite,S:skip] " action + read -p "$dest_path already exists. What should be done? [O:overwrite,S:skip,B:save backup and copy] " action if [[ $action == "O" ]]; then cp $source_path $dest_path @@ -79,6 +79,14 @@ copy_file() { return 0 fi + if [[ $action == "B" ]]; then + cp $dest_path $dest_path.old + echo "Backed up $dest_path up to $dest_path.old" + cp $source_path $dest_path + echo "Overwrote $source_path > $dest_path" + return 0 + fi + echo "Unrecognized action, doing nothing." } @@ -152,12 +160,8 @@ install_and_configure_starship() { fi pre_substep "Copy configuration in configuration directory" - STARSHIP_CONFIGURATION_PATH=~/.config/starship.toml - if [ -f $STARSHIP_CONFIGURATION_PATH ]; then - copy_file $STARSHIP_CONFIGURATION_PATH $STARSHIP_CONFIGURATION_PATH.old - fi - copy_file ./files/starship.toml $STARSHIP_CONFIGURATION_PATH + copy_file ./files/starship.toml ~/.config/starship.toml } install_nvm() {