summaryrefslogtreecommitdiff
path: root/mk/install
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2006-04-24 15:44:32 +0000
committerjlam <jlam@pkgsrc.org>2006-04-24 15:44:32 +0000
commitec33004d299d8236e2aebaa2b845bec68e33fe04 (patch)
tree4f8ca4d3c6107a242df6063cef51b3902e9a4991 /mk/install
parent10da79a1a13a0d71f65371634deefa327a793b59 (diff)
downloadpkgsrc-ec33004d299d8236e2aebaa2b845bec68e33fe04.tar.gz
Fix {group,user}_exists functions when the numeric ID is not set. Fix
provided in PR pkg/33346 by Yoshito Komatsu.
Diffstat (limited to 'mk/install')
-rw-r--r--mk/install/usergroupfuncs12
-rw-r--r--mk/install/usergroupfuncs.DragonFly12
-rw-r--r--mk/install/usergroupfuncs.FreeBSD12
3 files changed, 27 insertions, 9 deletions
diff --git a/mk/install/usergroupfuncs b/mk/install/usergroupfuncs
index bbea62ff70c..8f9bbfa9612 100644
--- a/mk/install/usergroupfuncs
+++ b/mk/install/usergroupfuncs
@@ -1,4 +1,4 @@
-# $NetBSD: usergroupfuncs,v 1.4 2006/04/23 00:00:44 jlam Exp $
+# $NetBSD: usergroupfuncs,v 1.5 2006/04/24 15:44:32 jlam Exp $
#
# Default implementations of user_exists() and group_exists() shell
# functions for checking the existence of users and groups, and of
@@ -11,7 +11,7 @@
# pkgsrc/mk/install/usergroupfuncs.${OPSYS}
#
-# group_exists group groupid
+# group_exists group [groupid]
# Returns 0 if $group exists and has gid $groupid
# Returns 1 if neither $group nor $groupid exist
# Returns 2 if $group or $groupid exist but don't match
@@ -33,6 +33,9 @@ group_exists()
${RM} -f $_testfile; return 0
fi
${RM} -f $_testfile; return 2
+ elif ${TEST} -z "$_groupid"; then
+ # $_group doesn't exist and $_group is not set
+ return 1
elif ${CHGRP} $_groupid $_testfile >/dev/null 2>&1; then
_name=`${LS} -l $_testfile 2>/dev/null | ${AWK} '{ print $4 }'`
if ${TEST} "$_name" != "$_groupid"; then
@@ -45,7 +48,7 @@ group_exists()
${RM} -f $_testfile; return 3
}
-# user_exists user userid
+# user_exists user [userid]
# Returns 0 if $user exists and has uid $userid
# Returns 1 if neither $user nor $userid exist
# Returns 2 if $user or $userid exist but don't match
@@ -67,6 +70,9 @@ user_exists()
${RM} -f $_testfile; return 0
fi
${RM} -f $_testfile; return 2
+ elif ${TEST} -z "$_userid"; then
+ # $_user doesn't exist and $_userid is not set
+ return 1
elif ${CHOWN} $_userid $_testfile >/dev/null 2>&1; then
_name=`${LS} -l $_testfile 2>/dev/null | ${AWK} '{ print $3 }'`
if ${TEST} "$_name" != "$_userid"; then
diff --git a/mk/install/usergroupfuncs.DragonFly b/mk/install/usergroupfuncs.DragonFly
index 91da004c73f..43e9ffaa87b 100644
--- a/mk/install/usergroupfuncs.DragonFly
+++ b/mk/install/usergroupfuncs.DragonFly
@@ -1,9 +1,9 @@
-# $NetBSD: usergroupfuncs.DragonFly,v 1.2 2006/04/23 00:00:44 jlam Exp $
+# $NetBSD: usergroupfuncs.DragonFly,v 1.3 2006/04/24 15:44:32 jlam Exp $
#
# Platform-specific adduser and addgroup functionality
# on top of pw(8).
-# group_exists group groupid
+# group_exists group [groupid]
# Returns 0 if $group exists and has gid $groupid
# Returns 1 if neither $group nor $groupid exist
# Returns 2 if $group or $groupid exist but don't match
@@ -25,6 +25,9 @@ group_exists()
${RM} -f $_testfile; return 0
fi
${RM} -f $_testfile; return 2
+ elif ${TEST} -z "$_groupid"; then
+ # $_group doesn't exist and $_group is not set
+ return 1
elif ${CHGRP} $_groupid $_testfile >/dev/null 2>&1; then
_name=`${LS} -l $_testfile 2>/dev/null | ${AWK} '{ print $4 }'`
if ${TEST} "$_name" != "$_groupid"; then
@@ -37,7 +40,7 @@ group_exists()
${RM} -f $_testfile; return 3
}
-# user_exists user userid
+# user_exists user [userid]
# Returns 0 if $user exists and has uid $userid
# Returns 1 if neither $user nor $userid exist
# Returns 2 if $user or $userid exist but don't match
@@ -59,6 +62,9 @@ user_exists()
${RM} -f $_testfile; return 0
fi
${RM} -f $_testfile; return 2
+ elif ${TEST} -z "$_userid"; then
+ # $_user doesn't exist and $_user is not set
+ return 1
elif ${CHOWN} $_userid $_testfile >/dev/null 2>&1; then
_name=`${LS} -l $_testfile 2>/dev/null | ${AWK} '{ print $3 }'`
if ${TEST} "$_name" != "$_userid"; then
diff --git a/mk/install/usergroupfuncs.FreeBSD b/mk/install/usergroupfuncs.FreeBSD
index 069339008de..560e192c41f 100644
--- a/mk/install/usergroupfuncs.FreeBSD
+++ b/mk/install/usergroupfuncs.FreeBSD
@@ -1,9 +1,9 @@
-# $NetBSD: usergroupfuncs.FreeBSD,v 1.2 2006/04/23 00:00:44 jlam Exp $
+# $NetBSD: usergroupfuncs.FreeBSD,v 1.3 2006/04/24 15:44:32 jlam Exp $
#
# Platform-specific adduser and addgroup functionality
# on top of pw(8).
-# group_exists group groupid
+# group_exists group [groupid]
# Returns 0 if $group exists and has gid $groupid
# Returns 1 if neither $group nor $groupid exist
# Returns 2 if $group or $groupid exist but don't match
@@ -25,6 +25,9 @@ group_exists()
${RM} -f $_testfile; return 0
fi
${RM} -f $_testfile; return 2
+ elif ${TEST} -z "$_groupid"; then
+ # $_group doesn't exist and $_group is not set
+ return 1
elif ${CHGRP} $_groupid $_testfile >/dev/null 2>&1; then
_name=`${LS} -l $_testfile 2>/dev/null | ${AWK} '{ print $4 }'`
if ${TEST} "$_name" != "$_groupid"; then
@@ -37,7 +40,7 @@ group_exists()
${RM} -f $_testfile; return 3
}
-# user_exists user userid
+# user_exists user [userid]
# Returns 0 if $user exists and has uid $userid
# Returns 1 if neither $user nor $userid exist
# Returns 2 if $user or $userid exist but don't match
@@ -59,6 +62,9 @@ user_exists()
${RM} -f $_testfile; return 0
fi
${RM} -f $_testfile; return 2
+ elif ${TEST} -z "$_userid"; then
+ # $_user doesn't exist and $_user is not set
+ return 1
elif ${CHOWN} $_userid $_testfile >/dev/null 2>&1; then
_name=`${LS} -l $_testfile 2>/dev/null | ${AWK} '{ print $3 }'`
if ${TEST} "$_name" != "$_userid"; then