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

Diff of /eclass/eutils.eclass

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

Revision 1.26 Revision 1.27
1# Copyright 1999-2003 Gentoo Technologies, Inc. 1# Copyright 1999-2003 Gentoo Technologies, Inc.
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/eutils.eclass,v 1.26 2003/03/06 20:35:26 azarah Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.27 2003/03/10 08:49:05 vapier Exp $
4# 4#
5# Author: Martin Schlemmer <azarah@gentoo.org> 5# Author: Martin Schlemmer <azarah@gentoo.org>
6# 6#
7# This eclass is for general purpose functions that most ebuilds 7# This eclass is for general purpose functions that most ebuilds
8# have to implement themselves. 8# have to implement themselves.
450# enewuser(username, uid, shell, homedir, groups, extra options) 450# enewuser(username, uid, shell, homedir, groups, extra options)
451# 451#
452# Default values if you do not specify any: 452# Default values if you do not specify any:
453# username: REQUIRED ! 453# username: REQUIRED !
454# uid: next available (see useradd(8)) 454# uid: next available (see useradd(8))
455# note: pass -1 to get default behavior
455# shell: /bin/false 456# shell: /bin/false
456# homedir: /dev/null 457# homedir: /dev/null
457# groups: none 458# groups: none
458# extra: comment of 'added by portage for ${PN}' 459# extra: comment of 'added by portage for ${PN}'
459enewuser() { 460enewuser() {
480 # options to pass to useradd 481 # options to pass to useradd
481 local opts="" 482 local opts=""
482 483
483 # handle uid 484 # handle uid
484 local euid="$1"; shift 485 local euid="$1"; shift
485 if [ ! -z "${euid}" ] ; then 486 if [ ! -z "${euid}" ] && [ "${euid}" != "-1" ] ; then
486 if [ ${euid} -gt 0 ] ; then 487 if [ ${euid} -gt 0 ] ; then
487 opts="${opts} -u ${euid}" 488 opts="${opts} -u ${euid}"
488 else 489 else
489 eerror "Userid given but is not greater than 0 !" 490 eerror "Userid given but is not greater than 0 !"
490 die "${euid} is not a valid UID" 491 die "${euid} is not a valid UID"

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.27

  ViewVC Help
Powered by ViewVC 1.1.20