ports/57378: Use SU_CMD for deinstall and deinstall-all targets
Max Khon
fjoe at FreeBSD.org
Mon Sep 29 23:30:25 UTC 2003
>Number: 57378
>Category: ports
>Synopsis: Use SU_CMD for deinstall and deinstall-all targets
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Mon Sep 29 16:30:22 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator: Max Khon
>Release: FreeBSD 4.9-PRERELEASE i386
>Organization:
>Environment:
>Description:
This patch allows to use SU_CMD in deinstall and deinstall-all targets.
>How-To-Repeat:
>Fix:
Index: bsd.port.mk
===================================================================
RCS file: /home/pcvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.468
diff -u -p -r1.468 bsd.port.mk
--- bsd.port.mk 3 Sep 2003 19:50:24 -0000 1.468
+++ bsd.port.mk 29 Sep 2003 15:49:14 -0000
@@ -3504,6 +3504,12 @@ reinstall:
.if !target(deinstall)
deinstall:
+.if ${UID} != 0
+ @echo "===> Switching to root credentials for '${.TARGET}' target"
+ @cd ${.CURDIR} && \
+ ${SU_CMD} "${MAKE} ${__softMAKEFLAGS} ${.TARGET}"
+ @echo "===> Returning to user credentials"
+.else
@${ECHO_MSG} "===> Deinstalling for ${PKGORIGIN}"
@found_names=`${PKG_INFO} -q -O ${PKGORIGIN} 2> /dev/null`; \
for p in $${found_names}; do \
@@ -3523,6 +3529,7 @@ deinstall:
fi
@${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
.endif
+.endif
# Deinstall-all
#
@@ -3530,6 +3537,12 @@ deinstall:
.if !target(deinstall-all)
deinstall-all:
+.if ${UID} != 0
+ @echo "===> Switching to root credentials for '${.TARGET}' target"
+ @cd ${.CURDIR} && \
+ ${SU_CMD} "${MAKE} ${__softMAKEFLAGS} ${.TARGET}"
+ @echo "===> Returning to user credentials"
+.else
@${ECHO_MSG} "===> Deinstalling for ${PKGORIGIN}"
@deinstall_names=`${PKG_INFO} -q -O ${PKGORIGIN} 2> /dev/null`; \
if [ -n "$${deinstall_names}" ]; then \
@@ -3541,6 +3554,7 @@ deinstall-all:
${ECHO_MSG} "===> ${PKGORIGIN} not installed, skipping"; \
fi
@${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
+.endif
.endif
# Cleaning up
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list