--- trunk/mage/usr/lib/mage/museradd 2013/07/15 08:04:58 2141 +++ trunk/mage/usr/lib/mage/museradd 2013/07/15 08:13:49 2142 @@ -31,6 +31,7 @@ -G) shift; shift; continue;; # will be parsed through fix_group_opts -u) shift; [[ $1 -lt 100 ]] && FIXED_USER_OPTS+=" -S"; FIXED_USER_OPTS+=" -u $1" ;; -r) FIXED_USER_OPTS+=" -S" ;; + -M) FIXED_USER_OPTS+=" -H" ;; *) FIXED_USER_OPTS+=" $1" ;; esac shift @@ -55,6 +56,23 @@ echo "${FIXED_GROUP_OPTS}" } +fix_usermod_opts() +{ + local i + local FIXED_USERMOD_OPTS + + for i in $* + do + case $1 in + -M) continue ;; # usermod does not support the -M switch + *) FIXED_USERMOD_OPTS+=" $1" ;; + esac + shift + done + + echo "${FIXED_USERMOD_OPTS}" +} + if [[ ! -z ${MROOT} ]] && [[ ${MROOT} != / ]] then chroot="chroot ${MROOT} " @@ -115,6 +133,6 @@ echo -n " Modifing user '${USER_TO_ADD}'" [[ ! -z ${chroot} ]] && echo -n " in MROOT='${MROOT}'" echo " ..." - ${chroot} usermod ${USER_OPTS} "${USER_TO_ADD}" + ${chroot} usermod $(fix_usermod_opts ${USER_OPTS}) "${USER_TO_ADD}" fi fi