[Pkg-shadow-commits] r584 - trunk/debian

Christian Perrier bubulle at costa.debian.org
Tue Oct 11 06:26:53 UTC 2005


Author: bubulle
Date: 2005-10-11 06:26:51 +0000 (Tue, 11 Oct 2005)
New Revision: 584

Modified:
   trunk/debian/changelog
   trunk/debian/passwd.config
   trunk/debian/passwd.templates
Log:
Include Ubuntu patches to allow preseeding the new user UID and allow hyphen
in the new username


Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2005-10-10 21:16:43 UTC (rev 583)
+++ trunk/debian/changelog	2005-10-11 06:26:51 UTC (rev 584)
@@ -34,8 +34,14 @@
     - debian/passwd.config, debian/passwd.templates:
       - allow preseeding the root (and user) password with a MD5 hash
         Closes: #275343, #304352
+        Thanks to Colin Watson for the Ubuntu patch
       - the above also allows preseeding a disabled password for root
         Closes: #304343
+      - add passwd/user-uid template, which can be preseeded to force the
+        initial user to have a certain uid.
+        Thanks to Colin Watson for the Ubuntu patch
+      - allow hyphens in username
+        Thanks to Colin Watson for the Ubuntu patch (Ubuntu #15721)
     - debian/login.defs:
       - document the obsoleted by PAM ENV_HZ variable. Closes: #265613
       - better document the real use of USERGROUPS_ENAB. Closes: #282822

Modified: trunk/debian/passwd.config
===================================================================
--- trunk/debian/passwd.config	2005-10-10 21:16:43 UTC (rev 583)
+++ trunk/debian/passwd.config	2005-10-11 06:26:51 UTC (rev 584)
@@ -225,7 +225,8 @@
 					userdefault=`echo $RET | sed 's/ .*//' | tr A-Z a-z`
 				    ;;
 				esac
-				if test -n "$userdefault"; then
+				if test -n "$userdefault" && \
+				   expr "$userdefault" : '[a-z][-a-z0-9]*$' >/dev/null; then
 					db_set passwd/username "$userdefault"
 				fi
 			fi
@@ -239,7 +240,7 @@
 			# Verify the user name, loop with message if bad.
 			db_get passwd/username
 			USER="$RET"
-			if ! expr "$USER" : '[a-z][a-z0-9]*$' >/dev/null; then
+			if ! expr "$USER" : '[a-z][-a-z0-9]*$' >/dev/null; then
 				db_fset passwd/username seen false
 				db_fset passwd/username-bad seen false
 				db_input critical passwd/username-bad
@@ -289,14 +290,25 @@
 			else
 			    USER_PW=$RET
 			fi
+
+			if db_get passwd/user-uid && [ "$RET" ]; then
+			    if test -x /usr/sbin/adduser; then
+				UIDOPT="--uid $RET"
+			    else
+				UIDOPT="-u $RET"
+			    fi
+			else
+			    UIDOPT=
+			fi
+
 			# Add the user to the database, using adduser in
 			# noninteractive mode.
 			db_get passwd/user-fullname
 
 			if test -x /usr/sbin/adduser; then
-			    adduser --disabled-password --gecos "$RET" "$USER" >/dev/null || true
+			    adduser --disabled-password --gecos "$RET" $UIDOPT "$USER" >/dev/null || true
 			else
-			    useradd -c "$RET" -m "$USER" >/dev/null || true
+			    useradd -c "$RET" -m "$USER" $UIDOPT >/dev/null || true
 			fi
 			
 			db_get passwd/user-password-crypted || true

Modified: trunk/debian/passwd.templates
===================================================================
--- trunk/debian/passwd.templates	2005-10-10 21:16:43 UTC (rev 583)
+++ trunk/debian/passwd.templates	2005-10-11 06:26:51 UTC (rev 584)
@@ -10,6 +10,12 @@
 Type: password
 Description: For internal use only
 
+# This template is for D-I purposes and should allow
+# preseeding the UID of the first created user
+Template: passwd/user-uid
+Type: string
+Description: For internal use only
+
 Template: passwd/root-password
 Type: password
 _Description: Root password:
@@ -99,3 +105,4 @@
  view even encrypted passwords. The passwords are stored in a separate file
  that can only be read by special programs. The use of shadow passwords
  is strongly recommended, except in a few cases such as NIS environments.
+




More information about the Pkg-shadow-commits mailing list