From eaa19846b87aa151dc71e3ec6594a7a889fa6948 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 8 Sep 2024 19:26:33 +0200 Subject: [PATCH] pkg/install --- spcd/bootstrap.sh | 68 +++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/spcd/bootstrap.sh b/spcd/bootstrap.sh index ee01566..4c77035 100644 --- a/spcd/bootstrap.sh +++ b/spcd/bootstrap.sh @@ -938,7 +938,7 @@ spcd_txt_locales() { spcd_split case "${SPCD_PM}" in "${SPCD_PM_APK}") - spcd_f_pm_install "musl-locales" + spcd_f_pm_pkg_install "musl-locales" export MUSL_LOCPATH="/usr/share/i18n/locales/musl" ;; "${SPCD_PM_APT}") @@ -949,17 +949,17 @@ ${name}.${_SPCD_TXT_CHARSET} ${_SPCD_TXT_CHARSET} " done spcd_os_write "/etc/locale.gen" "${text}" - spcd_f_pm_install "locales" + spcd_f_pm_pkg_install "locales" ;; "${SPCD_PM_DNF}") local language for name in "${@}"; do language="$(echo "${name}" | cut -d _ -f 1)" - spcd_f_pm_install "glibc-langpack-${language}" + spcd_f_pm_pkg_install "glibc-langpack-${language}" done ;; - "${SPCD_PM_PACMAN}") spcd_f_pm_install "glibc-locales" ;; - "${SPCD_PM_ZYPPER}") spcd_f_pm_install "glibc-locale" ;; + "${SPCD_PM_PACMAN}") spcd_f_pm_pkg_install "glibc-locales" ;; + "${SPCD_PM_ZYPPER}") spcd_f_pm_pkg_install "glibc-locale" ;; *) ;; esac spcd_split @@ -993,18 +993,6 @@ ${name}.${_SPCD_TXT_CHARSET} ${_SPCD_TXT_CHARSET} # │ f │ pm = package manager │ # ╰───┴──────────────────────╯ -spcd_f_pm_install() { - case "${SPCD_PM}" in - "${SPCD_PM_APK}") spcd_run apk add "${1}" ;; - "${SPCD_PM_APT}") spcd_run apt-get install --assume-yes "${1}" ;; - "${SPCD_PM_DNF}") spcd_run dnf install --assumeyes "${1}" ;; - "${SPCD_PM_PACMAN}") spcd_run pacman --sync --noconfirm "${1}" ;; - "${SPCD_PM_ZYPPER}") spcd_run zypper --non-interactive install "${1}" ;; - *) ;; - esac - spcd_f_pm_pkg_clean -} - spcd_f_pm_query() { case "${SPCD_PM}" in "${SPCD_PM_APK}") apk info "${1}" ;; @@ -1108,6 +1096,18 @@ spcd_f_pm_pkg_clean() { esac } +spcd_f_pm_pkg_install() { + case "${SPCD_PM}" in + "${SPCD_PM_APK}") spcd_run apk add "${1}" ;; + "${SPCD_PM_APT}") spcd_run apt-get install --assume-yes "${1}" ;; + "${SPCD_PM_DNF}") spcd_run dnf install --assumeyes "${1}" ;; + "${SPCD_PM_PACMAN}") spcd_run pacman --sync --noconfirm "${1}" ;; + "${SPCD_PM_ZYPPER}") spcd_run zypper --non-interactive install "${1}" ;; + *) ;; + esac + spcd_f_pm_pkg_clean +} + # ╭───┬─────╮ # │ s │ dns │ # ╰───┴─────╯ @@ -1305,7 +1305,7 @@ Dir::Etc::SourceParts \"\"; spcd_step__packages_install_tools() { spcd_step "Install tools" case "${SPCD_PM}" in - "${SPCD_PM_APT}") spcd_f_pm_install "apt-utils" ;; + "${SPCD_PM_APT}") spcd_f_pm_pkg_install "apt-utils" ;; *) ;; esac } @@ -1327,7 +1327,7 @@ spcd_step__packages_install_locales() { spcd_step__ca_install_package() { spcd_step "Install package" - spcd_f_pm_install "ca-certificates" + spcd_f_pm_pkg_install "ca-certificates" } spcd_step__ca_write_certificates() { @@ -1377,12 +1377,12 @@ spcd_step__ca_update_certificates() { spcd_step__packages_install_dos2unix() { spcd_step "Install dos2unix" - spcd_f_pm_install "dos2unix" + spcd_f_pm_pkg_install "dos2unix" } spcd_step__packages_install_git() { spcd_step "Install Git" - spcd_f_pm_install "git" + spcd_f_pm_pkg_install "git" } # ╭───┬────────╮ @@ -1391,7 +1391,7 @@ spcd_step__packages_install_git() { spcd_step__python_install() { spcd_step "Install package" - spcd_f_pm_install "${SPCD_PYTHON_PACKAGE}" + spcd_f_pm_pkg_install "${SPCD_PYTHON_PACKAGE}" spcd_step "Link alias to command" spcd_python_ln "${SPCD_PYTHON_COMMAND}" # venv @@ -1399,7 +1399,7 @@ spcd_step__python_install() { spcd_step "Install package" case "${SPCD_OS_ID}" in "${SPCD_OS_DEBIAN}" | "${SPCD_OS_UBUNTU}") - spcd_f_pm_install "python3-venv" + spcd_f_pm_pkg_install "python3-venv" ;; *) ;; esac @@ -1449,7 +1449,7 @@ spcd_step__install_packages() { spcd_step "EPEL" case "${SPCD_OS_ID}" in "${SPCD_OS_ALMA}" | "${SPCD_OS_ROCKY}") - spcd_f_pm_install "epel-release" + spcd_f_pm_pkg_install "epel-release" case "${SPCD_OS_VERSION}" in "9") set -- \ @@ -1481,32 +1481,32 @@ spcd_step__install_packages() { esac # graphviz spcd_step "GraphViz" - spcd_f_pm_install "graphviz" + spcd_f_pm_pkg_install "graphviz" # openssh spcd_step "OpenSSH" case "${SPCD_PM}" in "${SPCD_PM_APK}" | "${SPCD_PM_APT}") - spcd_f_pm_install "openssh-client" + spcd_f_pm_pkg_install "openssh-client" ;; "${SPCD_PM_DNF}" | "${SPCD_PM_ZYPPER}") - spcd_f_pm_install "openssh-clients" + spcd_f_pm_pkg_install "openssh-clients" ;; - "${SPCD_PM_PACMAN}") spcd_f_pm_install "openssh" ;; + "${SPCD_PM_PACMAN}") spcd_f_pm_pkg_install "openssh" ;; *) ;; esac # plantuml spcd_step "PlantUML" - spcd_f_pm_install "plantuml" + spcd_f_pm_pkg_install "plantuml" # rsync spcd_step "Rsync" - spcd_f_pm_install "rsync" + spcd_f_pm_pkg_install "rsync" # shell check spcd_step "ShellCheck" case "${SPCD_PM}" in "${SPCD_PM_DNF}" | "${SPCD_PM_ZYPPER}") - spcd_f_pm_install "ShellCheck" + spcd_f_pm_pkg_install "ShellCheck" ;; - *) spcd_f_pm_install "shellcheck" ;; + *) spcd_f_pm_pkg_install "shellcheck" ;; esac # shfmt spcd_step "ShellFormat" @@ -1515,10 +1515,10 @@ spcd_step__install_packages() { "${SPCD_OS_DEBIAN}") case "${SPCD_OS_VERSION}" in "bullseye") ;; - *) spcd_f_pm_install "shfmt" ;; + *) spcd_f_pm_pkg_install "shfmt" ;; esac ;; - *) spcd_f_pm_install "shfmt" ;; + *) spcd_f_pm_pkg_install "shfmt" ;; esac spcd_step_out }