summaryrefslogtreecommitdiff
path: root/mk/bsd.pkg.mk
diff options
context:
space:
mode:
Diffstat (limited to 'mk/bsd.pkg.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