diff --git a/swp-install b/swp-install index 00eaa10..2d969b4 100644 --- a/swp-install +++ b/swp-install @@ -143,16 +143,29 @@ install_dependencies() { check_existing() { if [ -d "/usr/local/bin/SkywarnPlus" ]; then print_divider - echo "SkywarnPlus directory already exists. It must be removed to continue the installation." - read -r -p "Do you want to remove it? Enter 'y' for yes or 'n' for no. [y]: " REMOVE_CONFIRMATION - REMOVE_CONFIRMATION=${REMOVE_CONFIRMATION:-y} - if [[ "$REMOVE_CONFIRMATION" != [Yy] ]]; then + echo "Existing SkywarnPlus installation detected. This installer script was intended for new installations." + read -r -p "Would you like to run UpdateSWP.py instead? + +[Y] Switch to UpdateSWP.py +[N] Continue with a fresh install after making a backup to SkywarnPlus_$(date +'%m-%d-%Y')/ + (you can grab your old config.yaml file from the backup) + +Please choose an option (y/n) [y]: " INSTALL_OPTION + INSTALL_OPTION=${INSTALL_OPTION:-y} + + if [[ "$INSTALL_OPTION" =~ ^[Yy]$ ]]; then print_divider - echo "Installation aborted. Exiting." + echo "Switching to UpdateSWP.py..." print_divider - exit 1 + /usr/local/bin/SkywarnPlus/UpdateSWP.py + exit 0 else - rm -rf /usr/local/bin/SkywarnPlus + BACKUP_DIR="/usr/local/bin/SkywarnPlus_$(date +'%m-%d-%Y')" + print_divider + echo "Making a backup to $BACKUP_DIR..." + mv /usr/local/bin/SkywarnPlus "$BACKUP_DIR" + print_divider + echo "Backup complete. Continuing with fresh installation..." fi fi }