From c31b6b3011bc6d58fd375a5dd899928a9b475cb7 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Thu, 26 Aug 2010 16:05:02 +0200 Subject: Support %-prefixed office in localadduser. --- localadduser | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'localadduser') 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\"!" -- cgit v1.2.3