From 5882a3cbfa7370f92d4dbf3cd64de78529194252 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 23 Jun 2008 11:57:54 -0400 Subject: [PATCH] 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" --- debian/libuuid1.postinst | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) 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 -- 1.8.3.1