From ca71525e575f809c77d84550a3e8abc100dfb5a4 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Wed, 11 May 2022 13:25:55 +0200 Subject: Allow package names to not be explicitly defined as configuration values --- CHANGELOG.md | 4 ++++ lib/util/pkg.bash | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4034fa7..dcfa169 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # Changelog + All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), @@ -16,6 +17,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 warning if one is not set for a node. - `svc_enable()` now checks for the `rc.d` file to exist before running `grep` on it. +- `pkg_*()` functions no longer _require_ a `pkg.*` value to be defined. If one + is not set explicitly, a warning will be generated, but the original name + passed to the `pkg_*()` function will be used by the host's package manager. ## [1.0.0] - 2022-05-06 diff --git a/lib/util/pkg.bash b/lib/util/pkg.bash index 618ce6a..de70f78 100644 --- a/lib/util/pkg.bash +++ b/lib/util/pkg.bash @@ -6,12 +6,12 @@ pkg() { local action=$1 ; shift local pkg - pkg="$(config "pkg.$1")" ; shift + pkg="$(config "pkg.$1")" if [[ -z $pkg ]] then - crit "$system" "No package name for $pkg" - return 1 + warn "$system" "No explicit package name for $1" + pkg="$1" fi if [[ "$(type -t "pkg_$action")" != "function" ]] -- cgit v1.1