↕
This commit is contained in:
parent
18e3f300d3
commit
cf99e6ff2f
2 changed files with 38 additions and 36 deletions
72
cd.sh
72
cd.sh
|
@ -42,14 +42,14 @@ cd_set_environment_variables () {
|
|||
[ "${CD_CA_1}" ] && CD_CA=true
|
||||
#
|
||||
case "$(cd_grep_os ID)" in
|
||||
"debian")
|
||||
CD_OS_ID="${CD_OS_DEBIAN}"
|
||||
CD_OS_VERSION="$(cd_grep_os VERSION_CODENAME)"
|
||||
;;
|
||||
"almalinux")
|
||||
CD_OS_ID="${CD_OS_ALMA}"
|
||||
CD_OS_VERSION="$(cd_grep_os VERSION_ID)"
|
||||
;;
|
||||
"debian")
|
||||
CD_OS_ID="${CD_OS_DEBIAN}"
|
||||
CD_OS_VERSION="$(cd_grep_os VERSION_CODENAME)"
|
||||
;;
|
||||
esac
|
||||
#
|
||||
CD_CA_PACKAGE="ca-certificates"
|
||||
|
@ -57,18 +57,6 @@ cd_set_environment_variables () {
|
|||
CD_GIT_PACKAGE="git"
|
||||
#
|
||||
case "${CD_OS_ID}" in
|
||||
"${CD_OS_DEBIAN}")
|
||||
CD_OS_REPO="${CD_DEFAULT_REPO_DEBIAN}"
|
||||
[ "${CD_REPO_DEBIAN}" ] && CD_OS_REPO="${CD_REPO_DEBIAN}"
|
||||
case "${CD_OS_VERSION}" in
|
||||
"bookworm"|"bullseye") cd_nop ;;
|
||||
*) cd_error_os "CD_OS_VERSION" ;;
|
||||
esac
|
||||
CD_CA_ROOT="/usr/local/share/ca-certificates"
|
||||
CD_PYTHON_COMMAND="python3"
|
||||
CD_PYTHON_PACKAGE="python3"
|
||||
CD_PYTHON_PACKAGES="/usr/lib/python3/dist-packages"
|
||||
;;
|
||||
"${CD_OS_ALMA}")
|
||||
CD_OS_REPO="${CD_DEFAULT_REPO_ALMA}"
|
||||
[ "${CD_REPO_ALMA}" ] && CD_OS_REPO="${CD_REPO_ALMA}"
|
||||
|
@ -81,6 +69,18 @@ cd_set_environment_variables () {
|
|||
CD_PYTHON_PACKAGE="python3.11"
|
||||
CD_PYTHON_PACKAGES="/usr/lib64/python3.11/site-packages"
|
||||
;;
|
||||
"${CD_OS_DEBIAN}")
|
||||
CD_OS_REPO="${CD_DEFAULT_REPO_DEBIAN}"
|
||||
[ "${CD_REPO_DEBIAN}" ] && CD_OS_REPO="${CD_REPO_DEBIAN}"
|
||||
case "${CD_OS_VERSION}" in
|
||||
"bookworm"|"bullseye") cd_nop ;;
|
||||
*) cd_error_os "CD_OS_VERSION" ;;
|
||||
esac
|
||||
CD_CA_ROOT="/usr/local/share/ca-certificates"
|
||||
CD_PYTHON_COMMAND="python3"
|
||||
CD_PYTHON_PACKAGE="python3"
|
||||
CD_PYTHON_PACKAGES="/usr/lib/python3/dist-packages"
|
||||
;;
|
||||
*) cd_error_os "CD_OS_ID" ;;
|
||||
esac
|
||||
# continuous integration platform
|
||||
|
@ -141,14 +141,6 @@ local expression
|
|||
local file
|
||||
cd_step "Set packages repositories"
|
||||
case "${CD_OS_ID}" in
|
||||
"${CD_OS_DEBIAN}")
|
||||
cd_write "/etc/apt/sources.list" "\
|
||||
deb ${CD_OS_REPO} ${CD_OS_VERSION} main
|
||||
deb ${CD_OS_REPO} ${CD_OS_VERSION}-backports main
|
||||
deb ${CD_OS_REPO} ${CD_OS_VERSION}-updates main
|
||||
deb ${CD_OS_REPO}-security ${CD_OS_VERSION}-security main
|
||||
"
|
||||
;;
|
||||
"${CD_OS_ALMA}")
|
||||
file="/etc/yum.repos.d/almalinux.repo"
|
||||
cd_sed "${file}" \
|
||||
|
@ -157,12 +149,21 @@ deb ${CD_OS_REPO}-security ${CD_OS_VERSION}-security main
|
|||
"|^# baseurl|baseurl|"
|
||||
cd_cat "${file}"
|
||||
;;
|
||||
"${CD_OS_DEBIAN}")
|
||||
cd_write "/etc/apt/sources.list" "\
|
||||
deb ${CD_OS_REPO} ${CD_OS_VERSION} main
|
||||
deb ${CD_OS_REPO} ${CD_OS_VERSION}-backports main
|
||||
deb ${CD_OS_REPO} ${CD_OS_VERSION}-updates main
|
||||
deb ${CD_OS_REPO}-security ${CD_OS_VERSION}-security main
|
||||
"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
cd_set_packages_configuration () {
|
||||
cd_step "Set packages configuration"
|
||||
case "${CD_OS_ID}" in
|
||||
"${CD_OS_ALMA}") cd_mkdir "/etc/dnf/dnf.conf.d" ;;
|
||||
"${CD_OS_DEBIAN}")
|
||||
export DEBIAN_FRONTEND="noninteractive"
|
||||
cd_write "/etc/apt/apt.conf.d/apt.conf" "\
|
||||
|
@ -173,7 +174,6 @@ APT::Install-Suggests False;
|
|||
Dir::Etc::SourceParts \"\";
|
||||
"
|
||||
;;
|
||||
"${CD_OS_ALMA}") cd_mkdir "/etc/dnf/dnf.conf.d" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
@ -181,14 +181,14 @@ cd_set_https_verification_off () {
|
|||
if [ "${CD_CA}" -o "${CD_OS_ID}" = "${CD_OS_DEBIAN}" ] ; then
|
||||
cd_step "Set HTTPS verification off"
|
||||
case "${CD_OS_ID}" in
|
||||
"${CD_OS_DEBIAN}")
|
||||
cd_write "/etc/apt/apt.conf.d/https" "\
|
||||
Acquire::https::Verify-Peer False;
|
||||
"
|
||||
;;
|
||||
"${CD_OS_ALMA}")
|
||||
cd_write "/etc/dnf/dnf.conf.d/https.conf" "\
|
||||
sslverify=False
|
||||
"
|
||||
;;
|
||||
"${CD_OS_DEBIAN}")
|
||||
cd_write "/etc/apt/apt.conf.d/https" "\
|
||||
Acquire::https::Verify-Peer False;
|
||||
"
|
||||
;;
|
||||
esac
|
||||
|
@ -198,16 +198,16 @@ sslverify=False
|
|||
cd_update_packages_catalog () {
|
||||
cd_step "Update packages catalog"
|
||||
case "${CD_OS_ID}" in
|
||||
"${CD_OS_DEBIAN}") apt-get update || exit ;;
|
||||
"${CD_OS_ALMA}") dnf makecache || exit ;;
|
||||
"${CD_OS_DEBIAN}") apt-get update || exit ;;
|
||||
esac
|
||||
}
|
||||
|
||||
cd_install_packages_tools () {
|
||||
cd_step "Install packages tools"
|
||||
case "${CD_OS_ID}" in
|
||||
"${CD_OS_DEBIAN}") cd_install_package "apt-utils" ;;
|
||||
"${CD_OS_ALMA}") cd_nop ;;
|
||||
"${CD_OS_DEBIAN}") cd_install_package "apt-utils" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
@ -233,8 +233,8 @@ local text
|
|||
cd_update_ca_certificates () {
|
||||
cd_step "Update CA"
|
||||
case "${CD_OS_ID}" in
|
||||
"${CD_OS_DEBIAN}") update-ca-certificates || exit ;;
|
||||
"${CD_OS_ALMA}") update-ca-trust || exit ;;
|
||||
"${CD_OS_DEBIAN}") update-ca-certificates || exit ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
@ -242,8 +242,8 @@ cd_set_https_verification_on () {
|
|||
if [ "${CD_CA}" -o "${CD_OS_ID}" = "${CD_OS_DEBIAN}" ] ; then
|
||||
cd_step "Set HTTPS verification on"
|
||||
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" ;;
|
||||
"${CD_OS_DEBIAN}") cd_rm "/etc/apt/apt.conf.d/https" ;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
@ -251,8 +251,8 @@ cd_set_https_verification_on () {
|
|||
cd_upgrade_packages () {
|
||||
cd_step "Upgrade packages"
|
||||
case "${CD_OS_ID}" in
|
||||
"${CD_OS_DEBIAN}") apt-get upgrade --assume-yes || exit ;;
|
||||
"${CD_OS_ALMA}") dnf upgrade --assumeyes || exit ;;
|
||||
"${CD_OS_DEBIAN}") apt-get upgrade --assume-yes || exit ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
@ -269,8 +269,8 @@ cd_install_python () {
|
|||
cd_clean_packages_cache () {
|
||||
cd_step "Clean packages cache"
|
||||
case "${CD_OS_ID}" in
|
||||
"${CD_OS_DEBIAN}") apt-get clean || exit ;;
|
||||
"${CD_OS_ALMA}") dnf clean all || exit ;;
|
||||
"${CD_OS_DEBIAN}") apt-get clean || exit ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@ from various CA, CI, OCI / OS.
|
|||
|
||||
## Tasks
|
||||
|
||||
* write bats
|
||||
|
||||
* handle cloning credentials
|
||||
* show CA certificates as text
|
||||
* write Python bootstrap
|
||||
|
|
Loading…
Reference in a new issue