Adding support for setting users login shell in passwd script.
authorDaniel Baumann <daniel@debian.org>
Thu, 31 Jan 2013 04:03:50 +0000 (05:03 +0100)
committerDaniel Baumann <daniel@debian.org>
Thu, 31 Jan 2013 06:32:42 +0000 (07:32 +0100)
scripts/debconfig/0010-passwd
scripts/debconfig/0010-passwd.templates

index 726868e..af7908e 100755 (executable)
@@ -232,6 +232,15 @@ then
                db_set live-debconfig/passwd/user-default-groups ""
        fi
 
+       # user login shell
+       if db_get live-debconfig/passwd/user-login-shell
+       then
+               _USER_LOGIN_SHELL="${RET}" # string (w/ empty)
+
+               db_fset live-debconfig/passwd/user-login-shell seen false
+               db_set live-debconfig/passwd/user-login-shell ""
+       fi
+
        # user system-user
        if db_get live-debconfig/passwd/user-system-user
        then
@@ -310,6 +319,14 @@ do
                db_set live-debconfig/passwd/user${_NUMBER}-default-groups ""
        fi
 
+       if db_get live-debconfig/passwd/user${_NUMBER}-login-shell
+       then
+               eval _USER${_NUMBER}_LOGIN_SHELL="\"${RET}\"" # string (w/ empty)
+
+               db_fset live-debconfig/passwd/user${_NUMBER}-login-shell seen false
+               db_set live-debconfig/passwd/user${_NUMBER}-login-shell ""
+       fi
+
        if db_get live-debconfig/passwd/user${_NUMBER}-system-user
        then
                eval _USER${_NUMBER}_SYSTEM_USER="\"${RET}\"" # string (w/ empty)
@@ -396,6 +413,11 @@ then
                _USER_OPTIONS="${_USER_OPTIONS} --groups $(echo ${_GROUPS} | sed -e 's| |,|g')"
        fi
 
+       if [ -n "${_USER_LOGIN_SHELL}" ]
+       then
+               _USER_OPTIONS="${_USER_OPTIONS} --shell ${_USER_LOGIN_SHELL}"
+       fi
+
        if [ "${_USER_SYSTEM_USER}" = "true" ]
        then
                _USER_OPTIONS="${_USER_OPTIONS} --system"
@@ -444,6 +466,7 @@ do
        eval _UID="$`echo _USER${_NUMBER}_UID`"
        eval _GID="$`echo _USER${_NUMBER}_GID`"
        eval _DEFAULT_GROUPS="$`echo _USER${_NUMBER}_DEFAULT_GROUPS`"
+       eval _LOGIN_SHELL="$`echo _USER${_NUMBER}_LOGIN_SHELL`"
        eval _SYSTEM_USER="$`echo _USER${_NUMBER}_SYSTEM_USER`"
        eval _FULLNAME="$`echo _USER${_NUMBER}_FULLNAME`"
 
@@ -494,6 +517,11 @@ do
                _OPTIONS="${_OPTIONS} --groups $(echo ${_GROUPS} | sed -e 's| |,|g')"
        fi
 
+       if [ -n "${_LOGIN_SHELL}" ]
+       then
+               _OPTIONS="${_OPTIONS} --shell ${_LOGIN_SHELL}"
+       fi
+
        if [ "${_SYSTEM_USER}" = "true" ]
        then
                _OPTIONS="${_OPTIONS} --system"
index c06ac34..fed3fbf 100644 (file)
@@ -74,6 +74,10 @@ Template: live-debconfig/passwd/user-default-groups
 Type: string
 Description: internal
 
+Template: live-debconfig/passwd/user-login-shell
+Type: string
+Description: internal
+
 Template: live-debconfig/passwd/user-system-user
 Type: boolean
 Description: internal