This commit is contained in:
Marc Beninca 2024-09-08 19:39:30 +02:00
parent 794abeb351
commit acae6216d0
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -836,6 +836,129 @@ spcd_python_pip() {
fi
}
# ╭───┬──────────────────────╮
# │ f │ pm = package manager │
# ╰───┴──────────────────────╯
# ╭───┬────┬───────╮
# │ f │ pm │ https │
# ╰───┴────┴───────╯
spcd_f_pm_https_path() {
case "${SPCD_PM}" in
"${SPCD_PM_APK}") echo "/etc/apk/repositories.d/https" ;;
"${SPCD_PM_APT}") echo "/etc/apt/apt.conf.d/https" ;;
"${SPCD_PM_DNF}") echo "/etc/dnf/dnf.conf.d/https.conf" ;;
"${SPCD_PM_PACMAN}") echo "/etc/pacman.d/https.conf" ;;
"${SPCD_PM_ZYPPER}") ;;
*) ;;
esac
}
spcd_f_pm_https_trust() {
spcd_step "Trust"
local path text
if [ -n "${SPCD_CA_1}" ] || [ "${SPCD_PM}" = "${SPCD_PM_APT}" ]; then
path="$(spcd_f_pm_https_path)"
if [ -n "${path}" ]; then
spcd_os_mkdir "$(dirname "${path}")"
case "${SPCD_PM}" in
"${SPCD_PM_APK}") text="\
--no-verify
" ;;
"${SPCD_PM_APT}") text="\
Acquire::https::Verify-Peer False;
" ;;
"${SPCD_PM_DNF}") text="\
sslverify=False
" ;;
"${SPCD_PM_PACMAN}") text="\
SSLVerify = No
" ;;
"${SPCD_PM_ZYPPER}") ;;
*) ;;
esac
[ -n "${text}" ] &&
spcd_os_write "${path}" "${text}"
fi
fi
}
spcd_f_pm_https_verify() {
spcd_step "Verify"
local path
path="$(spcd_f_pm_https_path)"
if [ -n "${path}" ]; then
spcd_os_rm "${path}"
fi
}
# ╭───┬────┬─────╮
# │ f │ pm │ pkg │
# ╰───┴────┴─────╯
spcd_f_pm_pkg_clean() {
case "${SPCD_PM}" in
"${SPCD_PM_APK}") spcd_run apk cache purge ;;
"${SPCD_PM_APT}") spcd_run apt-get clean ;;
"${SPCD_PM_DNF}") spcd_run dnf clean all ;;
"${SPCD_PM_PACMAN}") spcd_run pacman --sync --clean --noconfirm ;;
"${SPCD_PM_ZYPPER}") spcd_run zypper 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
}
spcd_f_pm_pkg_query() {
case "${SPCD_PM}" in
"${SPCD_PM_APK}") apk info "${1}" ;;
"${SPCD_PM_APT}") dpkg-query --show "${1}" ;;
"${SPCD_PM_DNF}") rpm --query "${1}" ;;
"${SPCD_PM_PACMAN}") pacman --query "${1}" ;;
"${SPCD_PM_ZYPPER}") rpm --query "${1}" ;;
*) ;;
esac
}
spcd_f_pm_pkg_update() {
spcd_step "Update"
case "${SPCD_PM}" in
"${SPCD_PM_APK}") spcd_run apk update ;;
"${SPCD_PM_APT}") spcd_run apt-get update ;;
"${SPCD_PM_DNF}") spcd_run dnf makecache ;;
"${SPCD_PM_PACMAN}") spcd_run pacman --sync --refresh ;;
"${SPCD_PM_ZYPPER}") spcd_run zypper refresh ;;
*) ;;
esac
}
spcd_f_pm_pkg_upgrade() {
spcd_step "Upgrade"
case "${SPCD_PM}" in
"${SPCD_PM_APK}") spcd_run apk upgrade ;;
"${SPCD_PM_APT}") spcd_run apt-get upgrade --assume-yes ;;
"${SPCD_PM_DNF}") spcd_run dnf upgrade --assumeyes ;;
"${SPCD_PM_PACMAN}") spcd_run pacman --sync --sysupgrade --noconfirm ;;
"${SPCD_PM_ZYPPER}") spcd_run zypper --non-interactive update ;;
*) ;;
esac
}
# ╭───┬─────╮
# │ f │ txt │
# ╰───┴─────╯
spcd_txt_locale() {
local action="${1}"
local chosen="${2}"
@ -989,125 +1112,6 @@ ${name}.${_SPCD_TXT_CHARSET} ${_SPCD_TXT_CHARSET}
esac
}
# ╭───┬──────────────────────╮
# │ f │ pm = package manager │
# ╰───┴──────────────────────╯
# ╭───┬────┬───────╮
# │ f │ pm │ https │
# ╰───┴────┴───────╯
spcd_f_pm_https_path() {
case "${SPCD_PM}" in
"${SPCD_PM_APK}") echo "/etc/apk/repositories.d/https" ;;
"${SPCD_PM_APT}") echo "/etc/apt/apt.conf.d/https" ;;
"${SPCD_PM_DNF}") echo "/etc/dnf/dnf.conf.d/https.conf" ;;
"${SPCD_PM_PACMAN}") echo "/etc/pacman.d/https.conf" ;;
"${SPCD_PM_ZYPPER}") ;;
*) ;;
esac
}
spcd_f_pm_https_trust() {
spcd_step "Trust"
local path text
if [ -n "${SPCD_CA_1}" ] || [ "${SPCD_PM}" = "${SPCD_PM_APT}" ]; then
path="$(spcd_f_pm_https_path)"
if [ -n "${path}" ]; then
spcd_os_mkdir "$(dirname "${path}")"
case "${SPCD_PM}" in
"${SPCD_PM_APK}") text="\
--no-verify
" ;;
"${SPCD_PM_APT}") text="\
Acquire::https::Verify-Peer False;
" ;;
"${SPCD_PM_DNF}") text="\
sslverify=False
" ;;
"${SPCD_PM_PACMAN}") text="\
SSLVerify = No
" ;;
"${SPCD_PM_ZYPPER}") ;;
*) ;;
esac
[ -n "${text}" ] &&
spcd_os_write "${path}" "${text}"
fi
fi
}
spcd_f_pm_https_verify() {
spcd_step "Verify"
local path
path="$(spcd_f_pm_https_path)"
if [ -n "${path}" ]; then
spcd_os_rm "${path}"
fi
}
# ╭───┬────┬─────╮
# │ f │ pm │ pkg │
# ╰───┴────┴─────╯
spcd_f_pm_pkg_clean() {
case "${SPCD_PM}" in
"${SPCD_PM_APK}") spcd_run apk cache purge ;;
"${SPCD_PM_APT}") spcd_run apt-get clean ;;
"${SPCD_PM_DNF}") spcd_run dnf clean all ;;
"${SPCD_PM_PACMAN}") spcd_run pacman --sync --clean --noconfirm ;;
"${SPCD_PM_ZYPPER}") spcd_run zypper 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
}
spcd_f_pm_pkg_query() {
case "${SPCD_PM}" in
"${SPCD_PM_APK}") apk info "${1}" ;;
"${SPCD_PM_APT}") dpkg-query --show "${1}" ;;
"${SPCD_PM_DNF}") rpm --query "${1}" ;;
"${SPCD_PM_PACMAN}") pacman --query "${1}" ;;
"${SPCD_PM_ZYPPER}") rpm --query "${1}" ;;
*) ;;
esac
}
spcd_f_pm_pkg_update() {
spcd_step "Update"
case "${SPCD_PM}" in
"${SPCD_PM_APK}") spcd_run apk update ;;
"${SPCD_PM_APT}") spcd_run apt-get update ;;
"${SPCD_PM_DNF}") spcd_run dnf makecache ;;
"${SPCD_PM_PACMAN}") spcd_run pacman --sync --refresh ;;
"${SPCD_PM_ZYPPER}") spcd_run zypper refresh ;;
*) ;;
esac
}
spcd_f_pm_pkg_upgrade() {
spcd_step "Upgrade"
case "${SPCD_PM}" in
"${SPCD_PM_APK}") spcd_run apk upgrade ;;
"${SPCD_PM_APT}") spcd_run apt-get upgrade --assume-yes ;;
"${SPCD_PM_DNF}") spcd_run dnf upgrade --assumeyes ;;
"${SPCD_PM_PACMAN}") spcd_run pacman --sync --sysupgrade --noconfirm ;;
"${SPCD_PM_ZYPPER}") spcd_run zypper --non-interactive update ;;
*) ;;
esac
}
# ╭───┬─────╮
# │ s │ dns │
# ╰───┴─────╯