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

Christian Perrier bubulle at costa.debian.org
Fri Oct 21 07:00:20 UTC 2005


Author: bubulle
Date: 2005-10-21 07:00:16 +0000 (Fri, 21 Oct 2005)
New Revision: 614

Added:
   trunk/debian/initial-passwd-udeb.postinst
   trunk/debian/initial-passwd-udeb.templates
Modified:
   trunk/debian/changelog
   trunk/debian/control
   trunk/debian/passwd.config
   trunk/debian/passwd.templates
   trunk/debian/rules
Log:
Create a udeb for future use in D-I


Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2005-10-17 06:16:24 UTC (rev 613)
+++ trunk/debian/changelog	2005-10-21 07:00:16 UTC (rev 614)
@@ -9,6 +9,9 @@
                      removed
     - debian/login.defs:
       - fix a typo.
+    - early release of a (currently not used) udeb to allow user creation
+      and password setting to be done in D-I first stage
+      Patch taken from Ubuntu. Thanks to Colin Watson for providing it.
   * Patches to upstream man pages, not yet applied upstream:
     - debian/patches/457_document_useradd_groupadd_nis:
       Document that low level utilities will certainly never

Modified: trunk/debian/control
===================================================================
--- trunk/debian/control	2005-10-17 06:16:24 UTC (rev 613)
+++ trunk/debian/control	2005-10-21 07:00:16 UTC (rev 614)
@@ -34,3 +34,14 @@
  newgrp program is used to change your effective group ID (useful for
  workgroup type situations). The su program allows changing your effective
  user ID (useful being able to execute commands as another user).
+
+Package: initial-passwd-udeb
+XC-Package-Type: udeb
+Section: debian-installer
+Priority: standard
+Architecture: all
+Depends: cdebconf-udeb, base-installer
+XB-Installer-Menu-Item: 71
+Description: Set up users and passwords
+ This package sets up initial users and passwords. (If this package isn't
+ used, base-config will do the same job after the first reboot.)

Added: trunk/debian/initial-passwd-udeb.postinst
===================================================================
--- trunk/debian/initial-passwd-udeb.postinst	2005-10-17 06:16:24 UTC (rev 613)
+++ trunk/debian/initial-passwd-udeb.postinst	2005-10-21 07:00:16 UTC (rev 614)
@@ -0,0 +1,68 @@
+#! /bin/sh -e
+
+. /usr/share/debconf/confmodule
+
+db_get debian-installer/locale
+if [ "$RET" ]; then
+	TARGETLANG="$RET"
+else
+	TARGETLANG=C
+fi
+
+db_get debconf/priority
+TARGETPRIO="$RET"
+
+target_debconf () {
+	env -u DEBIAN_HAS_FRONTEND -u DEBIAN_FRONTEND \
+		-u DEBCONF_REDIR -u DEBCONF_OLD_FD_BASE \
+		DEBCONF_READFD=0 DEBCONF_WRITEFD=3 \
+		DEBIAN_PRIORITY="$TARGETPRIO" \
+		LANG="$TARGETLANG" DEBCONF_RECONFIGURE=1 \
+		chroot /target debconf -o base-config "$@"
+}
+
+tmpfile="$(mktemp /target/tmp/initial-passwd-udeb.XXXXXX)"
+trap "rm -f '$tmpfile'" EXIT HUP INT QUIT TERM
+echo '. /usr/share/debconf/confmodule' >>"$tmpfile"
+
+need_copy=
+
+# Copy information from cdebconf to debconf. This is a horrible hack around
+# the lack of a debconf-copydb that works with cdebconf's rfc822db.
+for q in passwd/root-password passwd/root-password-again passwd/make-user \
+		passwd/username passwd/username-bad passwd/user-fullname \
+		passwd/user-password passwd/user-password-again \
+		passwd/password-mismatch passwd/password-empty passwd/shadow \
+		passwd/md5 passwd/root-password-empty \
+		passwd/root-password-crypted passwd/user-password-crypted; do
+	db_get "$q" || continue
+	value="$(printf %s "$RET" | sed "s/'/'\\\\''/g")"
+	db_fget "$q" seen
+	seen="$(printf %s "$RET" | sed "s/'/'\\\\''/g")"
+	cat >>"$tmpfile" <<EOF
+db_register '$q' '$q'
+db_set '$q' '$value'
+db_fset '$q' seen '$seen'
+EOF
+	need_copy=1
+done
+
+if [ "$need_copy" ]; then
+	chmod +x "$tmpfile"
+	target_debconf "${tmpfile#/target}"
+fi
+
+# Ideally, dpkg-reconfigure wouldn't create a new frontend every time. In
+# the meantime, we reimplement a couple of bits of it. Note that
+# DEBCONF_RECONFIGURE=1 is set in target_debconf above.
+
+version="$(LANG="$TARGETLANG" chroot /target dpkg --status passwd | \
+	   grep ^Version: | sed 's/^Version: //')"
+CODE=0
+target_debconf -f passthrough \
+	/var/lib/dpkg/info/passwd.config reconfigure "$version" || CODE="$?"
+if [ "$CODE" = 30 ]; then
+	exit 10
+else
+	exit $CODE
+fi

Added: trunk/debian/initial-passwd-udeb.templates
===================================================================
--- trunk/debian/initial-passwd-udeb.templates	2005-10-17 06:16:24 UTC (rev 613)
+++ trunk/debian/initial-passwd-udeb.templates	2005-10-21 07:00:16 UTC (rev 614)
@@ -0,0 +1,3 @@
+Template: debian-installer/initial-passwd-udeb/title
+Type: title
+_Description: Set up users and passwords

Modified: trunk/debian/passwd.config
===================================================================
--- trunk/debian/passwd.config	2005-10-17 06:16:24 UTC (rev 613)
+++ trunk/debian/passwd.config	2005-10-21 07:00:16 UTC (rev 614)
@@ -16,8 +16,7 @@
 
 . /usr/share/debconf/confmodule
 db_capb "backup"
-# Remove this : not translatable and looks ugly in d-i process
-# db_title "Password setup"
+db_settitle passwd/title
 
 # Returns a true value if there seems to be a system user account.
 is_system_user () {
@@ -39,7 +38,8 @@
 	fi
 
 	if [ -e /etc/shadow ] && \
-	   [ "`grep ^root: /etc/shadow | cut -d : -f 2`" ]; then
+	   [ "`grep ^root: /etc/shadow | cut -d : -f 2`" -a \
+	     "`grep ^root: /etc/shadow | cut -d : -f 2`" != '*' ]; then
 		return 0
 	fi
 	

Modified: trunk/debian/passwd.templates
===================================================================
--- trunk/debian/passwd.templates	2005-10-17 06:16:24 UTC (rev 613)
+++ trunk/debian/passwd.templates	2005-10-21 07:00:16 UTC (rev 614)
@@ -106,3 +106,6 @@
  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.
 
+Template: passwd/title
+Type: title
+_Description: Set up users and passwords

Modified: trunk/debian/rules
===================================================================
--- trunk/debian/rules	2005-10-17 06:16:24 UTC (rev 613)
+++ trunk/debian/rules	2005-10-21 07:00:16 UTC (rev 614)
@@ -170,6 +170,8 @@
 	dh_compress
 	dh_shlibdeps
 	dh_installdebconf
+	echo >> debian/initial-passwd-udeb/DEBIAN/templates
+	po2debconf --podir=debian/po --encoding=utf8 debian/passwd.templates >> debian/initial-passwd-udeb/DEBIAN/templates
 ifeq ($(DEB_HOST_ARCH_OS),hurd)
 	echo "loginpam=login, libpam-modules (>= 0.72-5)" >> debian/passwd.substvars
 else




More information about the Pkg-shadow-commits mailing list