[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: user-setup (1.24)



Hello Frans,

On Wed, May 20, 2009 at 4:46 PM, Frans Pop <elendil@planet.nl> wrote:
> On Wednesday 20 May 2009, Otavio Salvador wrote:
>> I belive this does all right now. Patch attached.
>
> No, it's still broken. You're seriously underestimating the complexity
> here.

I'd love to know what I missed, if you don't mind to explain. Anyway
an alternative patch is attached.

-- 
Otavio Salvador                  O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854         http://projetos.ossystems.com.br
From 38a556c7bdf6e61edebaadf7c9d6d20509b6fcd7 Mon Sep 17 00:00:00 2001
From: Otavio Salvador <otavio@ossystems.com.br>
Date: Wed, 20 May 2009 17:39:48 -0300
Subject: [PATCH] Add support for old passwd utilities that are used in Lenny.

---
 packages/user-setup/debian/changelog |    6 ++++++
 packages/user-setup/user-setup-apply |   17 +++++++++++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/packages/user-setup/debian/changelog b/packages/user-setup/debian/changelog
index 6330ce7..f4d06ed 100644
--- a/packages/user-setup/debian/changelog
+++ b/packages/user-setup/debian/changelog
@@ -1,3 +1,9 @@
+user-setup (1.26) UNRELEASED; urgency=low
+
+  * Add support for old passwd utilities that are used in Lenny.
+
+ -- Otavio Salvador <otavio@ossystems.com.br>  Wed, 20 May 2009 17:39:24 -0300
+
 user-setup (1.25) unstable; urgency=low
 
   * Brown paper bag release
diff --git a/packages/user-setup/user-setup-apply b/packages/user-setup/user-setup-apply
index 56b2357..173815b 100755
--- a/packages/user-setup/user-setup-apply
+++ b/packages/user-setup/user-setup-apply
@@ -25,10 +25,23 @@ fi
 # Pass in three arguments: the user, the password, and 'true' if the
 # password has been pre-crypted (by preseeding).
 setpassword () {
-	local USER PASSWD OPTS
+	local USER PASSWD OPTS VERSION LEGACY
 	USER="$1"
 	PASSWD="$2"
-	if [ "$3" = true ]; then
+
+	# legacy support for versions that aren't using the PAM support
+	VERSION=`$chroot dpkg -s passwd | sed -n '/^Version:/s,^Version: ,,p'`
+	LEGACY=
+	if $chroot dpkg --compare-versions $VERSION lt 1:4.1.4-1; then
+		LEGACY=true
+		if [ "$3" = true ]; then
+			OPTS=-e
+		else
+			OPTS=-m
+		fi
+	fi
+
+	if [ "$3" = true ] && [ -z "$LEGACY" ]; then
 		$chroot $ROOT usermod --password=$PASSWD $USER
 	else
 		$chroot $ROOT chpasswd $OPTS <<EOF
-- 
1.6.3.1.54.g99dd


Reply to: