This page contains the script forming the core of the Menu system used by the Multipurpose Raspberry Pi: Installing a Media, Gaming, PC Replacement.
The creation and installation of this Menu system is detailed in the post Multipurpose Raspberry Pi – Part 2: Adding a Menu to Access RetroPie, Kodi, and the Raspbian Desktop
Menu Script Source Code
As noted in the main post, this script is modified from Alex Lucard’s original example on askubuntu.com
The following script can be copied directly from the web page and pasted into a text editor.
#!/bin/bash show_menu(){ NORMAL=`echo "\033[m"` MENU=`echo "\033[36m"` #Blue NUMBER=`echo "\033[33m"` #yellow FGRED=`echo "\033[41m"` RED_TEXT=`echo "\033[31m"` ENTER_LINE=`echo "\033[33m"` echo -e "${MENU}*********************************************${NORMAL}" echo -e "${MENU}**${NUMBER} 1)${MENU} StartX (Desktop) ${NORMAL}" echo -e "${MENU}**${NUMBER} 2)${MENU} Emulation Station (RetroPie) ${NORMAL}" echo -e "${MENU}**${NUMBER} 3)${MENU} Kodi ${NORMAL}" echo -e "${MENU}**${NUMBER} 4)${MENU} *Reboot* ${NORMAL}" echo -e "${MENU}**${NUMBER} 5)${MENU} *SHUTDOWN* ${NORMAL}" echo -e "${MENU}*********************************************${NORMAL}" echo -e "${ENTER_LINE}Please enter a menu option and enter or ${RED_TEXT}enter to exit. ${NORMAL}" read opt } function option_picked() { COLOR='\033[01;31m' # bold red RESET='\033[00;00m' # normal white MESSAGE=${@:-"${RESET}Error: No message passed"} echo -e "${COLOR}${MESSAGE}${RESET}" }
clear show_menu while [ opt != '' ] do if [[ $opt = "" ]]; then exit; else case $opt in 1) clear; option_picked "Launching X-Windows"; startx # the main Terminal remains running whilst X-Windows loads on another process # re-load this script so the menu will be present after exiting from X-Windows back to the Terminal /home/pi/tools/selector.sh exit; ;;
2) clear; option_picked "Launching Emulation Station (RetroPie)"; emulationstation; /home/pi/tools/selector.sh exit; ;;
3) clear; option_picked "Launching Kodi Media Center"; kodi; /home/pi/tools/selector.sh exit; ;;
4) clear; option_picked "Rebooting System"; sudo reboot; ;;
5) clear; option_picked "Shutting Down System"; sudo shutdown -h now; ;;
*)clear; option_picked "Pick an option from the menu"; show_menu; ;; esac fi done
About
Disclaimers
Privacy Policy
Terms and Conditions
© Retro Resolution