xbps-src: fix an error in the unstow case.

This commit is contained in:
Juan RP 2010-05-17 22:21:19 +02:00
parent c5402281f0
commit 66321f05e6

View file

@ -1,5 +1,5 @@
#- #-
# Copyright (c) 2008-2009 Juan Romero Pardines. # Copyright (c) 2008-2010 Juan Romero Pardines.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -164,10 +164,12 @@ stow_pkg_real()
# #
unstow_pkg_real() unstow_pkg_real()
{ {
local f ver local f ver lpwd
[ -z $pkgname ] && return 1 [ -z $pkgname ] && return 1
lpwd=$(pwd)
if [ $(id -u) -ne 0 ] && \ if [ $(id -u) -ne 0 ] && \
[ ! -w $XBPS_MASTERDIR ]; then [ ! -w $XBPS_MASTERDIR ]; then
msg_error "cannot unstow $pkgname! (permission denied)" msg_error "cannot unstow $pkgname! (permission denied)"
@ -223,6 +225,8 @@ unstow_pkg_real()
rm -rf $XBPS_PKGMETADIR/$pkgname rm -rf $XBPS_PKGMETADIR/$pkgname
# Unregister pkg from plist file. # Unregister pkg from plist file.
$XBPS_PKGDB_CMD unregister $pkgname $ver $XBPS_PKGDB_CMD unregister $pkgname $ver || return $?
cd ${lwd}
return $? return $?
} }