Re: user-setup (1.24)
Hello Christian,
On Wed, May 20, 2009 at 1:54 PM, Christian Perrier <bubulle@debian.org> wrote:
> - another solution proposed by otavio that I haven't been able to
> understand: he'll propose a patch soon
I'm sending the attached patch for people to comment. My idea is that
the lenny.sh script to be included in lenny-support udeb and then it
is only included here for reference.
--
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 53d3b2046d81da6a867da2b9bbc22c6c3f01eee4 Mon Sep 17 00:00:00 2001
From: Otavio Salvador <otavio@ossystems.com.br>
Date: Wed, 20 May 2009 15:24:12 -0300
Subject: [PATCH] Use a specific script by suite for setting the password. This restores the compatibility with Lenny through lenny-support package (that will provide the lenny.sh script).
---
packages/user-setup/debian/changelog | 8 ++++++
packages/user-setup/debian/user-setup-udeb.install | 1 +
packages/user-setup/debian/user-setup.install | 1 +
packages/user-setup/scripts/default.sh | 20 ++++++++++++++
packages/user-setup/scripts/lenny.sh | 11 ++++++++
packages/user-setup/user-setup-apply | 27 +++++--------------
6 files changed, 48 insertions(+), 20 deletions(-)
create mode 100644 packages/user-setup/scripts/default.sh
create mode 100644 packages/user-setup/scripts/lenny.sh
diff --git a/packages/user-setup/debian/changelog b/packages/user-setup/debian/changelog
index 6330ce7..2d181ed 100644
--- a/packages/user-setup/debian/changelog
+++ b/packages/user-setup/debian/changelog
@@ -1,3 +1,11 @@
+user-setup (1.26) UNRELEASED; urgency=low
+
+ * Use a specific script by suite for setting the password. This restores
+ the compatibility with Lenny through lenny-support package (that will
+ provide the lenny.sh script).
+
+ -- Otavio Salvador <otavio@ossystems.com.br> Wed, 20 May 2009 15:22:25 -0300
+
user-setup (1.25) unstable; urgency=low
* Brown paper bag release
diff --git a/packages/user-setup/debian/user-setup-udeb.install b/packages/user-setup/debian/user-setup-udeb.install
index 29c7804..f351806 100644
--- a/packages/user-setup/debian/user-setup-udeb.install
+++ b/packages/user-setup/debian/user-setup-udeb.install
@@ -1,6 +1,7 @@
user-setup-ask usr/bin
user-setup-apply usr/bin
functions.sh usr/lib/user-setup
+scripts usr/lib/user-setup
reserved-usernames usr/lib/user-setup
finish-install.d usr/lib
pre-pkgsel.d usr/lib
diff --git a/packages/user-setup/debian/user-setup.install b/packages/user-setup/debian/user-setup.install
index 1014600..4a10db2 100644
--- a/packages/user-setup/debian/user-setup.install
+++ b/packages/user-setup/debian/user-setup.install
@@ -2,4 +2,5 @@ user-setup usr/bin
user-setup-ask usr/lib/user-setup
user-setup-apply usr/lib/user-setup
functions.sh usr/lib/user-setup
+scripts usr/lib/user-setup
reserved-usernames usr/lib/user-setup
diff --git a/packages/user-setup/scripts/default.sh b/packages/user-setup/scripts/default.sh
new file mode 100644
index 0000000..6de3488
--- /dev/null
+++ b/packages/user-setup/scripts/default.sh
@@ -0,0 +1,20 @@
+# Set a password, via chpasswd.
+# Use a heredoc rather than echo, to avoid the password
+# showing in the process table. (However, this is normally
+# only called when first installing the system, when root has no
+# password at all, so that should be an unnecessary precaution).
+#
+# Pass in three arguments: the user, the password, and 'true' if the
+# password has been pre-crypted (by preseeding).
+setpassword () {
+ local USER PASSWD OPTS
+ USER="$1"
+ PASSWD="$2"
+ if [ "$3" = true ]; then
+ $chroot $ROOT usermod --password=$PASSWD $USER
+ else
+ $chroot $ROOT chpasswd $OPTS <<EOF
+$USER:$PASSWD
+EOF
+ fi
+}
diff --git a/packages/user-setup/scripts/lenny.sh b/packages/user-setup/scripts/lenny.sh
new file mode 100644
index 0000000..5d95bd3
--- /dev/null
+++ b/packages/user-setup/scripts/lenny.sh
@@ -0,0 +1,11 @@
+setpassword () {
+ local USER PASSWD OPTS
+ USER="$1"
+ PASSWD="$2"
+ if [ "$3" = true ]; then
+ OPTS=-e
+ fi
+ $chroot $ROOT chpasswd $OPTS <<EOF
+$USER:$PASSWD
+EOF
+}
diff --git a/packages/user-setup/user-setup-apply b/packages/user-setup/user-setup-apply
index 56b2357..aef5161 100755
--- a/packages/user-setup/user-setup-apply
+++ b/packages/user-setup/user-setup-apply
@@ -16,26 +16,13 @@ fi
. /usr/lib/user-setup/functions.sh
-# Set a password, via chpasswd.
-# Use a heredoc rather than echo, to avoid the password
-# showing in the process table. (However, this is normally
-# only called when first installing the system, when root has no
-# password at all, so that should be an unnecessary precaution).
-#
-# Pass in three arguments: the user, the password, and 'true' if the
-# password has been pre-crypted (by preseeding).
-setpassword () {
- local USER PASSWD OPTS
- USER="$1"
- PASSWD="$2"
- if [ "$3" = true ]; then
- $chroot $ROOT usermod --password=$PASSWD $USER
- else
- $chroot $ROOT chpasswd $OPTS <<EOF
-$USER:$PASSWD
-EOF
- fi
-}
+suite=default
+db_get mirror/suite
+if [ -n "$RET" ] && [ -e /usr/lib/user-setup/scripts/$RET ]; then
+ suite="$RET"
+fi
+
+. /usr/lib/user-setup/scripts/$suite.sh
# Enable/disable shadow passwords.
db_get passwd/shadow
--
1.6.3.1.54.g99dd
Reply to: