summaryrefslogtreecommitdiff
path: root/localadduser
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2010-08-26 16:05:02 +0200
committerJonas Smedegaard <dr@jones.dk>2010-08-26 16:05:02 +0200
commitc31b6b3011bc6d58fd375a5dd899928a9b475cb7 (patch)
treede34af6b7ab115ef6949f8ebaa832ebcc20ced85 /localadduser
parent93b26f5fa645c97cac6935aea09513b1c32f6e3f (diff)
Support %-prefixed office in localadduser.
Diffstat (limited to 'localadduser')
-rwxr-xr-xlocaladduser11
1 files changed, 9 insertions, 2 deletions
diff --git a/localadduser b/localadduser
index 398e080..e3cd3a1 100755
--- a/localadduser
+++ b/localadduser
@@ -37,6 +37,9 @@ for chunk in $@; do
@*)
groupchunks="${groupchunks:+$groupchunks }$chunk"
;;
+ %*)
+ officechunks="${officechunks:+$officechunks }$chunk"
+ ;;
*@*)
other="${other:+$other }$chunk"
;;
@@ -80,11 +83,15 @@ for groupchunk in $groupchunks; do
groups="${groups:+$groups }$group"
done
+for officechunk in $officechunks; do
+ office="${office:+$office }$(echo "$officechunk" | perl -pe 's/^%//;')"
+done
+
if [ ! "$interactive" -gt 0 ]; then
quiet="--quiet"
fi
-if [ -n "$fullname$office_phone$home_phone$other" ]; then
- eval $simulate sudo "/usr/sbin/adduser $quiet --disabled-login --gecos \"$fullname,,$office_phone,$home_phone,$other\" \"$u\""
+if [ -n "$fullname$office$office_phone$home_phone$other" ]; then
+ eval $simulate sudo "/usr/sbin/adduser $quiet --disabled-login --gecos \"$fullname,$office,$office_phone,$home_phone,$other\" \"$u\""
else
if [ ! "$interactive" -gt 0 ]; then
exit1 "Not enough info provided to create account for \"$u\"!"