| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: usergroupfuncs,v 1.3 2007/07/12 19:41:46 jlam Exp $ | | 1 | # $NetBSD: usergroupfuncs,v 1.4 2013/04/03 09:35:19 jperkin Exp $ |
2 | # | | 2 | # |
3 | # Default implementations of user_exists() and group_exists() shell | | 3 | # Default implementations of user_exists() and group_exists() shell |
4 | # functions for checking the existence of users and groups, and of | | 4 | # functions for checking the existence of users and groups, and of |
5 | # adduser() and addgroup() shell functions for adding users and groups. | | 5 | # adduser() and addgroup() shell functions for adding users and groups. |
6 | # Assume there are NetBSD/Solaris-compatible versions of useradd(8) and | | 6 | # Assume there are NetBSD/Solaris-compatible versions of useradd(8) and |
7 | # groupadd(8) available through ${USERADD} and ${GROUPADD}, respectively. | | 7 | # groupadd(8) available through ${USERADD} and ${GROUPADD}, respectively. |
8 | # | | 8 | # |
9 | # Platform-specific replacements for this file should be located at: | | 9 | # Platform-specific replacements for this file should be located at: |
10 | # | | 10 | # |
11 | # pkgsrc/mk/pkginstall/usergroupfuncs.${OPSYS} | | 11 | # pkgsrc/mk/pkginstall/usergroupfuncs.${OPSYS} |
12 | # | | 12 | # |
13 | | | 13 | |
14 | # group_exists group [groupid] | | 14 | # group_exists group [groupid] |
| @@ -118,27 +118,27 @@ adduser() | | | @@ -118,27 +118,27 @@ adduser() |
118 | -c "$descr" -d "$home" -s "$shell" \ | | 118 | -c "$descr" -d "$home" -s "$shell" \ |
119 | -g $group $user | | 119 | -g $group $user |
120 | ;; | | 120 | ;; |
121 | *) | | 121 | *) |
122 | ${USERADD} \ | | 122 | ${USERADD} \ |
123 | -c "$descr" -d "$home" -s "$shell" \ | | 123 | -c "$descr" -d "$home" -s "$shell" \ |
124 | -g $group -u $userid $user | | 124 | -g $group -u $userid $user |
125 | ;; | | 125 | ;; |
126 | esac | | 126 | esac |
127 | fi | | 127 | fi |
128 | return 0 | | 128 | return 0 |
129 | } | | 129 | } |
130 | | | 130 | |
131 | # adduser group [groupid] | | 131 | # addgroup group [groupid] |
132 | addgroup() | | 132 | addgroup() |
133 | { | | 133 | { |
134 | group="$1"; groupid="$2" | | 134 | group="$1"; groupid="$2" |
135 | ${TEST} $# -eq 2 || return 1 | | 135 | ${TEST} $# -eq 2 || return 1 |
136 | ${TEST} -n "$group" || return 2 | | 136 | ${TEST} -n "$group" || return 2 |
137 | | | 137 | |
138 | GROUPADD="@GROUPADD@" | | 138 | GROUPADD="@GROUPADD@" |
139 | | | 139 | |
140 | if ${TEST} -n "${GROUPADD}" -a -x "${GROUPADD}"; then | | 140 | if ${TEST} -n "${GROUPADD}" -a -x "${GROUPADD}"; then |
141 | ${ECHO} "${PKGNAME}: Creating group \`\`$group''" | | 141 | ${ECHO} "${PKGNAME}: Creating group \`\`$group''" |
142 | case $groupid in | | 142 | case $groupid in |
143 | "") ${GROUPADD} $group ;; | | 143 | "") ${GROUPADD} $group ;; |
144 | *) ${GROUPADD} -g $groupid $group ;; | | 144 | *) ${GROUPADD} -g $groupid $group ;; |