aboutsummaryrefslogtreecommitdiff
path: root/Mk
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2013-06-25 12:24:10 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2013-06-25 12:24:10 +0000
commit4b653b49e1abf572842e05fcf9c12d44a39e1858 (patch)
treee5440ad6a526eb296063000d16637e87751c474d /Mk
parentd8b6513e944fabb5f1e02937a05e849ef2319fd3 (diff)
Notes
Diffstat (limited to 'Mk')
-rw-r--r--Mk/bsd.pkgng.mk7
-rw-r--r--Mk/bsd.port.mk7
2 files changed, 11 insertions, 3 deletions
diff --git a/Mk/bsd.pkgng.mk b/Mk/bsd.pkgng.mk
index 51001c8138e1..79148791edb3 100644
--- a/Mk/bsd.pkgng.mk
+++ b/Mk/bsd.pkgng.mk
@@ -262,6 +262,12 @@ check-already-installed:
.if !target(deinstall)
deinstall:
+.if ${UID} != 0 && !defined(INSTALL_AS_USER)
+ @${ECHO_MSG} "===> Switching to root credentials for '${.TARGET}' target"
+ @cd ${.CURDIR} && \
+ ${SU_CMD} "${MAKE} ${.TARGET}"
+ @${ECHO_MSG} "===> Returning to user credentials"
+.else
@${ECHO_MSG} "===> Deinstalling for ${PKGORIGIN}"
@if ${PKG_INFO} -e ${PKGORIGIN}; then \
p=`${PKG_INFO} -q ${PKGORIGIN}`; \
@@ -272,5 +278,6 @@ deinstall:
fi
@${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
.endif
+.endif
.endif # defined(_POSTMKINCLUDED)
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 0535896ef1c0..252c9faea92a 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -1628,6 +1628,10 @@ PATCH_DEPENDS+= ${LOCALBASE}/bin/unzip:${PORTSDIR}/archivers/unzip
.endif
.endif
+.if !defined(UID)
+UID!= ${ID} -u
+.endif
+
# Check the compatibility layer for amd64/ia64
.if ${ARCH} == "amd64" || ${ARCH} =="ia64"
@@ -2308,9 +2312,6 @@ MTREE_ARGS?= -U ${MTREE_FOLLOWS_SYMLINKS} -f ${MTREE_FILE} -d -e -p
READLINK_CMD?= /usr/bin/readlink
# Determine whether or not we can use rootly owner/group functions.
-.if !defined(UID)
-UID!= ${ID} -u
-.endif
.if ${UID} == 0
_BINOWNGRP= -o ${BINOWN} -g ${BINGRP}
_SHROWNGRP= -o ${SHAREOWN} -g ${SHAREGRP}