From 4db5c7ce08d2cd1301d2fb43ebfca5c33a552f4d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 26 Aug 2024 11:58:06 +0200 Subject: [PATCH] pm/install --- spcd/bootstrap.sh | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/spcd/bootstrap.sh b/spcd/bootstrap.sh index 29dd4d5..5667c7a 100644 --- a/spcd/bootstrap.sh +++ b/spcd/bootstrap.sh @@ -618,7 +618,6 @@ ${SPCD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")" spcd_os_printenv "SPCD_PM" case "${SPCD_PM}" in "${SPCD_PM_DNF}") - SPCD_PM_INSTALL="dnf install --assumeyes" SPCD_PM_QUERY="rpm --query" SPCD_PM_CONF_PATH="/etc/dnf/dnf.conf" SPCD_PM_CONF_TEXT="\ @@ -635,7 +634,6 @@ sslverify=False " ;; "${SPCD_PM_APK}") - SPCD_PM_INSTALL="apk add" SPCD_PM_QUERY="apk info" SPCD_PM_CONF_PATH="" SPCD_PM_CONF_TEXT="" @@ -645,7 +643,6 @@ sslverify=False " ;; "${SPCD_PM_PACMAN}") - SPCD_PM_INSTALL="pacman --sync --noconfirm" SPCD_PM_QUERY="pacman --query" SPCD_PM_CONF_PATH="" SPCD_PM_CONF_TEXT="" @@ -655,7 +652,6 @@ SSLVerify = No " ;; "${SPCD_PM_APT}") - SPCD_PM_INSTALL="apt-get install --assume-yes" SPCD_PM_QUERY="dpkg-query --show" SPCD_PM_CONF_PATH="/etc/apt/apt.conf.d/apt.conf" SPCD_PM_CONF_TEXT="\ @@ -671,7 +667,6 @@ Acquire::https::Verify-Peer False; " ;; "${SPCD_PM_ZYPPER}") - SPCD_PM_INSTALL="zypper --non-interactive install" SPCD_PM_QUERY="rpm --query" SPCD_PM_CONF_PATH="" SPCD_PM_CONF_TEXT="\ @@ -683,7 +678,7 @@ Acquire::https::Verify-Peer False; *) ;; esac spcd_split - spcd_os_printenv "SPCD_PM_INSTALL" "SPCD_PM_QUERY" + spcd_os_printenv "SPCD_PM_QUERY" spcd_split spcd_os_printenv "SPCD_PM_CONF_PATH" "SPCD_PM_HTTPS_PATH" # specific @@ -851,11 +846,15 @@ spcd_clean_cache() { } spcd_install_package() { - spcd_install_package__name="${1}" - if [ -n "${spcd_install_package__name}" ]; then - ${SPCD_PM_INSTALL} "${spcd_install_package__name}" - spcd_clean_cache - fi + case "${SPCD_PM}" in + "${SPCD_PM_APK}") apk add "${1}" ;; + "${SPCD_PM_APT}") apt-get install --assume-yes "${1}" ;; + "${SPCD_PM_DNF}") dnf install --assumeyes "${1}" ;; + "${SPCD_PM_PACMAN}") pacman --sync --noconfirm "${1}" ;; + "${SPCD_PM_ZYPPER}") zypper --non-interactive install "${1}" ;; + *) ;; + esac + spcd_clean_cache } # ╭───────┬─────╮