Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #-------------------------------------------------------------------------------
- # Script Created by Vincent - EZ-Arch Project (ezarchproject@gmail.com)
- # Distro Sourceforge - https://sourceforge.net/projects/ezarchlinux/
- # Distro Dailymotion - http://www.dailymotion.com/ezarchproject
- #
- # I shall be using Dailymotion more for the videos instead of Youtube.
- #
- #-------------------------------------------------------------------------------
- #This program is free software: you can redistribute it and/or modify
- #it under the terms of the GNU General Public License as published by
- #the Free Software Foundation, either version 3 of the License, or
- #(at your option) any later version.
- #
- #This program is distributed in the hope that it will be useful,
- #but WITHOUT ANY WARRANTY; without even the implied warranty of
- #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- #GNU General Public License for more details.
- #
- #You should have received a copy of the GNU General Public License
- #along with this program. If not, see <http://www.gnu.org/licenses/>.
- #-------------------------------------------------------------------------------
- # Run this script after your first boot with archlinux (as root)
- #--------------------------------------------------------------------------------
- # Explaination of the Script:
- #
- #
- # User Menu Program
- #
- ##########################################################################
- PROGDIR=/home/vincent/Projects/EzCUDM/rootfs/usr/INSTALLER/EzCUDM # Testing
- #PROGDIR=/usr/INSTALLER/EzCUDM
- # Global Stuff
- CONFIGFILE=$PROGDIR/etc/ezcudm.conf # Config File
- if [[ -f $CONFIGFILE ]]; then
- source $CONFIGFILE
- else
- echo "Error missing file: ezcudm.conf - Required by program"
- echo "Installer's Directory is $PROGDIR/etc"
- exit 1
- fi
- # Linux name and version is set in the program and not the config file
- VERSIONINFO=$PROGDIR/etc/distver.conf
- if [[ -f $VERSIONINFO ]]; then
- source $VERSIONINFO
- else
- echo "Error missing file: distver.conf - Required by program"
- echo "Installer's Directory is $PROGDIR/etc"
- exit 1
- fi
- ### Program for making the UI
- DIALOG=${DIALOG=dialog}
- #DIALOG=${DIALOG=Xdialog}
- # Temp files
- tempfile=`tempfile 2> /dev/null` || tempfile=/tmp/tmpfile$$
- trap "rm -f $tempfile" 0 1 2 5 15
- ###############################################################################
- # Menus are here
- # It will be menu then choices for that menu
- ############################################################################
- mainmenu()
- {
- while :
- do
- $DIALOG --backtitle "$DISTNAME $DISTVER " --no-shadow \
- --ok-label 'Select' --cancel-label 'Exit' \
- --title "$FUNCTION" --menu "Select a menu option" 20 78 16 \
- "Install $DISTNAME" "Installs the OS to system" \
- "Console" "Spawns a shell of choice" \
- "XSession" "Runs X Session of choice" \
- "Midnight Commander" "File Manager utility" \
- "View Diskspace" "Shows disk spaces via df" \
- "View System Info" "Shows information about your system" \
- "Reboot" "Reboot System." \
- "Power Off" "Power off the System" 2> $tempfile
- mmretval=$?
- choice=`cat $tempfile`
- case $mmretval in
- 0)
- echo "Selected $choice "
- mainmenuchoices
- ;;
- 1)
- if $DIALOG --yesno "Do you wish to exit.\nThis will respawn on tty1\nOn other ttys it will exit to the console" 10 40
- then
- exit 0
- fi
- ;;
- 255)
- # echo "ESC key pressed"
- ;;
- esac
- done
- }
- ##### Main Menu Choices Responses
- mainmenuchoices()
- {
- case $choice in
- "Install $DISTNAME")
- $SETUP
- ;;
- "Console")
- shellmenu
- ;;
- "XSession")
- xorgmenu
- ;;
- "Midnight Commander")
- mc
- ;;
- "View Diskspace")
- $DF -h > $TMP/statsfile.$$
- $DIALOG --backtitle "$DISTNAME $DISTVER" \
- --title "View Disk Spaces" \
- --textbox $TMP/statsfile.$$ 20 100
- rm -f $TMP/statsfile.$$
- ;;
- "View System Info")
- #-c 0 on Inxi disables Colors
- #
- $INXI -F -c 0 > $TMP/statsfile.$$
- $DIALOG --backtitle "$DISTNAME $DISTVER" \
- --title "View System Information" \
- --textbox $TMP/statsfile.$$ 30 100
- rm -f $TMP/statsfile.$$
- ;;
- "Reboot")
- $REBOOT
- ;;
- "Power Off")
- $POWEROFF
- ;;
- esac
- }
- ####### Shell Menu & Choices ---------------------------------------------
- shellmenu()
- {
- while :
- do
- $DIALOG --backtitle "$DISTNAME $DISTVER " --no-shadow \
- --ok-label 'Select' --cancel-label 'Back' \
- --title "Select Shell to use for console" --menu "Select a menu option" 20 78 16 \
- "Bash" "Bash Shell" \
- "ZSH" "ZSH Shell" \
- "MKHS" "MirBSD Korn Shell" \
- "TCSH" "GNU C Shell" 2> $tempfile
- shmenuretval=$?
- shchoice=`cat $tempfile`
- case $shmenuretval in
- 0)
- echo "Selected $shchoice "
- shellmenuchoice
- break
- ;;
- 1)
- echo "Cancalled"
- break
- ;;
- 255)
- # echo "ESC key pressed"
- ;;
- esac
- done
- }
- shellmenuchoice()
- {
- echo
- echo "Now Entering a Shell, type exit to return to main menu"
- echo
- case $shchoice in
- "Bash")
- $BASH
- ;;
- "ZSH")
- $ZSH
- ;;
- "MKHS")
- dfspace
- $MKSH
- ;;
- "TCSH")
- dfspace
- $TCSH
- ;;
- esac
- }
- ####### Shell Menu & Choices ---------------------------------------------
- xorgmenu()
- {
- while :
- do
- $DIALOG --backtitle "$DISTNAME $DISTVER " --no-shadow \
- --ok-label 'Select' --cancel-label 'Back' \
- --title "Select Xsession to use" --menu "Select a menu option" 20 78 16 \
- "Open Motif" "Open Motif Window Manager" \
- "IceWM" "IceWM - Window Manager" \
- "AWESOME" "Awesome Tiled Window Manager" \
- "TWM" "Tab Window Manager" 2> $tempfile
- xorgmenuretval=$?
- xorgchoice=`cat $tempfile`
- case $xorgmenuretval in
- 0)
- echo "Selected $shchoice "
- xorgmenuchoice
- ;;
- 1)
- echo "Cancalled"
- break
- ;;
- 255)
- # echo "ESC key pressed"
- ;;
- esac
- done
- }
- xorgmenuchoice()
- {
- echo
- case $xorgchoice in
- "Open Motif")
- startx $OPENMOTIF
- ;;
- "IceWM")
- startx $ICEWM
- ;;
- "AWESOME")
- startx $AWESOME
- ;;
- "TWM")
- startx $TWM
- ;;
- esac
- }
- mainmenu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement