aboutsummaryrefslogtreecommitdiff
path: root/contrib/cpt-reset
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2021-03-12 12:49:16 +0000
committermerakor <cem@ckyln.com>2021-03-12 12:49:16 +0000
commitd475c70d2d37d6050c06eae1d42c288d8ca05c8d (patch)
treef0bf1b167bb0eaf803bdc79aa9e11fa9bad8c400 /contrib/cpt-reset
parentc0ddaf74fa5f99dc0c60515a291bb6276b134fa6 (diff)
downloadcpt-d475c70d2d37d6050c06eae1d42c288d8ca05c8d.tar.gz
cpt-reset: use library to get base packages
FossilOrigin-Name: 410d9752fe6f92d8c1812d089437ef5273df1a4772c32467bf20b91c9ee80a69
Diffstat (limited to 'contrib/cpt-reset')
-rwxr-xr-xcontrib/cpt-reset19
1 files changed, 4 insertions, 15 deletions
diff --git a/contrib/cpt-reset b/contrib/cpt-reset
index 4dfe52d..90dd755 100755
--- a/contrib/cpt-reset
+++ b/contrib/cpt-reset
@@ -10,25 +10,14 @@
exit 0
}
-sys_db="$CPT_ROOT/var/db/cpt/installed"
-
-# Get base packages and their dependencies.
-[ -f "$CPT_ROOT/etc/cpt-base" ] && while read -r basepkg _; do
- case "$basepkg" in \#*) continue; esac
- base=" $basepkg $base"
- [ -f "$sys_db/$basepkg/depends" ] || continue
- while read -r dep make; do
- [ "$make" ] && continue
- base=" $dep $base"
- done < "$sys_db/$basepkg/depends"
-done < "$CPT_ROOT/etc/cpt-base"
+. cpt-lib
+base=$(pkg_get_base nonl)
set --
cd "$sys_db"
-for pkg in *; do
- case "$base" in *" $pkg "*) continue; esac
- set -- "$pkg" "$@"
+set +f; for pkg in *; do
+ contains "$base" "$pkg" || set -- "$pkg" "$@"
done
[ "$1" ] && {