diff options
| author | merakor <cem@ckyln.com> | 2021-01-03 22:22:04 +0000 | 
|---|---|---|
| committer | merakor <cem@ckyln.com> | 2021-01-03 22:22:04 +0000 | 
| commit | 757d14f801364bbc071be3e55658b1c237fa10c6 (patch) | |
| tree | feaa8f68b10bd61961d48ac15913a394c5504062 | |
| parent | 7f087e4530ba676628301142f330242ff445e6e2 (diff) | |
| download | cpt-757d14f801364bbc071be3e55658b1c237fa10c6.tar.gz | |
pkg_get_base(): add function to print the packages defined in /etc/cpt-base
FossilOrigin-Name: f282158e981153846bc1aca83263de583403dd78444435cb139a7f25e6658c4e
| -rw-r--r-- | src/cpt-lib.in | 13 | 
1 files changed, 13 insertions, 0 deletions
| 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. | 
