summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authortron <tron@pkgsrc.org>1999-04-03 21:03:50 +0000
committertron <tron@pkgsrc.org>1999-04-03 21:03:50 +0000
commitf5ce2acf3c03f8194cb8d9ccaee364181105f291 (patch)
treee8be485f62e5de6c8871aa8cd375ba56a31e069a /mk
parent9be1361bc3bcd1d21a644c490544398116c8e4be (diff)
downloadpkgsrc-f5ce2acf3c03f8194cb8d9ccaee364181105f291.tar.gz
Use "su" automatically for "make deinstall" target, too.
Diffstat (limited to 'mk')
-rw-r--r--mk/bsd.pkg.mk15
1 files changed, 13 insertions, 2 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index ea624e40fcc..1f2f189103d 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.242 1999/04/02 21:14:12 agc Exp $
+# $NetBSD: bsd.pkg.mk,v 1.243 1999/04/03 21:03:50 tron Exp $
#
# This file is in the public domain.
#
@@ -1539,8 +1539,19 @@ reinstall:
# Special target to remove installation
.if !target(deinstall)
-deinstall: uptodate-pkgtools
+deinstall: pkg-su-deinstall
+
+pkg-su-deinstall: uptodate-pkgtools
@${ECHO_MSG} "===> Deinstalling for ${PKGNAME}"
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ if [ `${ID} -u` = 0 ]; then \
+ ${MAKE} ${.MAKEFLAGS} root-deinstall; \
+ else \
+ ${ECHO_MSG} "Becoming root to deinstall ${PKGNAME}.";\
+ ${SU_CMD} "cd ${.CURDIR}; ${MAKE} ${.MAKEFLAGS} root-deinstall"; \
+ fi
+
+root-deinstall:
.ifdef PKG_VERBOSE
${_PKG_SILENT}${_PKG_DEBUG}${PKG_DELETE} -v ${PKGNAME} || ${TRUE}
.else