constants/alma,debian

This commit is contained in:
Marc Beninca 2024-05-02 11:10:54 +02:00
parent 6932ec8f0a
commit 092d84c433
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

49
cd.sh
View file

@ -44,7 +44,7 @@ local variable
CD_PYTHON_COMMAND="python3" CD_PYTHON_COMMAND="python3"
# #
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
"debian") "${CD_OS_DEBIAN}")
case "${CD_OS_VERSION}" in case "${CD_OS_VERSION}" in
"bookworm"|"bullseye") cd_nop ;; "bookworm"|"bullseye") cd_nop ;;
*) cd_error_os "CD_OS_VERSION" ;; *) cd_error_os "CD_OS_VERSION" ;;
@ -53,7 +53,7 @@ local variable
CD_PYTHON_PACKAGES="/usr/lib/python3/dist-packages" CD_PYTHON_PACKAGES="/usr/lib/python3/dist-packages"
CD_CA_ROOT="/usr/local/share/ca-certificates" CD_CA_ROOT="/usr/local/share/ca-certificates"
;; ;;
"alma") "${CD_OS_ALMA}")
case "${CD_OS_VERSION}" in case "${CD_OS_VERSION}" in
"8"|"9") "8"|"9")
CD_PYTHON_PACKAGE="python3.11" CD_PYTHON_PACKAGE="python3.11"
@ -120,7 +120,7 @@ local expression
local file local file
cd_step "Set packages repositories" cd_step "Set packages repositories"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
"debian") "${CD_OS_DEBIAN}")
cd_write "/etc/apt/sources.list" "\ cd_write "/etc/apt/sources.list" "\
deb https://deb.debian.org/debian ${CD_OS_VERSION} main deb https://deb.debian.org/debian ${CD_OS_VERSION} main
deb https://deb.debian.org/debian ${CD_OS_VERSION}-backports main deb https://deb.debian.org/debian ${CD_OS_VERSION}-backports main
@ -128,7 +128,7 @@ deb https://deb.debian.org/debian ${CD_OS_VERSION}-updates main
deb https://deb.debian.org/debian-security ${CD_OS_VERSION}-security main deb https://deb.debian.org/debian-security ${CD_OS_VERSION}-security main
" "
;; ;;
"alma") "${CD_OS_ALMA}")
file="/etc/yum.repos.d/almalinux.repo" file="/etc/yum.repos.d/almalinux.repo"
cd_sed "${file}" "|^m|# m|" "|^# b|b|" cd_sed "${file}" "|^m|# m|" "|^# b|b|"
cd_cat "${file}" cd_cat "${file}"
@ -139,7 +139,7 @@ deb https://deb.debian.org/debian-security ${CD_OS_VERSION}-security main
cd_set_packages_configuration () { cd_set_packages_configuration () {
cd_step "Set packages configuration" cd_step "Set packages configuration"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
"debian") "${CD_OS_DEBIAN}")
export DEBIAN_FRONTEND="noninteractive" export DEBIAN_FRONTEND="noninteractive"
cd_write "/etc/apt/apt.conf.d/apt.conf" "\ cd_write "/etc/apt/apt.conf.d/apt.conf" "\
Acquire::Check-Valid-Until True; Acquire::Check-Valid-Until True;
@ -149,7 +149,7 @@ APT::Install-Suggests False;
Dir::Etc::SourceParts \"\"; Dir::Etc::SourceParts \"\";
" "
;; ;;
"alma") cd_mkdir "/etc/dnf/dnf.conf.d" ;; "${CD_OS_ALMA}") cd_mkdir "/etc/dnf/dnf.conf.d" ;;
esac esac
} }
@ -172,12 +172,12 @@ cd_set_https_verification_off () {
if [ "${CD_CA}" ] ; then if [ "${CD_CA}" ] ; then
cd_step "Set HTTPS verification off" cd_step "Set HTTPS verification off"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
"debian") "${CD_OS_DEBIAN}")
cd_write "/etc/apt/apt.conf.d/https" "\ cd_write "/etc/apt/apt.conf.d/https" "\
Acquire::https::Verify-Peer False; Acquire::https::Verify-Peer False;
" "
;; ;;
"alma") "${CD_OS_ALMA}")
cd_write "/etc/dnf/dnf.conf.d/https.conf" "\ cd_write "/etc/dnf/dnf.conf.d/https.conf" "\
sslverify=False sslverify=False
" "
@ -189,16 +189,16 @@ sslverify=False
cd_update_packages_catalog () { cd_update_packages_catalog () {
cd_step "Update packages catalog" cd_step "Update packages catalog"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
"debian") apt-get update || exit ;; "${CD_OS_DEBIAN}") apt-get update || exit ;;
"alma") dnf makecache || exit ;; "${CD_OS_ALMA}") dnf makecache || exit ;;
esac esac
} }
cd_install_packages_tools () { cd_install_packages_tools () {
cd_step "Install packages tools" cd_step "Install packages tools"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
"debian") cd_install_package "apt-utils" ;; "${CD_OS_DEBIAN}") cd_install_package "apt-utils" ;;
"alma") echo "TODO" ;; "${CD_OS_ALMA}") echo "TODO" ;;
esac esac
} }
@ -210,8 +210,8 @@ cd_install_ca_certificates () {
cd_update_ca_certificates () { cd_update_ca_certificates () {
cd_step "Update CA" cd_step "Update CA"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
"debian") update-ca-certificates || exit ;; "${CD_OS_DEBIAN}") update-ca-certificates || exit ;;
"alma") update-ca-trust || exit ;; "${CD_OS_ALMA}") update-ca-trust || exit ;;
esac esac
} }
@ -219,8 +219,8 @@ cd_set_https_verification_on () {
if [ "${CD_CA}" ] ; then if [ "${CD_CA}" ] ; then
cd_step "Set HTTPS verification on" cd_step "Set HTTPS verification on"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
"debian") cd_rm "/etc/apt/apt.conf.d/https" ;; "${CD_OS_DEBIAN}") cd_rm "/etc/apt/apt.conf.d/https" ;;
"alma") cd_rm "/etc/dnf/dnf.conf.d/https.conf" ;; "${CD_OS_ALMA}") cd_rm "/etc/dnf/dnf.conf.d/https.conf" ;;
esac esac
fi fi
} }
@ -228,8 +228,8 @@ cd_set_https_verification_on () {
cd_upgrade_packages () { cd_upgrade_packages () {
cd_step "Upgrade packages" cd_step "Upgrade packages"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
"debian") apt-get upgrade --assume-yes || exit ;; "${CD_OS_DEBIAN}") apt-get upgrade --assume-yes || exit ;;
"alma") dnf upgrade --assumeyes || exit ;; "${CD_OS_ALMA}") dnf upgrade --assumeyes || exit ;;
esac esac
} }
@ -246,8 +246,8 @@ cd_install_python () {
cd_clean_packages_cache () { cd_clean_packages_cache () {
cd_step "Clean packages cache" cd_step "Clean packages cache"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
"debian") apt-get clean || exit ;; "${CD_OS_DEBIAN}") apt-get clean || exit ;;
"alma") dnf clean all || exit ;; "${CD_OS_ALMA}") dnf clean all || exit ;;
esac esac
} }
@ -328,8 +328,8 @@ local variable="${1}"
cd_install_package () { cd_install_package () {
if [ "${1}" ] ; then if [ "${1}" ] ; then
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
"debian") apt-get install --assume-yes "${1}" || exit ;; "${CD_OS_DEBIAN}") apt-get install --assume-yes "${1}" || exit ;;
"alma") dnf install --assumeyes "${1}" || exit ;; "${CD_OS_ALMA}") dnf install --assumeyes "${1}" || exit ;;
esac esac
fi fi
} }
@ -388,5 +388,10 @@ local text="${2}"
fi fi
} }
# constants
CD_OS_ALMA="alma"
CD_OS_DEBIAN="debian"
# run # run
cd_main cd_main