#!/bin/bash configureport () { oldport=$(load-app-config.sh) port=$(whiptail --title "Application configuration" \ --inputbox "NGING Port" 12 60 $oldport \ 3>&1 1>&2 2>&3) if [ "$port" = "$oldport" ]; then message="This port already configured" else sudo save-app-config.sh $port if [ $? -ne 0 ]; then message="Application configuration has encountered an error, please check journalctl for additional information" else message="Application configuration completed succesfully" fi fi whiptail --title "Application configuration" --msgbox "$message" 12 60 } showmenu () { choice=$(whiptail --title "Appliance menu" --noitem --nocancel \ --menu "Choose an action" 12 60 4 \ "Configure network" "" \ "Configure application" "" \ "Restart appliance" "" \ "Run shell" "" \ 3>&1 1>&2 2>&3) case $choice in "Configure network") nmtui showmenu ;; "Configure application") configureport showmenu ;; "Restart appliance") sudo reboot ;; "Run shell") ;; esac } showmenu exit 0