aboutsummaryrefslogtreecommitdiff
path: root/Mk
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2013-10-30 17:47:48 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2013-10-30 17:47:48 +0000
commitff058e31764c43fe88a9ae1f35378cca35194c64 (patch)
treefa46115894f3d83f8346b1f1f9a6eda7015459e5 /Mk
parent7effb2dc8d409dedd79ecda8510c629e7266d139 (diff)
Notes
Diffstat (limited to 'Mk')
-rw-r--r--Mk/bsd.pkgng.mk21
-rw-r--r--Mk/bsd.port.mk54
2 files changed, 60 insertions, 15 deletions
diff --git a/Mk/bsd.pkgng.mk b/Mk/bsd.pkgng.mk
index a6306a228fdd..5e2785938390 100644
--- a/Mk/bsd.pkgng.mk
+++ b/Mk/bsd.pkgng.mk
@@ -81,11 +81,24 @@ create-manifest:
.endfor
.undef opt
@${ECHO_CMD} "}" >> ${MANIFESTF}
- @[ -f ${PKGINSTALL} ] && ${CP} ${PKGINSTALL} ${METADIR}/+INSTALL; \
- [ -f ${PKGPREINSTALL} ] && ${CP} ${PKGPREINSTALL} ${METADIR}/+PRE_INSTALL; \
- [ -f ${PKGPOSTINSTALL} ] && ${CP} ${PKGPOSTINSTALL} ${METADIR}/+POST_INSTALL; \
+ @[ -f ${PKGINSTALL} ] && ${CAT} ${PKGINSTALL} ${METADIR}/+INSTALL; \
+ ${RM} -f ${METADIR}/+PRE_INSTALL ; \
+ for a in ${PKGPREINSTALL}; do \
+ [ -f $$a ] && ${CAT} $$a >> ${METADIR}/+PRE_INSTALL ; \
+ done ; \
+ ${RM} -f ${METADIR}/+POST_INSTALL ; \
+ for a in ${PKGPOSTINSTALL}; do \
+ [ -f $$a ] && ${CAT} $$a >> ${METADIR}/+POST_INSTALL ; \
+ done ; \
[ -f ${PKGDEINSTALL} ] && ${CP} ${PKGDEINSTALL} ${METADIR}/+DEINSTALL; \
- [ -f ${PKGPREDEINSTALL} ] && ${CP} ${PKGPREDEINSTALL} ${METADIR}/+PRE_DEINSTALL; \
+ ${RM} -f ${METADIR}/+PRE_DEINSTALL ; \
+ for a in ${PKGPREDEINSTALL}; do \
+ [ -f $$a ] && ${CAT} $$a >> ${METADIR}/+PRE_DEINSTALL ; \
+ done ; \
+ ${RM} -f ${METADIR}/+POST_DEINSTALL ; \
+ for a in ${PKGPOSRDEINSTALL}; do \
+ [ -f $$a ] && ${CAT} $$a >> ${METADIR}/+POST_DEINSTALL ; \
+ done ; \
[ -f ${PKGPOSTDEINSTALL} ] && ${CP} ${PKGPOSTDEINSTALL} ${METADIR}/+POST_DEINSTALL; \
[ -f ${PKGUPGRADE} ] && ${CP} ${PKGUPGRADE} ${METADIR}/+UPGRADE; \
[ -f ${PKGPREUPGRADE} ] && ${CP} ${PKGPREUPGRADE} ${METADIR}/+PRE_UPGRADE; \
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 302cf0f4e2f0..8d2337fdbc13 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -4151,6 +4151,12 @@ install-ldconfig-file:
.endif
.if !target(create-users-groups)
+.if defined(GROUPS) || defined(USERS)
+.if defined(WITH_PKGNG)
+_UG_OUTPUT= ${WRKDIR}/users-groups.sh
+PKGPREINSTALL+= ${_UG_OUTPUT}
+.endif
+.endif
create-users-groups:
.if defined(GROUPS) || defined(USERS)
.if defined(GROUPS)
@@ -4159,8 +4165,15 @@ create-users-groups:
@${ECHO_CMD} "** ${_file} doesn't exist. Exiting."; exit 1
.endif
.endfor
+.if defined(WITH_PKGNG)
+ @${RM} -f ${_UG_OUTPUT} || ${TRUE}
+.endif
@${ECHO_MSG} "===> Creating users and/or groups."
+.if defined(WITH_PKGNG)
+ @${ECHO_CMD} "echo \"===> Creating users and/or groups.\"" >> ${_UG_OUTPUT}
+.else
@${ECHO_CMD} "@exec echo \"===> Creating users and/or groups.\"" >> ${TMPPLIST}
+.endif
.for _group in ${GROUPS}
# _bgpd:*:130:
@if ! ${GREP} -h ^${_group}: ${GID_FILES} >/dev/null 2>&1; then \
@@ -4177,9 +4190,15 @@ create-users-groups:
${ECHO_MSG} "Using existing group \`$$group'."; \
fi; \
fi ; \
- ${ECHO_CMD} "@exec if ! ${PW} groupshow $$group >/dev/null 2>&1; then \
- echo \"Creating group '$$group' with gid '$$gid'.\"; \
- ${PW} groupadd $$group -g $$gid; else echo \"Using existing group '$$group'.\"; fi" >> ${TMPPLIST}; \
+ if [ -z "${WITH_PKGNG}" ]; then \
+ ${ECHO_CMD} "@exec if ! ${PW} groupshow $$group >/dev/null 2>&1; then \
+ echo \"Creating group '$$group' with gid '$$gid'.\"; \
+ ${PW} groupadd $$group -g $$gid; else echo \"Using existing group '$$group'.\"; fi" >> ${TMPPLIST}; \
+ else \
+ ${ECHO_CMD} -e "if ! ${PW} groupshow $$group >/dev/null 2>&1; then \n \
+ echo \"Creating group '$$group' with gid '$$gid'.\" \n \
+ ${PW} groupadd $$group -g $$gid; else echo \"Using existing group '$$group'.\"\nfi" >> ${_UG_OUTPUT}; \
+ fi ; \
done
.endfor
.endif
@@ -4209,10 +4228,17 @@ create-users-groups:
${ECHO_MSG} "Using existing user \`$$login'."; \
fi; \
fi; \
- ${ECHO_CMD} "@exec if ! ${PW} usershow $$login >/dev/null 2>&1; then \
- echo \"Creating user '$$login' with uid '$$uid'.\"; \
- ${PW} useradd $$login -u $$uid -g $$gid $$class -c \"$$gecos\" -d $$homedir -s $$shell; \
- else echo \"Using existing user '$$login'.\"; fi" >> ${TMPPLIST}; \
+ if [ -z "${WITH_PKGNG}" ]; then \
+ ${ECHO_CMD} "@exec if ! ${PW} usershow $$login >/dev/null 2>&1; then \
+ echo \"Creating user '$$login' with uid '$$uid'.\"; \
+ ${PW} useradd $$login -u $$uid -g $$gid $$class -c \"$$gecos\" -d $$homedir -s $$shell; \
+ else echo \"Using existing user '$$login'.\"; fi" >> ${TMPPLIST}; \
+ else \
+ ${ECHO_CMD} -e "if ! ${PW} usershow $$login >/dev/null 2>&1; then \n \
+ echo \"Creating user '$$login' with uid '$$uid'.\" \n \
+ ${PW} useradd $$login -u $$uid -g $$gid $$class -c \"$$gecos\" -d $$homedir -s $$shell \n \
+ else \necho \"Using existing user '$$login'.\" \nfi" >> ${_UG_OUTPUT}; \
+ fi ; \
case $$homedir in /nonexistent|/var/empty) ;; *) ${ECHO_CMD} "@exec ${INSTALL} -d -g $$gid -o $$uid $$homedir" >> ${TMPPLIST};; esac; \
done
.endfor
@@ -4228,9 +4254,15 @@ create-users-groups:
${ECHO_MSG} "Adding user \`$${_login}' to group \`${_group}'."; \
${PW} groupmod ${_group} -m $${_login}; \
fi; \
- ${ECHO_CMD} "@exec if ! ${PW} groupshow ${_group} | ${GREP} -qw $${_login}; then \
- echo \"Adding user '$${_login}' to group '${_group}'.\"; \
- ${PW} groupmod ${_group} -m $${_login}; fi" >> ${TMPPLIST}; \
+ if [ -z "${WITH_PKGNG}" ]; then \
+ ${ECHO_CMD} "@exec if ! ${PW} groupshow ${_group} | ${GREP} -qw $${_login}; then \
+ echo \"Adding user '$${_login}' to group '${_group}'.\"; \
+ ${PW} groupmod ${_group} -m $${_login}; fi" >> ${TMPPLIST}; \
+ else \
+ ${ECHO_CMD} "if ! ${PW} groupshow ${_group} | ${GREP} -qw $${_login}; then \n \
+ echo \"Adding user '$${_login}' to group '${_group}'.\" \n \
+ ${PW} groupmod ${_group} -m $${_login} \nfi" >> ${_UG_OUTPUT}; \
+ fi ; \
fi; \
done; \
done; \
@@ -4256,7 +4288,7 @@ create-users-groups:
# and user(s) are the first in pkg-plist
.if !target(fix-plist-sequence)
fix-plist-sequence: ${TMPPLIST}
-.if defined(GROUPS) || defined(USERS)
+.if !defined(WITH_PKGNG) && (defined(GROUPS) || defined(USERS))
@${ECHO_CMD} "===> Correct pkg-plist sequence to create group(s) and user(s)"
@${EGREP} -e '^@exec echo.*Creating users and' -e '^@exec.*${PW}' -e '^@exec ${INSTALL} -d -g' ${TMPPLIST} > ${TMPGUCMD}
@${EGREP} -v -e '^@exec echo.*Creating users and' -e '^@exec.*${PW}' -e '^@exec ${INSTALL} -d -g' ${TMPPLIST} >> ${TMPGUCMD}