CVS: moonbase/security/shadow adduser,1.1.1.1,1.2

sofar at lunar-linux.org sofar at lunar-linux.org
Sat Jul 19 19:33:53 GMT 2003


Update of /var/cvs/lunar/moonbase/security/shadow
In directory dbguin.lunar-linux.org:/tmp/cvs-serv18440

Modified Files:
	adduser 
Log Message:
Adding the upg scheme to adduser!


Index: adduser
===================================================================
RCS file: /var/cvs/lunar/moonbase/security/shadow/adduser,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- adduser	21 Aug 2002 00:55:21 -0000	1.1.1.1
+++ adduser	19 Jul 2003 19:33:51 -0000	1.2
@@ -3,6 +3,7 @@
 # by Hrvoje Dogan <hdogan at student.math.hr>, Dec 1995.
 # Modified by Patrick Volkerding, Oct 1997, Mar 1999, May 2000.
 # Modified by Kagan Kongar, 20020315
+# Modified by Auke Kok, 20030703 (Added upg scheme)
 
 if  ! [  "$UID"  ==  0  ];  then
   echo "You have to be r00t for that. Enter root password for su"
@@ -10,12 +11,16 @@
   exit
 fi
 
+
 echo
-echo -n "Login name for new user []: "
+echo -n "Login name for new user [$1]: "
 read LOGIN
 if [ -z "$LOGIN" ]; then
-  echo "Come on, man, you can't leave the login field empty..."
-  exit
+  LOGIN=$1
+  if [ -z "$LOGIN" ]; then
+    echo "Come on, man, you can't leave the login field empty..."
+    exit
+  fi
 fi
 echo
 echo -n "User id for $LOGIN [ defaults to next available]: "
@@ -26,10 +31,10 @@
 fi
 
 echo
-echo -n "Initial group for $LOGIN [users]: "
+echo -n "Initial group for $LOGIN [$LOGIN]: "
 read GID
 if [ -z "$GID" ]; then
-  GID="users"
+  GID="$LOGIN"
 fi
 GGID="-g $GID"
 
@@ -105,6 +110,10 @@
 echo "ENTER to go ahead and make the account."
 read FOO
 echo
+if ! grep -q "^$GID:" /etc/group ; then
+  echo Making new group...
+  /usr/sbin/groupadd $GID
+fi
 echo Making new account...
 /usr/sbin/useradd $GHME -m $GEXP $GGID $GAGID $GSHL $GUID $LOGIN
 if [ -d $HME ]; then




More information about the Lunar-commits mailing list