#!/bin/sh
# @vasm : VUSER
# @level: user
# @description: setup password and users  
# 
# (c) Eko M. Budi, 2003
# (c) Vector Linux, 2003
#
# Released under GNU GPL

if [ ! "$VASM_FUNCTIONS" ]; then
  . /sbin/vasm-functions
fi

#########################################################################
get_menu()
{
  DIMENSION="15 50 4"
  TITLE="USER MANAGEMENT"
  TEXT="\n
This is a simple menu to manage some users.\n\n
Please select what do you want to do ?"

$DCMD --backtitle "$BACKTITLE" --title "$TITLE" --menu "$TEXT" $DIMENSION \
 "ADD" "Add a new user" \
 "DEL" "Delete a user" \
 "CHANGE" "Change user password" \
 "PASSWD" "Change root password" 2> $freply

   [ ! $? = 0 ] && clean_exit 1
}

####################################################################################
# MAIN PROGRAM

# Menu for root, or plain change password for user
if [ "$UID" = 0 ]; then
  while [ 1 ]; do 
    get_menu
    case `cat $freply` in
      PASSWD)
        /sbin/vpasswd root
        ;; 
      CHANGE) 
        /sbin/vpasswd
        ;;
      ADD)
        /sbin/vuseradd
        ;;
      DEL)
        /sbin/vuserdel
	;;
    esac
  done  
else  
   . /sbin/vpasswd1 
fi
