From 96e06ffc666e09c88bd834a5721702c073450efd Mon Sep 17 00:00:00 2001 From: emmett1 Date: Fri, 23 Dec 2022 23:47:29 +0800 Subject: [PATCH] added scratch_purge --- scratch | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scratch b/scratch index 083309a..02e0174 100755 --- a/scratch +++ b/scratch @@ -1303,10 +1303,23 @@ scratch_missingdep() { done } +scratch_purge() { + needroot + echo "Resolving dependencies..." + x=$(scratch_orphan $@) + if [ "$x" ]; then + scratch_remove $x + else + echo "No orphan packages found..." + fi +} + scratch_orphan() { tmpdeplistworld="/tmp/.deplistworld.$$" tmpallinstalled="/tmp/.allinstalled.$$" for i in $(cat $WORLD_FILE); do + echo $@ | tr ' ' '\n' | grep -qx $i && continue + echo $DEP | tr ' ' '\n' | grep -qx $i && continue deplist $i done echo $DEP | tr ' ' '\n' > $tmpdeplistworld @@ -1466,6 +1479,7 @@ Options: info print information locate print location of file in ports repo isinstalled check whether port is installed (status 0=installed, 1=not installed) + purge [ports] remove installed ports and its orphan dependencies sync update ports database outdate print outdated ports cache print and clear old pkg and src caches