This commit is contained in:
Marc Beninca 2024-05-03 12:45:25 +02:00
parent 3abf55f721
commit 231c841105
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

26
cd.sh
View file

@ -43,7 +43,7 @@ local variable
CD_GIT_PACKAGE="git"
CD_PYTHON_COMMAND="python3"
#
case "${CD_OS_NAME}" in
case "${CD_OS_ID}" in
"${CD_OS_DEBIAN}")
case "${CD_OS_VERSION}" in
"bookworm"|"bullseye") cd_nop ;;
@ -62,7 +62,7 @@ local variable
CD_PYTHON_PACKAGE="python3.11"
CD_PYTHON_PACKAGES="/usr/lib64/python3.11/site-packages"
;;
*) cd_error_os "CD_OS_NAME" ;;
*) cd_error_os "CD_OS_ID" ;;
esac
# ci / github
if [ "${GITHUB_ACTIONS}" ] ; then
@ -89,7 +89,7 @@ local variable
CD_PROJECTS_URL="${CD_SERVER_URL}/${CD_PROJECTS_GROUP}"
CD_PROJECT_URL="${CD_PROJECTS_URL}/${CD_PROJECT_NAME}"
#
cd_echo "CD_OS_NAME" "CD_OS_VERSION"
cd_echo "CD_OS_ID" "CD_OS_VERSION"
cd_split
cd_echo "CD_DNS_FILE"
cd_split
@ -118,7 +118,7 @@ cd_set_packages_repositories () {
local expression
local file
cd_step "Set packages repositories"
case "${CD_OS_NAME}" in
case "${CD_OS_ID}" in
"${CD_OS_DEBIAN}")
cd_write "/etc/apt/sources.list" "\
deb https://deb.debian.org/debian ${CD_OS_VERSION} main
@ -137,7 +137,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
case "${CD_OS_ID}" in
"${CD_OS_DEBIAN}")
export DEBIAN_FRONTEND="noninteractive"
cd_write "/etc/apt/apt.conf.d/apt.conf" "\
@ -170,7 +170,7 @@ local text
cd_set_https_verification_off () {
if [ "${CD_CA}" ] ; then
cd_step "Set HTTPS verification off"
case "${CD_OS_NAME}" in
case "${CD_OS_ID}" in
"${CD_OS_DEBIAN}")
cd_write "/etc/apt/apt.conf.d/https" "\
Acquire::https::Verify-Peer False;
@ -187,7 +187,7 @@ sslverify=False
cd_update_packages_catalog () {
cd_step "Update packages catalog"
case "${CD_OS_NAME}" in
case "${CD_OS_ID}" in
"${CD_OS_DEBIAN}") apt-get update || exit ;;
"${CD_OS_ALMA}") dnf makecache || exit ;;
esac
@ -195,7 +195,7 @@ cd_update_packages_catalog () {
cd_install_packages_tools () {
cd_step "Install packages tools"
case "${CD_OS_NAME}" in
case "${CD_OS_ID}" in
"${CD_OS_DEBIAN}") cd_install_package "apt-utils" ;;
"${CD_OS_ALMA}") echo "TODO" ;;
esac
@ -208,7 +208,7 @@ cd_install_ca_certificates () {
cd_update_ca_certificates () {
cd_step "Update CA"
case "${CD_OS_NAME}" in
case "${CD_OS_ID}" in
"${CD_OS_DEBIAN}") update-ca-certificates || exit ;;
"${CD_OS_ALMA}") update-ca-trust || exit ;;
esac
@ -217,7 +217,7 @@ cd_update_ca_certificates () {
cd_set_https_verification_on () {
if [ "${CD_CA}" ] ; then
cd_step "Set HTTPS verification on"
case "${CD_OS_NAME}" in
case "${CD_OS_ID}" in
"${CD_OS_DEBIAN}") cd_rm "/etc/apt/apt.conf.d/https" ;;
"${CD_OS_ALMA}") cd_rm "/etc/dnf/dnf.conf.d/https.conf" ;;
esac
@ -226,7 +226,7 @@ cd_set_https_verification_on () {
cd_upgrade_packages () {
cd_step "Upgrade packages"
case "${CD_OS_NAME}" in
case "${CD_OS_ID}" in
"${CD_OS_DEBIAN}") apt-get upgrade --assume-yes || exit ;;
"${CD_OS_ALMA}") dnf upgrade --assumeyes || exit ;;
esac
@ -244,7 +244,7 @@ cd_install_python () {
cd_clean_packages_cache () {
cd_step "Clean packages cache"
case "${CD_OS_NAME}" in
case "${CD_OS_ID}" in
"${CD_OS_DEBIAN}") apt-get clean || exit ;;
"${CD_OS_ALMA}") dnf clean all || exit ;;
esac
@ -335,7 +335,7 @@ local variable="${1}"
cd_install_package () {
if [ "${1}" ] ; then
case "${CD_OS_NAME}" in
case "${CD_OS_ID}" in
"${CD_OS_DEBIAN}") apt-get install --assume-yes "${1}" || exit ;;
"${CD_OS_ALMA}") dnf install --assumeyes "${1}" || exit ;;
esac