aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremmett1 <emmett1.2miligrams@protonmail.com>2025-06-26 07:33:15 +0800
committeremmett1 <emmett1.2miligrams@protonmail.com>2025-06-26 07:33:15 +0800
commite2c62f10999af8c80a65b1b8d54a77f1e29a36be (patch)
treeef7db79258a83819c9e6d6897466e48f630c496f
parent630132dc7603bb5f52453bcf50e2eeab6d1e72e4 (diff)
downloadspm-e2c62f10999af8c80a65b1b8d54a77f1e29a36be.tar.gz
spm-e2c62f10999af8c80a65b1b8d54a77f1e29a36be.zip
fix spm -r
-rwxr-xr-xspm12
1 files changed, 8 insertions, 4 deletions
diff --git a/spm b/spm
index 9e74b3c..57447e5 100755
--- a/spm
+++ b/spm
@@ -269,9 +269,9 @@ spm_remove() {
# list all dirs except for target pkg
grep /$ $PKGDB/* | grep -v /$1: | awk -F : '{print $2}' | sort | uniq > $SPMDIR/remove.all
- grep /$ $PKGDB/* | grep /$1: | awk -F : '{print $2}' | sort | uniq > $SPMDIR/remove.target
- grep -Fxv -f $SPMDIR/remove.all $SPMDIR/remove.target > $SPMDIR/remove.rmlist
- rmdir $VERBOSE $(sort $SPMDIR/remove.rmlist | tac)
+ grep /$ $PKGDB/* | grep /$1: | awk -F : '{print $2}' | sort | uniq > $SPMDIR/remove.target
+ grep -Fxv -f $SPMDIR/remove.all $SPMDIR/remove.target | sort | tac > $SPMDIR/remove.rmlist
+ [ -s $SPMDIR/remove.rmlist ] && rmdir $VERBOSE $(sort $SPMDIR/remove.rmlist | tac)
rm -f $PKGDB/$1 $PERMDIR/$1 $OWNDIR/$1 $SPMDIR/remove.*
msg "Package '$1' removed."
@@ -331,7 +331,11 @@ if [ "$SPM_ROOT" ]; then
SPM_ROOT=$(realpath $SPM_ROOT)
fi
-[ "$SPM_VERBOSE" ] && VERBOSE=-v
+if [ "$SPM_VERBOSE" ]; then
+ VERBOSE=-v
+else
+ VERBOSE=
+fi
HERE=$PWD
SPMDIR=$SPM_ROOT/var/lib/spm