debian: parse /etc/adduser.conf file manually
The syntax for /etc/adduser.conf allows spaces around the equals sign,
i.e.:
GROUPHOMES = no
We were previously asking /bin/sh to source the file, which doesn't
support the above syntax. So pull out the necessary fields via
sed/grep.
Thanks to Juan A. Diaz for reporting the bug and suggesting the fix.
Addresses-Debian-Bug: #487443
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
diff --git a/debian/libuuid1.postinst b/debian/libuuid1.postinst
index ccbd881..27ca205 100644
--- a/debian/libuuid1.postinst
+++ b/debian/libuuid1.postinst
@@ -2,13 +2,26 @@
set -e
-FIRST_SYSTEM_UID=100
-LAST_SYSTEM_UID=999
-FIRST_SYSTEM_GID=100
-LAST_SYSTEM_GID=999
+ADDUSERCONF='/etc/adduser.conf'
-if test -f /etc/adduser.conf; then
- . /etc/adduser.conf
+if test -f $ADDUSERCONF; then
+ FIRST_SYSTEM_UID=$(sed -n "s/^[[:space:]]*FIRST_SYSTEM_UID[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" $ADDUSERCONF)
+ LAST_SYSTEM_UID=$(sed -n "s/^[[:space:]]*LAST_SYSTEM_UID[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" $ADDUSERCONF)
+ FIRST_SYSTEM_GID=$(sed -n "s/^[[:space:]]*FIRST_SYSTEM_GID[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" $ADDUSERCONF)
+ LAST_SYSTEM_GID=$(sed -n "s/^[[:space:]]*LAST_SYSTEM_GID[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" $ADDUSERCONF)
+fi
+
+if test -z "$FIRST_SYSTEM_UID"; then
+ FIRST_SYSTEM_UID=100
+fi
+if test -z "$LAST_SYSTEM_UID"; then
+ LAST_SYSTEM_UID=999
+fi
+if test -z "$FIRST_SYSTEM_GID"; then
+ FIRST_SYSTEM_GID=100
+fi
+if test -z "$LAST_SYSTEM_GID"; then
+ LAST_SYSTEM_GID=999
fi
groupadd -f -K GID_MIN=$FIRST_SYSTEM_GID -K GID_MAX=$LAST_SYSTEM_GID libuuid