diff --git a/scripts/ui/advanced_menu.sh b/scripts/ui/advanced_menu.sh index 5f7cf5e..5453386 100755 --- a/scripts/ui/advanced_menu.sh +++ b/scripts/ui/advanced_menu.sh @@ -138,40 +138,3 @@ switch_menu(){ ERROR_MSG="No Klipper directory found! Download Klipper first!" fi } - -############################################################# -############################################################# - -migration_ui(){ - top_border - echo -e "| $(title_msg "~~~~~~~~~ [ CustomPiOS Migration ] ~~~~~~~~~~") | " - hr - echo -e "| This function will help you to migrate a vanilla | " - echo -e "| MainsailOS or FluiddPi image to a newer state. | " - blank_line - echo -e "| Only use this function if you use MainsailOS 0.4.0 | " - echo -e "| or lower, or FluiddPi v1.13.0 or lower. | " - blank_line - echo -e "| Please have a look at the KIAUH changelog for more | " - echo -e "| details on what this function will do. | " - hr - echo -e "| | " - echo -e "| 1) [Migrate MainsailOS] | " - echo -e "| 2) [Migrate FluiddPi] | " - echo -e "| | " - back_footer -} - -migration_menu(){ - print_msg && clear_msg - migration_ui - while true; do - read -p "${cyan}Perform action:${default} " action; echo - case "$action" in - 1) migrate_custompios "mainsail"; migration_menu;; - 2) migrate_custompios "fluiddpi"; migration_menu;; - B|b) clear; advanced_menu; break;; - *) print_unkown_cmd; migration_menu;; - esac - done -} diff --git a/scripts/ui/migration_menu.sh b/scripts/ui/migration_menu.sh new file mode 100644 index 0000000..0618bf6 --- /dev/null +++ b/scripts/ui/migration_menu.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +migration_menu(){ + local menu_options=( + "1" "Migrate MainsailOS" + "2" "Migrate FluiddPi" + ) + local menu_str="This function will help you to migrate a vanilla MainsailOS or FluiddPi image to a newer state. +Only use this function if you use MainsailOS 0.4.0 or lower, or FluiddPi v1.13.0 or lower. +Please have a look at the KIAUH changelog for more details on what this function will do." + + while true; do + local menu + menu=$(whiptail --title "CustomPiOS Migration" --cancel-button "Back" --notags --menu "$menu_str\n\nPerform Action:" \ + "$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8 "${menu_options[@]}" 3>&1 1>&2 2>&3) + local out=$? + if [ $out -eq 1 ]; then + break + elif [ $out -eq 0 ]; then + case "$menu" in + 1) migrate_custompios "mainsail";; + 2) migrate_custompios "fluiddpi";; + esac + else + # Unexpected event, no clue what happened + exit 1 + fi + done +}