Magellan Linux

Diff of /branches/mage-next/src/helper/museradd.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/mage/usr/lib/mage/museradd revision 1951 by niro, Fri Oct 12 12:56:07 2012 UTC branches/mage-next/src/helper/museradd.in revision 2722 by niro, Tue Jul 22 14:19:44 2014 UTC
# Line 1  Line 1 
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
# Line 31  busybox_fix_user_opts() Line 31  busybox_fix_user_opts()
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
# Line 55  busybox_fix_group_opts() Line 57  busybox_fix_group_opts()
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} "
# Line 115  else Line 134  else
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

Legend:
Removed from v.1951  
changed lines
  Added in v.2722