diff options
author | joerg <joerg> | 2005-10-28 20:09:38 +0000 |
---|---|---|
committer | joerg <joerg> | 2005-10-28 20:09:38 +0000 |
commit | b9763a485879b9a0536ab0e0ff105dfeac28555e (patch) | |
tree | 5479ae2f3f1e42353258c13c7eda71171ca72e24 /mk/install | |
parent | a07fadf95b1c55e30260d5938a141a8c2b79911d (diff) | |
download | pkgsrc-b9763a485879b9a0536ab0e0ff105dfeac28555e.tar.gz |
Implement usergroupfuncs for DragonFly using pw(8).
Diffstat (limited to 'mk/install')
-rw-r--r-- | mk/install/bsd.pkginstall.mk | 3 | ||||
-rw-r--r-- | mk/install/usergroupfuncs.DragonFly | 58 |
2 files changed, 60 insertions, 1 deletions
diff --git a/mk/install/bsd.pkginstall.mk b/mk/install/bsd.pkginstall.mk index 02ac0d0e26d..c479f796077 100644 --- a/mk/install/bsd.pkginstall.mk +++ b/mk/install/bsd.pkginstall.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkginstall.mk,v 1.28 2005/09/30 16:39:26 jlam Exp $ +# $NetBSD: bsd.pkginstall.mk,v 1.29 2005/10/28 20:09:38 joerg Exp $ # # This Makefile fragment is included by bsd.pkg.mk to use the common # INSTALL/DEINSTALL scripts. To use this Makefile fragment, simply: @@ -602,6 +602,7 @@ FILES_SUBST+= MV=${MV:Q} FILES_SUBST+= PERL5=${PERL5:Q} FILES_SUBST+= PKG_ADMIN=${PKG_ADMIN_CMD:Q} FILES_SUBST+= PKG_INFO=${PKG_INFO_CMD:Q} +FILES_SUBST+= PW=${PW:Q} FILES_SUBST+= PWD_CMD=${PWD_CMD:Q} FILES_SUBST+= RM=${RM:Q} FILES_SUBST+= RMDIR=${RMDIR:Q} diff --git a/mk/install/usergroupfuncs.DragonFly b/mk/install/usergroupfuncs.DragonFly new file mode 100644 index 00000000000..193be31b42b --- /dev/null +++ b/mk/install/usergroupfuncs.DragonFly @@ -0,0 +1,58 @@ +# $NetBSD: usergroupfuncs.DragonFly,v 1.1 2005/10/28 20:09:38 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 +} |