31 |
-G) shift; shift; continue;; # will be parsed through fix_group_opts |
-G) shift; shift; continue;; # will be parsed through fix_group_opts |
32 |
-u) shift; [[ $1 -lt 100 ]] && FIXED_USER_OPTS+=" -S"; FIXED_USER_OPTS+=" -u $1" ;; |
-u) shift; [[ $1 -lt 100 ]] && FIXED_USER_OPTS+=" -S"; FIXED_USER_OPTS+=" -u $1" ;; |
33 |
-r) FIXED_USER_OPTS+=" -S" ;; |
-r) FIXED_USER_OPTS+=" -S" ;; |
34 |
|
-M) FIXED_USER_OPTS+=" -H" ;; |
35 |
*) FIXED_USER_OPTS+=" $1" ;; |
*) FIXED_USER_OPTS+=" $1" ;; |
36 |
esac |
esac |
37 |
shift |
shift |
56 |
echo "${FIXED_GROUP_OPTS}" |
echo "${FIXED_GROUP_OPTS}" |
57 |
} |
} |
58 |
|
|
59 |
|
fix_usermod_opts() |
60 |
|
{ |
61 |
|
local i |
62 |
|
local FIXED_USERMOD_OPTS |
63 |
|
|
64 |
|
for i in $* |
65 |
|
do |
66 |
|
case $1 in |
67 |
|
-M) continue ;; # usermod does not support the -M switch |
68 |
|
*) FIXED_USERMOD_OPTS+=" $1" ;; |
69 |
|
esac |
70 |
|
shift |
71 |
|
done |
72 |
|
|
73 |
|
echo "${FIXED_USERMOD_OPTS}" |
74 |
|
} |
75 |
|
|
76 |
if [[ ! -z ${MROOT} ]] && [[ ${MROOT} != / ]] |
if [[ ! -z ${MROOT} ]] && [[ ${MROOT} != / ]] |
77 |
then |
then |
78 |
chroot="chroot ${MROOT} " |
chroot="chroot ${MROOT} " |
133 |
echo -n " Modifing user '${USER_TO_ADD}'" |
echo -n " Modifing user '${USER_TO_ADD}'" |
134 |
[[ ! -z ${chroot} ]] && echo -n " in MROOT='${MROOT}'" |
[[ ! -z ${chroot} ]] && echo -n " in MROOT='${MROOT}'" |
135 |
echo " ..." |
echo " ..." |
136 |
${chroot} usermod ${USER_OPTS} "${USER_TO_ADD}" |
${chroot} usermod $(fix_usermod_opts ${USER_OPTS}) "${USER_TO_ADD}" |
137 |
fi |
fi |
138 |
fi |
fi |