aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2013-06-25 20:24:10 +0800
committerbapt <bapt@FreeBSD.org>2013-06-25 20:24:10 +0800
commite06d9440a853bfa7e9b6bc6b81e626f4868ab114 (patch)
treee5440ad6a526eb296063000d16637e87751c474d
parent9939776a0b6c095df0099acd275dc325a2233661 (diff)
downloadfreebsd-ports-gnome-e06d9440a853bfa7e9b6bc6b81e626f4868ab114.tar.gz
freebsd-ports-gnome-e06d9440a853bfa7e9b6bc6b81e626f4868ab114.tar.zst
freebsd-ports-gnome-e06d9440a853bfa7e9b6bc6b81e626f4868ab114.zip
Define UID earlier so that it can be used inside bsd.pkng.mk
Allow make deinstall to prompt for su if run as a user if using pkgng Reported by: jhb, dim Submitted by: jhb
-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}