Here is my draft, where code borrowed from an old source is still partially visible. I need ATM to retrieve the selection correctly and associate it with the two commands adduser and deluser:
Code: Select all
deleted
Code: Select all
deleted
Code: Select all
#!/bin/bash
DIALOG=${DIALOG=dialog}
#must be root
chk_root () {
if [ ! $( id -u ) -eq 0 ]; then
dialog --title "Permission" --msgbox "Must be run as root" 8 30
exit
fi
}
chk_root
DURATION=$1
$DIALOG --title "Simple user management" --clear \
--yesno "This gives you a simple means of managing users for common situations. If you need more functionality, consider installing something like gnome-system-tools. \n Would you like to continue?" 20 40
# Get exit status
# 0 means user wants to add a user
# 1 means user does not want to add a user
# 255 means user hit [Esc] key.
response=$?
case $response in
0) dialog --title "Method" --msgbox "You will be returned to a root prompt, where you need to enter a command: \n
TO ADD NEW USER: adduser new-user-name \n
TO SPECIFY GROUP (optional): \n
adduser -G name-of-group new-user-name \n
TO DELETE: deluser user-name" 20 80;;
1) exit;;
255) dialog --title "Exit" --msgbox "[ESC] key pressed." 8 30;;
esac
exit
Code: Select all
/usr/loca/bin
Code: Select all
#!/bin/bash
# File Name: user-management
# Version: 1.2.5
# Purpose: USERS ( adding, removing, recovering, repairing, and login options )
# GROUPS ( adding, removing, and adding users )
# PASSWORDS ( changing user passwords )
# Authors: Dave and minor modifications by anticapitalista
# Acknowledgements: AntiX forum users for suggestions, testing, and input
# Special Acknowledgements: anticapitalista for testing, suggestions, input
# Copyright (C) Tuesday, Feb. 7, 2011 by Dave / david.dejong02@gmail.com
# License: gplv2
# This file 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 2 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#################################################################################################################################################
Worked if I added gksu in front, but then the "exit" command just kills it. Could try "shell" instead, I guess.you can use xfce4-terminal -x then the command to run it in a terminal