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

Diff of /eclass/user.eclass

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

Revision 1.9 Revision 1.12
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.9 2011/11/03 15:29:39 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/user.eclass,v 1.12 2011/11/26 06:45:38 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)
16# @FUNCTION: _assert_pkg_ebuild_phase 16# @FUNCTION: _assert_pkg_ebuild_phase
17# @INTERNAL 17# @INTERNAL
18# @USAGE: <calling func name> 18# @USAGE: <calling func name>
19_assert_pkg_ebuild_phase() { 19_assert_pkg_ebuild_phase() {
20 case ${EBUILD_PHASE} in 20 case ${EBUILD_PHASE} in
21 unpack|prepare|configure|compile|test|install) 21 setup|preinst|postinst) ;;
22 *)
22 eerror "'$1()' called from '${EBUILD_PHASE}()' which is not a pkg_* function." 23 eerror "'$1()' called from '${EBUILD_PHASE}()' which is not a pkg_* function."
23 eerror "Package fails at QA and at life. Please file a bug." 24 eerror "Package fails at QA and at life. Please file a bug."
24 die "Bad package! $1 is only for use in pkg_* functions!" 25 die "Bad package! $1 is only for use in pkg_* functions!"
25 esac 26 esac
26} 27}
76 esac 77 esac
77 78
78 # lookup by uid/gid 79 # lookup by uid/gid
79 local opts 80 local opts
80 if [[ ${key} == [[:digit:]]* ]] ; then 81 if [[ ${key} == [[:digit:]]* ]] ; then
81 [[ ${action} == "user" ]] && opts="-u" || opts="-g" 82 [[ ${db} == "user" ]] && opts="-u" || opts="-g"
82 fi 83 fi
83 84
84 pw show ${action} ${opts} "${key}" -q 85 pw show ${db} ${opts} "${key}" -q
85 ;; 86 ;;
86 *-netbsd*|*-openbsd*) 87 *-netbsd*|*-openbsd*)
87 grep "${key}:\*:" /etc/${db} 88 grep "${key}:\*:" /etc/${db}
88 ;; 89 ;;
89 *) 90 *)
219 set -- -c "added by portage for ${PN}" 220 set -- -c "added by portage for ${PN}"
220 einfo " - Extra: $@" 221 einfo " - Extra: $@"
221 fi 222 fi
222 223
223 # add the user 224 # add the user
224 local oldsandbox=${SANDBOX_ON}
225 export SANDBOX_ON="0"
226 case ${CHOST} in 225 case ${CHOST} in
227 *-darwin*) 226 *-darwin*)
228 ### Make the user 227 ### Make the user
229 dscl . create /users/${euser} uid ${euid} 228 dscl . create /users/${euser} uid ${euid}
230 dscl . create /users/${euser} shell ${eshell} 229 dscl . create /users/${euser} shell ${eshell}
262 einfo " - Creating ${ehome} in ${ROOT}" 261 einfo " - Creating ${ehome} in ${ROOT}"
263 mkdir -p "${ROOT}/${ehome}" 262 mkdir -p "${ROOT}/${ehome}"
264 chown ${euser} "${ROOT}/${ehome}" 263 chown ${euser} "${ROOT}/${ehome}"
265 chmod 755 "${ROOT}/${ehome}" 264 chmod 755 "${ROOT}/${ehome}"
266 fi 265 fi
267
268 export SANDBOX_ON=${oldsandbox}
269} 266}
270 267
271# @FUNCTION: enewgroup 268# @FUNCTION: enewgroup
272# @USAGE: <group> [gid] 269# @USAGE: <group> [gid]
273# @DESCRIPTION: 270# @DESCRIPTION:
324 if [ $# -gt 0 ] ; then 321 if [ $# -gt 0 ] ; then
325 die "extra arguments no longer supported; please file a bug" 322 die "extra arguments no longer supported; please file a bug"
326 fi 323 fi
327 324
328 # add the group 325 # add the group
329 local oldsandbox="${SANDBOX_ON}"
330 export SANDBOX_ON="0"
331 case ${CHOST} in 326 case ${CHOST} in
332 *-darwin*) 327 *-darwin*)
333 # If we need the next available 328 # If we need the next available
334 case ${egid} in 329 case ${egid} in
335 *[!0-9]*) # Non numeric 330 *[!0-9]*) # Non numeric
364 *) 359 *)
365 # We specify -r so that we get a GID in the system range from login.defs 360 # We specify -r so that we get a GID in the system range from login.defs
366 groupadd -r ${opts} ${egroup} || die 361 groupadd -r ${opts} ${egroup} || die
367 ;; 362 ;;
368 esac 363 esac
369 export SANDBOX_ON="${oldsandbox}"
370} 364}
371 365
372# @FUNCTION: egethome 366# @FUNCTION: egethome
373# @USAGE: <user> 367# @USAGE: <user>
374# @DESCRIPTION: 368# @DESCRIPTION:

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.20