From 757d14f801364bbc071be3e55658b1c237fa10c6 Mon Sep 17 00:00:00 2001 From: merakor Date: Sun, 3 Jan 2021 22:22:04 +0000 Subject: pkg_get_base(): add function to print the packages defined in /etc/cpt-base FossilOrigin-Name: f282158e981153846bc1aca83263de583403dd78444435cb139a7f25e6658c4e --- src/cpt-lib.in | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/cpt-lib.in b/src/cpt-lib.in index cc4938b..b42d0e3 100644 --- a/src/cpt-lib.in +++ b/src/cpt-lib.in @@ -1809,6 +1809,19 @@ pkg_updates(){ log "Updated all packages" } +pkg_get_base() ( + # Print the packages defined in the /etc/cpt-base file. + # If an argument is given, it prints a space seperated list instead + # of a list seperated by newlines. + [ -f "$CPT_ROOT/etc/cpt-base" ] || return 1 + nonl=$1; set -- + while read -r pkg _; do + [ "${pkg##\#*}" ] || continue + set -- "$@" "$pkg" + done < "$CPT_ROOT/etc/cpt-base" + if [ "$nonl" ]; then printf '%s ' "$@"; else printf '%s\n' "$@"; fi +) + pkg_clean() { # Clean up on exit or error. This removes everything related # to the build. -- cgit v1.2.3