xbps-src: make unstow work even if build template is missing.
This commit is contained in:
parent
9f65b80448
commit
c2b0d7a307
|
@ -218,11 +218,11 @@ remove_pkg()
|
|||
set_tmpl_common_vars
|
||||
pkg="${subpkg}-${version}"
|
||||
if [ -d "$XBPS_DESTDIR/${pkg}" ]; then
|
||||
msg_normal "'${pkg}': removing files from destdir...\n"
|
||||
msg_normal "${pkgver}: removing files from destdir...\n"
|
||||
rm -rf "$XBPS_DESTDIR/${pkg}"
|
||||
found=1
|
||||
else
|
||||
msg_warn "'${pkg}' not installed in destdir!\n"
|
||||
msg_warn "${pkgver}: not installed in destdir!\n"
|
||||
fi
|
||||
# Remove leftover files in $wrksrc.
|
||||
if [ -f "${wrksrc}/.xbps_do_install_${subpkg}_done" ]; then
|
||||
|
@ -233,7 +233,7 @@ remove_pkg()
|
|||
|
||||
pkg="${pkgname}-${version}"
|
||||
if [ -d "$XBPS_DESTDIR/${pkg}" ]; then
|
||||
msg_normal "'${pkg}': removing files from destdir...\n"
|
||||
msg_normal "${pkgver}: removing files from destdir...\n"
|
||||
rm -rf "$XBPS_DESTDIR/${pkg}"
|
||||
found=1
|
||||
fi
|
||||
|
@ -246,8 +246,7 @@ remove_pkg()
|
|||
if [ -n "$found" ]; then
|
||||
return 0
|
||||
else
|
||||
msg_warn "'${pkg}' not installed in destdir!\n"
|
||||
return 1
|
||||
msg_warn "${pkgver}: not installed in destdir!\n"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -168,26 +168,22 @@ unstow_pkg_real()
|
|||
msg_error "cannot unstow $pkgname! (permission denied)\n"
|
||||
fi
|
||||
|
||||
setup_tmpl $pkgname
|
||||
pkg="${pkgname}-${version}"
|
||||
[ -n "$revision" ] && pkg="${pkg}_${revision}"
|
||||
|
||||
ver=$($XBPS_PKGDB_CMD version $pkgname)
|
||||
if [ -z "$ver" ]; then
|
||||
msg_warn "'${pkg}' not installed in masterdir!\n"
|
||||
msg_warn "'${pkgname}' not installed in masterdir!\n"
|
||||
return 0
|
||||
fi
|
||||
|
||||
cd $XBPS_PKGMETADIR/$pkgname || exit 1
|
||||
if [ "$build_style" = "meta-template" ]; then
|
||||
# If it's a metapkg, do nothing.
|
||||
:
|
||||
elif [ ! -f ${XBPS_PKGMETADIR}/${pkgname}/flist ]; then
|
||||
msg_warn "'${pkg}' wasn't installed from source!\n"
|
||||
msg_warn "${pkgname}-${ver}: wasn't installed from source!\n"
|
||||
return 1
|
||||
elif [ ! -w ${XBPS_PKGMETADIR}/${pkgname}/flist ]; then
|
||||
msg_error "$pkgname cannot be removed (permission denied).\n"
|
||||
msg_error "${pkgname}-${ver}: cannot be removed (permission denied).\n"
|
||||
elif [ -s ${XBPS_PKGMETADIR}/${pkgname}/flist ]; then
|
||||
msg_normal "${pkgname}-${ver}: removing files from masterdir...\n"
|
||||
run_func pre_remove
|
||||
# Remove installed files.
|
||||
for f in $(cat ${XBPS_PKGMETADIR}/${pkgname}/flist); do
|
||||
|
@ -196,11 +192,7 @@ unstow_pkg_real()
|
|||
if [ $? -eq 0 ]; then
|
||||
echo "Removing file: $f"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
for f in $(cat ${XBPS_PKGMETADIR}/${pkgname}/flist); do
|
||||
if [ -d $XBPS_MASTERDIR/$f ]; then
|
||||
elif [ -d $XBPS_MASTERDIR/$f ]; then
|
||||
rmdir $XBPS_MASTERDIR/$f >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Removing directory: $f"
|
||||
|
|
|
@ -497,8 +497,9 @@ unstow)
|
|||
if [ -z "${_pkgname}" ]; then
|
||||
[ ! -r ./template ] && msg_error "missing build template in $(pwd).\n"
|
||||
_pkgname=$(basename_cwd)
|
||||
else
|
||||
pkgname=${_pkgname}
|
||||
fi
|
||||
setup_tmpl ${_pkgname}
|
||||
stow_pkg_handler unstow
|
||||
;;
|
||||
*)
|
||||
|
|
Loading…
Reference in New Issue