X-Git-Url: https://git.cameronkatri.com/pw-darwin.git/blobdiff_plain/e4991920d98d5e5afad673e5d537d558426b7716..3ced9eea5b4ddcfc4c39f90e8a02efdb3e483685:/adduser/adduser.sh diff --git a/adduser/adduser.sh b/adduser/adduser.sh index 0a92133..96049bd 100644 --- a/adduser/adduser.sh +++ b/adduser/adduser.sh @@ -145,7 +145,7 @@ fullpath_from_shell() { save_config() { echo "# Configuration file for adduser(8)." > ${ADDUSERCONF} echo "# NOTE: only *some* variables are saved." >> ${ADDUSERCONF} - echo "# Last Modified on `date`." >> ${ADDUSERCONF} + echo "# Last Modified on `${DATECMD}`." >> ${ADDUSERCONF} echo '' >> ${ADDUSERCONF} echo "defaultclass=$uclass" >> ${ADDUSERCONF} echo "defaultgroups=$ugroups" >> ${ADDUSERCONF} @@ -328,7 +328,7 @@ get_shell() { ushell="$defaultshell" # Make sure the current value of the shell is a valid one - _shellchk="grep '^$ushell$' ${ETCSHELLS} > /dev/null 2>&1" + _shellchk="${GREPCMD} '^$ushell$' ${ETCSHELLS} > /dev/null 2>&1" eval $_shellchk || { err "Invalid shell ($ushell). Using default shell ${defaultshell}." ushell="$defaultshell" @@ -601,6 +601,7 @@ input_interactive() { ;; esac passwdtype="yes" + [ -n "$configrun" ] && break trap 'stty echo; exit' 0 1 2 3 15 stty -echo echo -n "Enter password: " @@ -677,7 +678,8 @@ input_interactive() { _pass='' ;; esac - printf "%-10s : %s\n" "Password" "$_pass" + [ -z "$configflag" ] && printf "%-10s : %s\n" "Password" "$_pass" + [ -n "$configflag" ] && printf "%-10s : %s\n" "Pass Type" "$passwdtype" [ -z "$configflag" ] && printf "%-10s : %s\n" "Full Name" "$ugecos" [ -z "$configflag" ] && printf "%-10s : %s\n" "Uid" "$uuid" printf "%-10s : %s\n" "Class" "$uclass" @@ -712,6 +714,8 @@ ADDUSERCONF="${ADDUSERCONF:-/etc/adduser.conf}" PWCMD="${PWCMD:-/usr/sbin/pw}" MAILCMD="${MAILCMD:-mail}" ETCSHELLS="${ETCSHELLS:-/etc/shells}" +GREPCMD="/usr/bin/grep" +DATECMD="/bin/date" # Set default values # @@ -871,4 +875,22 @@ if [ -n "$fflag" ]; then fi else input_interactive + while : ; do + echo -n "Add another user? (yes/no): " + read _input + case $_input in + [Yy][Ee][Ss]|[Yy][Ee]|[Yy]) + uidstart=`get_nextuid $uidstart` + input_interactive + continue + ;; + [Nn][Oo]|[Nn]) + echo "Goodbye!" + ;; + *) + continue + ;; + esac + break + done fi