diff --git a/spells/menu/mud-admin b/spells/menu/mud-admin index 75112cd..954e636 100644 --- a/spells/menu/mud-admin +++ b/spells/menu/mud-admin @@ -8,10 +8,9 @@ display_menu() { add="Add authorized player%add-player" list_players="List authorized players%new-player" list_rooms="List shared rooms%list-rooms" - install="Install%mud-install-menu" exit="Exit%kill -2 $$" # Commands are run with 'eval' by the menu script, so we can't simply say 'exit'. The keyword $$ gets this scripts PID and the -2 code is SIGINT aka Ctrl-C - menu "MUD main menu:" "$change" "$new" "$install" "$exit" + menu "MUD main menu:" "$add" "$list_players" "$list_rooms" "$exit" } # Catch Ctrl-C and exit diff --git a/spells/menu/mud-install-menu b/spells/menu/mud-install-menu new file mode 100644 index 0000000..60b0edc --- /dev/null +++ b/spells/menu/mud-install-menu @@ -0,0 +1,25 @@ +#!/bin/sh + +# This spell displays the ao-mud install menu. + +. colors + +SCRIPT_DIR=$( cd ${0%/*} && pwd -P ) + +display_menu() { + tor="Set up tor hidden service%$SCRIPT_DIR/../installers/setup/tor" + exit="Exit%kill -2 $$" # Commands are run with 'eval' by the menu script, so we can't simply say 'exit'. The keyword $$ gets this scripts PID and the -2 code is SIGINT aka Ctrl-C + + menu "MUD main menu:" "$tor" "$exit" +} + +# Catch Ctrl-C and exit +handle_ctrl_c() { + trap 'echo exiting; exit' INT +} + +handle_ctrl_c + +while true; do + display_menu +done diff --git a/spells/menu/mud-menu b/spells/menu/mud-menu index 6affc83..46054f8 100755 --- a/spells/menu/mud-menu +++ b/spells/menu/mud-menu @@ -10,6 +10,8 @@ display_menu() { home="Teleport Home%cd" jump="Teleport to Marker%jump" portal="Teleport to Portal Chamber%cd /mnt" + install="Install MUD%mud-install-menu" + admin="Admin MUD Hosting%mud-admin" settings="MUD Settings%mud-settings" exit="Exit%kill -2 $$" # Commands are run with 'eval' by the menu script, so we can't simply say 'exit'. The keyword $$ gets this scripts PID and the -2 code is SIGINT aka Ctrl-C