1 |
#!/bin/bash |
#!/bin/bash |
2 |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/museradd,v 1.4 2005-06-01 15:48:43 niro Exp $ |
# $Id$ |
3 |
|
|
4 |
# include all needed files |
# include all needed files |
5 |
[ -f /etc/mage.rc.global ] && source /etc/mage.rc.global |
[ -f /etc/mage.rc.global ] && source /etc/mage.rc.global |
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 |
|
-l) continue ;; # just ignore this switch, adduser does not support it |
36 |
*) FIXED_USER_OPTS+=" $1" ;; |
*) FIXED_USER_OPTS+=" $1" ;; |
37 |
esac |
esac |
38 |
shift |
shift |
57 |
echo "${FIXED_GROUP_OPTS}" |
echo "${FIXED_GROUP_OPTS}" |
58 |
} |
} |
59 |
|
|
60 |
|
fix_usermod_opts() |
61 |
|
{ |
62 |
|
local i |
63 |
|
local FIXED_USERMOD_OPTS |
64 |
|
|
65 |
|
for i in $* |
66 |
|
do |
67 |
|
case $1 in |
68 |
|
-M) : ;; # usermod does not support the -M switch |
69 |
|
*) FIXED_USERMOD_OPTS+=" $1" ;; |
70 |
|
esac |
71 |
|
shift |
72 |
|
done |
73 |
|
|
74 |
|
echo "${FIXED_USERMOD_OPTS}" |
75 |
|
} |
76 |
|
|
77 |
if [[ ! -z ${MROOT} ]] && [[ ${MROOT} != / ]] |
if [[ ! -z ${MROOT} ]] && [[ ${MROOT} != / ]] |
78 |
then |
then |
79 |
chroot="chroot ${MROOT} " |
chroot="chroot ${MROOT} " |
134 |
echo -n " Modifing user '${USER_TO_ADD}'" |
echo -n " Modifing user '${USER_TO_ADD}'" |
135 |
[[ ! -z ${chroot} ]] && echo -n " in MROOT='${MROOT}'" |
[[ ! -z ${chroot} ]] && echo -n " in MROOT='${MROOT}'" |
136 |
echo " ..." |
echo " ..." |
137 |
${chroot} usermod ${USER_OPTS} "${USER_TO_ADD}" |
${chroot} usermod $(fix_usermod_opts ${USER_OPTS}) "${USER_TO_ADD}" |
138 |
fi |
fi |
139 |
fi |
fi |