From c912ce0eef781e884bb6a24eac9376bcb37f05b7 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 16 Jun 2011 12:21:12 +0200 Subject: [PATCH] xbps-src: remove a pkg thru the chroot handler to fix some bugs in pre/post_remove funcs. --- xbps-src/shutils/chroot.sh.in | 2 +- xbps-src/shutils/stow_funcs.sh | 8 ++------ xbps-src/xbps-src.sh.in | 7 ++++++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/xbps-src/shutils/chroot.sh.in b/xbps-src/shutils/chroot.sh.in index d5ebf43dd9..d19a7031f9 100644 --- a/xbps-src/shutils/chroot.sh.in +++ b/xbps-src/shutils/chroot.sh.in @@ -247,7 +247,7 @@ xbps_chroot_handler() [ "$action" != "configure" -a "$action" != "build" -a \ "$action" != "install" -a "$action" != "chroot" -a \ - "$action" != "install-destdir" ] && return 1 + "$action" != "install-destdir" -a "$action" != "remove" ] && return 1 if [ ! -f $XBPS_MASTERDIR/.xbps_perms_done ]; then echo -n "==> Preparing chroot on $XBPS_MASTERDIR... " diff --git a/xbps-src/shutils/stow_funcs.sh b/xbps-src/shutils/stow_funcs.sh index aeb2682f0b..ddf7fafacf 100644 --- a/xbps-src/shutils/stow_funcs.sh +++ b/xbps-src/shutils/stow_funcs.sh @@ -161,12 +161,10 @@ stow_pkg_real() # unstow_pkg_real() { - local f ver lpwd + local f ver [ -z $pkgname ] && return 1 - lpwd=$(pwd) - if [ $(id -u) -ne 0 ] && \ [ ! -w $XBPS_MASTERDIR ]; then msg_error "cannot unstow $pkgname! (permission denied)\n" @@ -214,8 +212,6 @@ unstow_pkg_real() rm -rf $XBPS_PKGMETADIR/$pkgname # Unregister pkg from plist file. - $XBPS_PKGDB_CMD unregister $pkgname $ver || return $? - cd ${lwd} - + $XBPS_PKGDB_CMD unregister $pkgname $ver return $? } diff --git a/xbps-src/xbps-src.sh.in b/xbps-src/xbps-src.sh.in index 71e616c575..843d798e38 100644 --- a/xbps-src/xbps-src.sh.in +++ b/xbps-src/xbps-src.sh.in @@ -412,7 +412,12 @@ remove) _pkgname=$(basename_cwd) fi setup_tmpl ${_pkgname} - remove_pkg + if [ -z "$in_chroot" -a -z "$base_chroot" ]; then + . $XBPS_SHUTILSDIR/chroot.sh + xbps_chroot_handler $target ${_pkgname} $dontrm_builddir + else + remove_pkg + fi ;; stow) stow_flag=yes