diff --git a/src/freedombone-template b/src/freedombone-template index 2974faee..732b3c70 100755 --- a/src/freedombone-template +++ b/src/freedombone-template @@ -354,31 +354,23 @@ echo " echo -n ''" echo '}' echo '' echo "function configure_interactive_${app_name} {" +echo ' W=(1 $"Option 1"' +echo ' 2 $"Option 2")' +echo '' echo ' while true' echo ' do' -echo " data=\$(mktemp 2>/dev/null)" -echo " dialog --backtitle \$\"Freedombone Control Panel\" \\" -echo " --title \$\"${app_name}\" \\" -echo " --radiolist \$\"Choose an operation:\" 16 70 3 \\" -echo " 1 \$\"Option 1\" off \\" -echo " 2 \$\"Option 2\" off \\" -echo " 3 \$\"Exit\" on 2> \"\$data\"" -echo ' sel=$?' -echo " case \$sel in" -echo " 1) rm -f \"\$data\"" -echo ' return;;' -echo " 255) rm -f \"\$data\"" -echo ' return;;' -echo ' esac' -echo " case \$(cat \"\$data\") in" +echo ' # shellcheck disable=SC2068' +echo " selection=\$(dialog --backtitle \$\"Freedombone Administrator Control Panel\" --title \$\"${app_name}\" --menu \$\"Choose an operation, or ESC for main menu:\" 14 70 3 \"\${W[@]}\" 3>&2 2>&1 1>&3)" +echo '' +echo " if [ ! \"\$selection\" ]; then" +echo ' break' +echo ' fi' +echo " case \$selection in" echo ' 1) # call some function for option 1' echo ' ;;' echo ' 2) # call some function for option 2' echo ' ;;' -echo " 3) rm -f \"\$data\"" -echo ' break;;' echo ' esac' -echo " rm -f \"\$data\"" echo ' done' echo '}' echo ''