diff options
author | joerg <joerg> | 2005-11-06 19:45:08 +0000 |
---|---|---|
committer | joerg <joerg> | 2005-11-06 19:45:08 +0000 |
commit | 327a3cc9b1630cf142299fdf50425d819a97f7b8 (patch) | |
tree | 34b33a8efdc672122d037f7905b05ff56f46f6db /mk | |
parent | c1a693dc90087b77e2471d724b10170a19597eaf (diff) | |
download | pkgsrc-327a3cc9b1630cf142299fdf50425d819a97f7b8.tar.gz |
Bless FreeBSD with the usergroup functions used by DragonFly.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/install/usergroupfuncs.FreeBSD | 58 | ||||
-rw-r--r-- | mk/platform/FreeBSD.mk | 3 |
2 files changed, 60 insertions, 1 deletions
diff --git a/mk/install/usergroupfuncs.FreeBSD b/mk/install/usergroupfuncs.FreeBSD new file mode 100644 index 00000000000..e5b0ee0e465 --- /dev/null +++ b/mk/install/usergroupfuncs.FreeBSD @@ -0,0 +1,58 @@ +# $NetBSD: usergroupfuncs.FreeBSD,v 1.1 2005/11/06 19:45:08 joerg Exp $ +# +# Platform-specific adduser and addgroup functionality +# on top of pw(8). + +# adduser user group [userid] [descr] [home] [shell] +adduser() +{ + user="$1"; group="$2"; userid="$3" + descr="$4"; home="$5" shell="$6" + ${TEST} $# -eq 6 || return 1 + ${TEST} -n "$user" || return 2 + ${TEST} -n "$group" || return 2 + + PW="@PW@" + + : ${descr:="${PKGNAME%-[0-9]*} $user user"} + : ${home:="@PKG_USER_HOME@"} + : ${shell:="@PKG_USER_SHELL@"} + + if ${TEST} -n "${PW}" -a -x "${PW}"; then + ${ECHO} "Creating user: $user" + case $userid in + "") + ${PW} useradd \ + $user \ + -c "$descr" -d "$home" -s "$shell" \ + -g $group + ;; + *) + ${PW} useradd \ + $user \ + -c "$descr" -d "$home" -s "$shell" \ + -g $group -u $userid + ;; + esac + fi + return 0 +} + +# adduser group [groupid] +addgroup() +{ + group="$1"; groupid="$2" + ${TEST} $# -eq 2 || return 1 + ${TEST} -n "$group" || return 2 + + PW="@PW@" + + if ${TEST} -n "${PW}" -a -x "${PW}"; then + ${ECHO} "Creating group: $group"; + case $groupid in + "") ${PW} groupadd $group ;; + *) ${PW} groupadd $group -g $groupid ;; + esac + fi + return 0 +} diff --git a/mk/platform/FreeBSD.mk b/mk/platform/FreeBSD.mk index 5cc2796d321..640f6f94e64 100644 --- a/mk/platform/FreeBSD.mk +++ b/mk/platform/FreeBSD.mk @@ -1,4 +1,4 @@ -# $NetBSD: FreeBSD.mk,v 1.13 2005/08/02 00:23:31 reed Exp $ +# $NetBSD: FreeBSD.mk,v 1.14 2005/11/06 19:45:08 joerg Exp $ # # Variable definitions for the FreeBSD operating system. @@ -7,6 +7,7 @@ IMAKE_MAKE?= ${MAKE} # program which gets invoked by imake IMAKEOPTS+= -DBuildHtmlManPages=NO PKGLOCALEDIR?= share PS?= /bin/ps +PW?= /usr/sbin/pw RSH?= /usr/bin/rsh SU?= /usr/bin/su TYPE?= type # Shell builtin |