#!/bin/sh
# VASM
# Vector Linux System Menu
# 
# (c) Vector Linux, 2003

. /sbin/vasm-functions

dbug() {
  echo $* > /dev/null
}

while [ 0 ]; do

if [ "$UID" = "0" ]; then

 $DCMD --backtitle "$BACKTITLE" --title "Vector Linux System Menu (root mode)" \
--menu \
"Welcome to Vector Linux's System menu. \n\n
Use the cursor [up] [down] keys to navigate the menu. 
Press the [enter] key to make a selection."  21 76 10 \
"ADMIN"  "Add/delete or change password of users on the system" \
"AUTOSET" "autosetup mouse,X,netcard,cdroms and sound card" \
"XSETUP" "setup 'X WINDOWS'. If you get stuck: CTRL+ALT+BS" \
"XTEXT"  "setup 'X Windows'. If the GUI config didn't work" \
"XBOOT"  "setup to boot into GUI mode. X must be working first" \
"XDMSET"   "setup X display manager for GUI mode login" \
"XWMSET"   "setup window manager launched from console (startx)" \
"XMENUSET" "setup the menu of XwmMenu" \
"KMAPSET" "remap 'KEYBOARD'. The default is US English" \
"COMSET" "setup 'MOUSE' and 'MODEM' devices" \
"CDSET"  "setup 'CD-ROM' device. DVD, CD-R, CD-R/W, etc" \
"SOUND"   "setup 'SOUND'. ISA pnp & PCIsound cards" \
"TIME"   "Set the PC to local or universal time zone" \
"NETWORK" "setup 'NETWORK'.Settings and card configuration" \
"GATEWAY" "Setup internal network GATEWAY configuration" \
"PPPSET"  "setup 'DIAL-UP'. PPP, ISP's phone number, etc" \
"SRVMENU"  "Menu to add/remove services from boot time" \
"LILO"   "setup 'LILO' the linux boot loader" \
"PKGTOOL"  "The Slackware package system" \
"MODULES" "setup 'DRIVERS'. [F2] to save & [ESC] to exit" \
"EXIT"   "To quit system menu" 2> $freply

else

 $DCMD --backtitle "$BACKTITLE" --title "Vector Linux System Menu (user mode)" \
--menu \
"Welcome to Vector Linux's System menu.\n
More menu would be available if you call this programs as root\n\n
Use the cursor [up] [down] keys to navigate the menu. 
Press the [enter] key to make a selection."  18 76 6 \
"ADMIN"  "Change your password" \
"XWMSET" "setup window manager launched from console (startx)" \
"EXIT"   "To quit system menu" 2> $freply

fi

 if [ $? = 1 -o $? = 255 ]; then
   clean_exit
 fi

 MAINSELECT="`cat $freply`"

 # Start checking what to do. Some modules may reset MAINSELECT to run the
 # next item in line.
dbug $MAINSELECT
 
case "$MAINSELECT" in
  "ADMIN")
   /sbin/vuser
   ;;
  "KEYMAP") 
    /sbin/kmapset
    ;;
  "COMSET")
    /sbin/comset
    ;;
  "AUTOSET")
    /sbin/vlautosetup
    ;;
  "XSETUP")
    if [ -x /usr/X11R6/bin/sax ]; then
	/usr/X11R6/bin/sax
    else
        /sbin/xf4config
    fi
    ;;    
  "XTEXT")
   /usr/X11R6/bin/xf86config
   ;;
  "XBOOT")
   /sbin/xboot
   ;;
  "XDMSET")
   /sbin/xdmset
   ;;
  "XWMSET")
   /sbin/xwmset
   ;;
  "XMENUSET")
   /sbin/xmenuset
   ;;
#  "XICONSET")
#   /sbin/xiconset
#   ;;
  "CDSET")
   /sbin/cdset
   ;; 
  "PCMCIA")
   pcmciaset
   ;;
  "SRVMENU")
   /sbin/srvmenu
   ;;
  "LILO")
   /sbin/liloconfig
   ;;
  "PKGTOOL")
   $CMD /sbin/pkgtool
   ;;
  "NETWORK")
   $CMD /sbin/netconfig
   ;;
  "GATEWAY")
   /sbin/netset
   ;;
  "PPPSET")
   $CMD /usr/sbin/pppsetup
   ;;
  "TIME")
   $DCMD /usr/sbin/timeconfig
   ;;
  "SOUND")
   $CMD /usr/sbin/sndconfig
   ;;
  "MODULES")
   $CMD mcedit /etc/rc.d/rc.modules
   ;;
  "EXIT")
    clean_exit
   ;;
esac
done

clean_exit
