-AUX 1.0.9/superadduser 13900 RMD160 60af04c3707add21ff497f98a74d65ba7eebb5ea SHA1 4ffaab62ae438630a5b66da650e19cc97d985c23 SHA256 43e73450ea80bf0a805a5617ebe5b5b7d2444aa87809c95170327e506a7a2375
-MD5 0365b9983675df485280fe5f570411f1 files/1.0.9/superadduser 13900
-RMD160 60af04c3707add21ff497f98a74d65ba7eebb5ea files/1.0.9/superadduser 13900
-SHA256 43e73450ea80bf0a805a5617ebe5b5b7d2444aa87809c95170327e506a7a2375 files/1.0.9/superadduser 13900
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+AUX 1.0.9/superadduser 13977 RMD160 5367014769768328146a5a7737dc49293f8fa2e9 SHA1 e7cf5043442499df9cf13cd6e1bd1a47dc69cff6 SHA256 ff4e6714c84a59b83d2d2c950bf76ffcd0636fbe4c3c2fe5b94ca5552bbb4211
+MD5 c722bb24cf5b67a576035675800336f3 files/1.0.9/superadduser 13977
+RMD160 5367014769768328146a5a7737dc49293f8fa2e9 files/1.0.9/superadduser 13977
+SHA256 ff4e6714c84a59b83d2d2c950bf76ffcd0636fbe4c3c2fe5b94ca5552bbb4211 files/1.0.9/superadduser 13977
AUX superadduser.8 517 RMD160 dc3991d1aa4a62350a1c0d93860db86b90e0c2b5 SHA1 1a0609b5e7b7d7ec473a66dcb9c2509833ac991e SHA256 87c423e40c11b3608c235d2fb2b6ad2505a909c83ff9b285ab59888967b9475d
MD5 0d5686d1a7f9fd1035ca0cb455864559 files/superadduser.8 517
RMD160 dc3991d1aa4a62350a1c0d93860db86b90e0c2b5 files/superadduser.8 517
MD5 a6d311464bc217bee7fe9e00ce029896 superadduser-1.0.9.ebuild 587
RMD160 5163c09a94090abaec86cf3c0f667f9a101075e8 superadduser-1.0.9.ebuild 587
SHA256 96bc21a2d304b30b6a7bb4728e8b2f274fa7bbec62ddddba64a1c576513723fd superadduser-1.0.9.ebuild 587
-MISC ChangeLog 5240 RMD160 ad97fcce7ca2a56dce0e1ef85838270c70e58704 SHA1 f54bfcad1d0405cad7e36b98186d9e94ae1bf6f0 SHA256 44198ea70885c124dc69ac1a71f43f735fd130765dba60aa3abbd6b8dbb5a71b
-MD5 986d675dc39384f8e5feb04c73cd021a ChangeLog 5240
-RMD160 ad97fcce7ca2a56dce0e1ef85838270c70e58704 ChangeLog 5240
-SHA256 44198ea70885c124dc69ac1a71f43f735fd130765dba60aa3abbd6b8dbb5a71b ChangeLog 5240
+MISC ChangeLog 5361 RMD160 ddcc156dfbb69f291d76daffde4079c5ad317384 SHA1 f31b03952235d30b5038aacc818e748aabe5e472 SHA256 ce5f1b240f00a516204dfa75c407d8dd3e66ca3a764c4b9be9ed248879db2b60
+MD5 2d5dbce1677be31f81b67cd9a5688350 ChangeLog 5361
+RMD160 ddcc156dfbb69f291d76daffde4079c5ad317384 ChangeLog 5361
+SHA256 ce5f1b240f00a516204dfa75c407d8dd3e66ca3a764c4b9be9ed248879db2b60 ChangeLog 5361
MISC metadata.xml 164 RMD160 f43cbec30b7074319087c9acffdb9354b17b0db3 SHA1 9c213f5803676c56439df3716be07d6692588856 SHA256 f5f2891f2a4791cd31350bb2bb572131ad7235cd0eeb124c9912c187ac10ce92
MD5 9a09f8d531c582e78977dbfd96edc1f2 metadata.xml 164
RMD160 f43cbec30b7074319087c9acffdb9354b17b0db3 metadata.xml 164
MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-superadduser-1.0.9 0
RMD160 9c1185a5c5e9fc54612808977ee8f548b2258d31 files/digest-superadduser-1.0.9 0
SHA256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 files/digest-superadduser-1.0.9 0
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.2 (GNU/Linux)
+
+iD8DBQFF7y96kT4lNIS36YERAlg5AJ95RweaWUKpymaFS/AnGE1meB/4GgCgu3ZI
+Cd27vEIqTCDC6Z8YiLg6mO0=
+=ZBaQ
+-----END PGP SIGNATURE-----
# (we ignore it if it's not at the beginning of the line (i.e. commented out with #))
export recycleUIDMIN="$(grep ^UID_MIN /etc/login.defs | awk '{print $2}' 2>/dev/null)"
# If we couldn't find it, set it to the default of 1000
-if [ -z "$recycleUIDMIN" ]; then
+if [[ -z "$recycleUIDMIN" ]]; then
export recycleUIDMIN=1000 # this is the default from Slackware's /etc/login.defs
fi
# it (even though bash1 is no longer supported on Slackware).
function get_input() {
local output
- if [ "`echo $BASH_VERSION | cut -b1`" = "1" ]; then
+ if [[ "`echo $BASH_VERSION | cut -b1`" = "1" ]]; then
echo -n "${1} " >&2 # fudge for use with bash v1
read output
else # this should work with any other /bin/sh
goose="$(echo $2 | cut -d ' ' -f 2-)" # lop off the prefixed argument useradd needs
echo -n "$1 "
# If it's null then display the 'other' information
- if [ -z "$goose" -a ! -z "$3" ]; then
+ if [[ -z "$goose" -a ! -z "$3" ]]; then
echo "$3"
else
echo "$goose"
# Function to check whether groups exist in the /etc/group file
function check_group () {
local got_error group
- if [ ! -z "$@" ]; then
+ if [[ ! -z "$@" ]]; then
for group in $@ ; do
local uid_not_named="" uid_not_num=""
grep -v "$^" $gfile | awk -F: '{print $1}' | grep "^${group}$" >/dev/null 2>&1 || uid_not_named=yes
grep -v "$^" $gfile | awk -F: '{print $3}' | grep "^${group}$" >/dev/null 2>&1 || uid_not_num=yes
- if [ ! -z "$uid_not_named" -a ! -z "$uid_not_num" ]; then
+ if [[ ! -z "$uid_not_named" -a ! -z "$uid_not_num" ]]; then
echo "- Group '$group' does not exist"
got_error=yes
fi
done
fi
# Return exit code of 1 if at least one of the groups didn't exist
- if [ ! -z "$got_error" ]; then
+ if [[ ! -z "$got_error" ]]; then
return 1
fi
}
echo
LOGIN="$1"
needinput=yes
-while [ ! -z $needinput ]; do
- if [ -z "$LOGIN" ]; then
- while [ -z "$LOGIN" ]; do LOGIN="$(get_input "Login name for new user []:")" ; done
+while [[ ! -z $needinput ]]; do
+ if [[ -z "$LOGIN" ]]; then
+ while [[ -z "$LOGIN" ]]; do LOGIN="$(get_input "Login name for new user []:")" ; done
fi
grep "^${LOGIN}:" $pfile >/dev/null 2>&1 # ensure it's not already used
- if [ $? -eq 0 ]; then
+ if [[ $? -eq 0 ]]; then
echo "- User '$LOGIN' already exists; please choose another"
unset LOGIN
- elif [ ! -z "$( echo $LOGIN | grep "^[0-9]" )" ]; then
+ elif [[ ! -z "$( echo $LOGIN | grep "^[0-9]" )" ]]; then
echo "- User names cannot begin with a number; please choose another"
unset LOGIN
- elif [ ! "$LOGIN" = "`echo $LOGIN | tr A-Z a-z`" ]; then # useradd does not allow uppercase
+ elif [[ ! "$LOGIN" = "`echo $LOGIN | tr A-Z a-z`" ]]; then # useradd does not allow uppercase
echo "- User '$LOGIN' contains illegal characters (uppercase); please choose another"
unset LOGIN
- elif [ ! -z "$( echo $LOGIN | grep '\.' )" ]; then
+ elif [[ ! -z "$( echo $LOGIN | grep '\.' )" ]]; then
echo "- User '$LOGIN' contains illegal characters (period/dot); please choose another"
unset LOGIN
else
done
# Display the user name passed from the shell if it hasn't changed
-if [ "$1" = "$LOGIN" ]; then
+if [[ "$1" = "$LOGIN" ]]; then
echo "Login name for new user: $LOGIN"
fi
#
echo
needinput=yes
-while [ ! -z "$needinput" ]; do
+while [[ ! -z "$needinput" ]]; do
_UID="$(get_input "User ID ('UID') [ defaults to next available ]:")"
grep -v "^$" $pfile | awk -F: '{print $3}' | grep "^${_UID}$" >/dev/null 2>&1
- if [ $? -eq 0 ]; then
+ if [[ $? -eq 0 ]]; then
echo "- That UID is already in use; please choose another"
elif [ ! -z "$(echo $_UID | egrep '[A-Za-z]')" ]; then
echo "- UIDs are numerics only"
fi
done
# If we were given a UID, then syntax up the variable to pass to useradd
-if [ ! -z "$_UID" ]; then
+if [[ ! -z "$_UID" ]]; then
U_ID="-u ${_UID}"
else
# Will we be recycling UIDs?
- if [ "$recycleuids" = "yes" ]; then
+ if [[ "$recycleuids" = "yes" ]]; then
U_ID="-u $(awk -F: '{uid[$3]=1} END { for (i=ENVIRON["recycleUIDMIN"];i in uid;i++);print i}' $pfile)"
fi
fi
# We check /etc/group for both the text version and the group ID number
echo
needinput=yes
-while [ ! -z "$needinput" ]; do
+while [[ ! -z "$needinput" ]]; do
GID="$(get_input "Initial group [ ${defgroup} ]:")"
check_group "$GID"
- if [ $? -gt 0 ]; then
+ if [[ $? -gt 0 ]]; then
echo "- Please choose another"
else
unset needinput
fi
done
# Syntax the variable ready for useradd
-if [ -z "$GID" ]; then
+if [[ -z "$GID" ]]; then
GID="-g ${defgroup}"
else
GID="-g ${GID}"
#
echo
needinput=yes
-while [ ! -z "$needinput" ]; do
+while [[ ! -z "$needinput" ]]; do
AGID="$(get_input "Additional groups (comma separated) []:")"
AGID="$(echo "$AGID" | tr -d ' ' | tr , ' ')" # fix up for parsing
- if [ ! -z "$AGID" ]; then
+ if [[ ! -z "$AGID" ]]; then
check_group "$AGID" # check all groups at once (treated as N # of params)
- if [ $? -gt 0 ]; then
+ if [[ $? -gt 0 ]]; then
echo "- Please re-enter the group(s)"
else
unset needinput # we found all groups specified
#
echo
needinput=yes
-while [ ! -z "$needinput" ]; do
+while [[ ! -z "$needinput" ]]; do
HME="$(get_input "Home directory [ ${defhome}/${LOGIN} ]")"
- if [ -z "$HME" ]; then
+ if [[ -z "$HME" ]]; then
HME="${defhome}/${LOGIN}"
fi
# Warn the user if the home dir already exists
- if [ -d "$HME" ]; then
+ if [[ -d "$HME" ]]; then
echo "- Warning: '$HME' already exists !"
getyn="$(get_input " Do you wish to change the home directory path ? (Y/n) ")"
- if [ "$(echo $getyn | grep -i "n")" ]; then
+ if [[ "$(echo $getyn | grep -i "n")" ]]; then
unset needinput
# You're most likely going to only do this if you have the dir *mounted* for this user's $HOME
getyn="$(get_input " Do you want to chown $LOGIN.$( echo $GID | awk '{print $2}') $HME ? (y/N) ")"
- if [ "$(echo $getyn | grep -i "y")" ]; then
+ if [[ "$(echo $getyn | grep -i "y")" ]]; then
CHOWNHOMEDIR=$HME # set this to the home directory
fi
fi
unset needinput
fi
done
-HME="-d ${HME}"
-
+HME="-d ${HME}"
+
#: Get the new user's shell :#
echo
needinput=yes
-while [ ! -z "$needinput" ]; do
+while [[ ! -z "$needinput" ]]; do
unset got_error
SHL="$(get_input "Shell [ ${defshell} ]")"
- if [ -z "$SHL" ]; then
+ if [[ -z "$SHL" ]]; then
SHL="${defshell}"
fi
# Warn the user if the shell doesn't exist in /etc/shells or as a file
- if [ -z "$(grep "^${SHL}$" $sfile)" ]; then
+ if [[ -z "$(grep "^${SHL}$" $sfile)" ]]; then
echo "- Warning: ${SHL} is not in ${sfile} (potential problem using FTP)"
got_error=yes
fi
- if [ ! -f "$SHL" ]; then
+ if [[ ! -f "$SHL" ]]; then
echo "- Warning: ${SHL} does not exist as a file"
got_error=yes
fi
- if [ ! -z "$got_error" ]; then
+ if [[ ! -z "$got_error" ]]; then
getyn="$(get_input " Do you wish to change the shell ? (Y/n) ")"
- if [ "$(echo $getyn | grep -i "n")" ]; then
+ if [[ "$(echo $getyn | grep -i "n")" ]]; then
unset needinput
fi
else
#: Get the expiry date :#
echo
needinput=yes
-while [ ! -z "$needinput" ]; do
+while [[ ! -z "$needinput" ]]; do
EXP="$(get_input "Expiry date (YYYY-MM-DD) []:")"
- if [ ! -z "$EXP" ]; then
+ if [[ ! -z "$EXP" ]]; then
# Check to see whether the expiry date is in the valid format
if [ -z "$(echo "$EXP" | grep "^[[:digit:]]\{4\}[-]\?[[:digit:]]\{2\}[-]\?[[:digit:]]\{2\}$")" ]; then
echo "- That is not a valid expiration date"
CMD="$useradd "$HME" -m "$EXP" "$U_ID" "$GID" "$AGID" "$SHL" "$LOGIN""
$CMD
-if [ $? -gt 0 ]; then
+if [[ $? -gt 0 ]]; then
echo "- Error running useradd command -- account not created!"
echo "(cmd: $CMD)"
exit 1
# chown the home dir ? We can only do this once the useradd has
# completed otherwise the user name doesn't exist.
-if [ ! -z "${CHOWNHOMEDIR}" ]; then
+if [[ ! -z "${CHOWNHOMEDIR}" ]]; then
chown "$LOGIN"."$( echo $GID | awk '{print $2}')" "${CHOWNHOMEDIR}"
fi
# Set the finger information
$chfn "$LOGIN"
-if [ $? -gt 0 ]; then
+if [[ $? -gt 0 ]]; then
echo "- Warning: an error occurred while setting finger information"
fi
# Set a password
$passwd "$LOGIN"
-if [ $? -gt 0 ]; then
+if [[ $? -gt 0 ]]; then
echo "* WARNING: An error occured while setting the password for"
echo " this account. Please manually investigate this *"
exit 1
# If it was created (it should have been!), set the permissions for that user's dir
HME="$(echo "$HME" | awk '{print $2}')" # We have to remove the -g prefix
-if [ -d "$HME" ]; then
+if [[ -d "$HME" ]]; then
$chmod $defchmod "$HME"
fi