pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk Implement usergroupfuncs for DragonFly using pw(8).



details:   https://anonhg.NetBSD.org/pkgsrc/rev/bb0ff9d06b82
branches:  trunk
changeset: 501772:bb0ff9d06b82
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Fri Oct 28 20:09:38 2005 +0000

description:
Implement usergroupfuncs for DragonFly using pw(8).

diffstat:

 mk/install/bsd.pkginstall.mk        |   3 +-
 mk/install/usergroupfuncs.DragonFly |  58 +++++++++++++++++++++++++++++++++++++
 mk/platform/DragonFly.mk            |   3 +-
 3 files changed, 62 insertions(+), 2 deletions(-)

diffs (96 lines):

diff -r fc7cb0ec27a4 -r bb0ff9d06b82 mk/install/bsd.pkginstall.mk
--- a/mk/install/bsd.pkginstall.mk      Fri Oct 28 20:05:46 2005 +0000
+++ b/mk/install/bsd.pkginstall.mk      Fri Oct 28 20:09:38 2005 +0000
@@ -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+=          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 -r fc7cb0ec27a4 -r bb0ff9d06b82 mk/install/usergroupfuncs.DragonFly
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/install/usergroupfuncs.DragonFly       Fri Oct 28 20:09:38 2005 +0000
@@ -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
+}
diff -r fc7cb0ec27a4 -r bb0ff9d06b82 mk/platform/DragonFly.mk
--- a/mk/platform/DragonFly.mk  Fri Oct 28 20:05:46 2005 +0000
+++ b/mk/platform/DragonFly.mk  Fri Oct 28 20:09:38 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: DragonFly.mk,v 1.20 2005/10/27 22:39:58 tv Exp $
+# $NetBSD: DragonFly.mk,v 1.21 2005/10/28 20:09:38 joerg Exp $
 #
 # Variable definitions for the DragonFly operating system.
 
@@ -8,6 +8,7 @@
 IMAKEOPTS+=    -DBuildHtmlManPages=NO
 PKGLOCALEDIR?= share
 PS?=           /bin/ps
+PW?=           /usr/sbin/pw
 RSH?=          /usr/bin/rsh
 SU?=           /usr/bin/su
 TYPE?=         type                            # Shell builtin



Home | Main Index | Thread Index | Old Index