/[gentoo-x86]/eclass/user.eclass
Gentoo

Diff of /eclass/user.eclass

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

Revision 1.11 Revision 1.13
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2011 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/user.eclass,v 1.11 2011/11/26 06:42:07 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/user.eclass,v 1.13 2011/11/26 06:50:27 vapier Exp $
4 4
5# @ECLASS: user.eclass 5# @ECLASS: user.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# base-system@gentoo.org (Linux) 7# base-system@gentoo.org (Linux)
8# Joe Jezak <josejx@gmail.com> (OS X) 8# Joe Jezak <josejx@gmail.com> (OS X)
153 if [[ ${eshell} == */false || ${eshell} == */nologin ]] ; then 153 if [[ ${eshell} == */false || ${eshell} == */nologin ]] ; then
154 eerror "Do not specify ${eshell} yourself, use -1" 154 eerror "Do not specify ${eshell} yourself, use -1"
155 die "Pass '-1' as the shell parameter" 155 die "Pass '-1' as the shell parameter"
156 fi 156 fi
157 else 157 else
158 for shell in /sbin/nologin /usr/sbin/nologin /bin/false /usr/bin/false /dev/null ; do 158 for eshell in /sbin/nologin /usr/sbin/nologin /bin/false /usr/bin/false /dev/null ; do
159 [[ -x ${ROOT}${shell} ]] && break 159 [[ -x ${ROOT}${eshell} ]] && break
160 done 160 done
161 161
162 if [[ ${shell} == "/dev/null" ]] ; then 162 if [[ ${eshell} == "/dev/null" ]] ; then
163 eerror "Unable to identify the shell to use, proceeding with userland default." 163 eerror "Unable to identify the shell to use, proceeding with userland default."
164 case ${USERLAND} in 164 case ${USERLAND} in
165 GNU) shell="/bin/false" ;; 165 GNU) eshell="/bin/false" ;;
166 BSD) shell="/sbin/nologin" ;; 166 BSD) eshell="/sbin/nologin" ;;
167 Darwin) shell="/usr/sbin/nologin" ;; 167 Darwin) eshell="/usr/sbin/nologin" ;;
168 *) die "Unable to identify the default shell for userland ${USERLAND}" 168 *) die "Unable to identify the default shell for userland ${USERLAND}"
169 esac 169 esac
170 fi 170 fi
171
172 eshell=${shell}
173 fi 171 fi
174 einfo " - Shell: ${eshell}" 172 einfo " - Shell: ${eshell}"
175 opts+=" -s ${eshell}" 173 opts+=" -s ${eshell}"
176 174
177 # handle homedir 175 # handle homedir
220 set -- -c "added by portage for ${PN}" 218 set -- -c "added by portage for ${PN}"
221 einfo " - Extra: $@" 219 einfo " - Extra: $@"
222 fi 220 fi
223 221
224 # add the user 222 # add the user
225 local oldsandbox=${SANDBOX_ON}
226 export SANDBOX_ON="0"
227 case ${CHOST} in 223 case ${CHOST} in
228 *-darwin*) 224 *-darwin*)
229 ### Make the user 225 ### Make the user
230 dscl . create /users/${euser} uid ${euid} 226 dscl . create /users/${euser} uid ${euid}
231 dscl . create /users/${euser} shell ${eshell} 227 dscl . create /users/${euser} shell ${eshell}
263 einfo " - Creating ${ehome} in ${ROOT}" 259 einfo " - Creating ${ehome} in ${ROOT}"
264 mkdir -p "${ROOT}/${ehome}" 260 mkdir -p "${ROOT}/${ehome}"
265 chown ${euser} "${ROOT}/${ehome}" 261 chown ${euser} "${ROOT}/${ehome}"
266 chmod 755 "${ROOT}/${ehome}" 262 chmod 755 "${ROOT}/${ehome}"
267 fi 263 fi
268
269 export SANDBOX_ON=${oldsandbox}
270} 264}
271 265
272# @FUNCTION: enewgroup 266# @FUNCTION: enewgroup
273# @USAGE: <group> [gid] 267# @USAGE: <group> [gid]
274# @DESCRIPTION: 268# @DESCRIPTION:
325 if [ $# -gt 0 ] ; then 319 if [ $# -gt 0 ] ; then
326 die "extra arguments no longer supported; please file a bug" 320 die "extra arguments no longer supported; please file a bug"
327 fi 321 fi
328 322
329 # add the group 323 # add the group
330 local oldsandbox="${SANDBOX_ON}"
331 export SANDBOX_ON="0"
332 case ${CHOST} in 324 case ${CHOST} in
333 *-darwin*) 325 *-darwin*)
334 # If we need the next available 326 # If we need the next available
335 case ${egid} in 327 case ${egid} in
336 *[!0-9]*) # Non numeric 328 *[!0-9]*) # Non numeric
365 *) 357 *)
366 # We specify -r so that we get a GID in the system range from login.defs 358 # We specify -r so that we get a GID in the system range from login.defs
367 groupadd -r ${opts} ${egroup} || die 359 groupadd -r ${opts} ${egroup} || die
368 ;; 360 ;;
369 esac 361 esac
370 export SANDBOX_ON="${oldsandbox}"
371} 362}
372 363
373# @FUNCTION: egethome 364# @FUNCTION: egethome
374# @USAGE: <user> 365# @USAGE: <user>
375# @DESCRIPTION: 366# @DESCRIPTION:

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.13

  ViewVC Help
Powered by ViewVC 1.1.20