pkg/install

This commit is contained in:
Marc Beninca 2024-09-08 19:26:33 +02:00
parent d440c047e7
commit eaa19846b8
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -938,7 +938,7 @@ spcd_txt_locales() {
spcd_split spcd_split
case "${SPCD_PM}" in case "${SPCD_PM}" in
"${SPCD_PM_APK}") "${SPCD_PM_APK}")
spcd_f_pm_install "musl-locales" spcd_f_pm_pkg_install "musl-locales"
export MUSL_LOCPATH="/usr/share/i18n/locales/musl" export MUSL_LOCPATH="/usr/share/i18n/locales/musl"
;; ;;
"${SPCD_PM_APT}") "${SPCD_PM_APT}")
@ -949,17 +949,17 @@ ${name}.${_SPCD_TXT_CHARSET} ${_SPCD_TXT_CHARSET}
" "
done done
spcd_os_write "/etc/locale.gen" "${text}" spcd_os_write "/etc/locale.gen" "${text}"
spcd_f_pm_install "locales" spcd_f_pm_pkg_install "locales"
;; ;;
"${SPCD_PM_DNF}") "${SPCD_PM_DNF}")
local language local language
for name in "${@}"; do for name in "${@}"; do
language="$(echo "${name}" | cut -d _ -f 1)" language="$(echo "${name}" | cut -d _ -f 1)"
spcd_f_pm_install "glibc-langpack-${language}" spcd_f_pm_pkg_install "glibc-langpack-${language}"
done done
;; ;;
"${SPCD_PM_PACMAN}") spcd_f_pm_install "glibc-locales" ;; "${SPCD_PM_PACMAN}") spcd_f_pm_pkg_install "glibc-locales" ;;
"${SPCD_PM_ZYPPER}") spcd_f_pm_install "glibc-locale" ;; "${SPCD_PM_ZYPPER}") spcd_f_pm_pkg_install "glibc-locale" ;;
*) ;; *) ;;
esac esac
spcd_split spcd_split
@ -993,18 +993,6 @@ ${name}.${_SPCD_TXT_CHARSET} ${_SPCD_TXT_CHARSET}
# │ f │ pm = package manager │ # │ 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() { spcd_f_pm_query() {
case "${SPCD_PM}" in case "${SPCD_PM}" in
"${SPCD_PM_APK}") apk info "${1}" ;; "${SPCD_PM_APK}") apk info "${1}" ;;
@ -1108,6 +1096,18 @@ spcd_f_pm_pkg_clean() {
esac 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 │ # │ s │ dns │
# ╰───┴─────╯ # ╰───┴─────╯
@ -1305,7 +1305,7 @@ Dir::Etc::SourceParts \"\";
spcd_step__packages_install_tools() { spcd_step__packages_install_tools() {
spcd_step "Install tools" spcd_step "Install tools"
case "${SPCD_PM}" in case "${SPCD_PM}" in
"${SPCD_PM_APT}") spcd_f_pm_install "apt-utils" ;; "${SPCD_PM_APT}") spcd_f_pm_pkg_install "apt-utils" ;;
*) ;; *) ;;
esac esac
} }
@ -1327,7 +1327,7 @@ spcd_step__packages_install_locales() {
spcd_step__ca_install_package() { spcd_step__ca_install_package() {
spcd_step "Install package" spcd_step "Install package"
spcd_f_pm_install "ca-certificates" spcd_f_pm_pkg_install "ca-certificates"
} }
spcd_step__ca_write_certificates() { spcd_step__ca_write_certificates() {
@ -1377,12 +1377,12 @@ spcd_step__ca_update_certificates() {
spcd_step__packages_install_dos2unix() { spcd_step__packages_install_dos2unix() {
spcd_step "Install dos2unix" spcd_step "Install dos2unix"
spcd_f_pm_install "dos2unix" spcd_f_pm_pkg_install "dos2unix"
} }
spcd_step__packages_install_git() { spcd_step__packages_install_git() {
spcd_step "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__python_install() {
spcd_step "Install package" 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_step "Link alias to command"
spcd_python_ln "${SPCD_PYTHON_COMMAND}" spcd_python_ln "${SPCD_PYTHON_COMMAND}"
# venv # venv
@ -1399,7 +1399,7 @@ spcd_step__python_install() {
spcd_step "Install package" spcd_step "Install package"
case "${SPCD_OS_ID}" in case "${SPCD_OS_ID}" in
"${SPCD_OS_DEBIAN}" | "${SPCD_OS_UBUNTU}") "${SPCD_OS_DEBIAN}" | "${SPCD_OS_UBUNTU}")
spcd_f_pm_install "python3-venv" spcd_f_pm_pkg_install "python3-venv"
;; ;;
*) ;; *) ;;
esac esac
@ -1449,7 +1449,7 @@ spcd_step__install_packages() {
spcd_step "EPEL" spcd_step "EPEL"
case "${SPCD_OS_ID}" in case "${SPCD_OS_ID}" in
"${SPCD_OS_ALMA}" | "${SPCD_OS_ROCKY}") "${SPCD_OS_ALMA}" | "${SPCD_OS_ROCKY}")
spcd_f_pm_install "epel-release" spcd_f_pm_pkg_install "epel-release"
case "${SPCD_OS_VERSION}" in case "${SPCD_OS_VERSION}" in
"9") "9")
set -- \ set -- \
@ -1481,32 +1481,32 @@ spcd_step__install_packages() {
esac esac
# graphviz # graphviz
spcd_step "GraphViz" spcd_step "GraphViz"
spcd_f_pm_install "graphviz" spcd_f_pm_pkg_install "graphviz"
# openssh # openssh
spcd_step "OpenSSH" spcd_step "OpenSSH"
case "${SPCD_PM}" in case "${SPCD_PM}" in
"${SPCD_PM_APK}" | "${SPCD_PM_APT}") "${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_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 esac
# plantuml # plantuml
spcd_step "PlantUML" spcd_step "PlantUML"
spcd_f_pm_install "plantuml" spcd_f_pm_pkg_install "plantuml"
# rsync # rsync
spcd_step "Rsync" spcd_step "Rsync"
spcd_f_pm_install "rsync" spcd_f_pm_pkg_install "rsync"
# shell check # shell check
spcd_step "ShellCheck" spcd_step "ShellCheck"
case "${SPCD_PM}" in case "${SPCD_PM}" in
"${SPCD_PM_DNF}" | "${SPCD_PM_ZYPPER}") "${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 esac
# shfmt # shfmt
spcd_step "ShellFormat" spcd_step "ShellFormat"
@ -1515,10 +1515,10 @@ spcd_step__install_packages() {
"${SPCD_OS_DEBIAN}") "${SPCD_OS_DEBIAN}")
case "${SPCD_OS_VERSION}" in case "${SPCD_OS_VERSION}" in
"bullseye") ;; "bullseye") ;;
*) spcd_f_pm_install "shfmt" ;; *) spcd_f_pm_pkg_install "shfmt" ;;
esac esac
;; ;;
*) spcd_f_pm_install "shfmt" ;; *) spcd_f_pm_pkg_install "shfmt" ;;
esac esac
spcd_step_out spcd_step_out
} }