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