pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk Bless FreeBSD with the usergroup functions used by ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/82dcb7aec6dc
branches: trunk
changeset: 502569:82dcb7aec6dc
user: joerg <joerg%pkgsrc.org@localhost>
date: Sun Nov 06 19:45:08 2005 +0000
description:
Bless FreeBSD with the usergroup functions used by DragonFly.
diffstat:
mk/install/usergroupfuncs.FreeBSD | 58 +++++++++++++++++++++++++++++++++++++++
mk/platform/FreeBSD.mk | 3 +-
2 files changed, 60 insertions(+), 1 deletions(-)
diffs (79 lines):
diff -r 23f1ddeb2bed -r 82dcb7aec6dc mk/install/usergroupfuncs.FreeBSD
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/install/usergroupfuncs.FreeBSD Sun Nov 06 19:45:08 2005 +0000
@@ -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 -r 23f1ddeb2bed -r 82dcb7aec6dc mk/platform/FreeBSD.mk
--- a/mk/platform/FreeBSD.mk Sun Nov 06 19:39:49 2005 +0000
+++ b/mk/platform/FreeBSD.mk Sun Nov 06 19:45:08 2005 +0000
@@ -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 @@
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