Compare commits

...

7 commits

Author SHA1 Message Date
8739a7be34
alma/9
Some checks failed
/ job (push) Failing after 1m8s
2024-04-30 13:15:13 +02:00
54dd37f1c3
split,step 2024-04-30 12:36:33 +02:00
1998b57e89
_certificates 2024-04-30 12:31:56 +02:00
292d5e0c9e
cd_write_ca 2024-04-30 12:30:08 +02:00
3de8ea1b23
cd_sed 2024-04-29 23:07:52 +02:00
dac01bb13b
cd_cat 2024-04-29 22:43:51 +02:00
f27e5adbd3
repos 2024-04-29 22:41:28 +02:00

54
cd.sh
View file

@ -17,9 +17,9 @@ cd_main () {
cd_set_https_verification_off cd_set_https_verification_off
cd_update_packages_catalog cd_update_packages_catalog
cd_install_packages_tools cd_install_packages_tools
cd_install_ca cd_install_ca_certificates
cd_copy_ca cd_write_ca_certificates
cd_update_ca cd_update_ca_certificates
cd_set_https_verification_on cd_set_https_verification_on
cd_update_packages_catalog cd_update_packages_catalog
cd_upgrade_packages cd_upgrade_packages
@ -47,7 +47,7 @@ cd_set_environment () {
;; ;;
"alma") "alma")
case "${CD_OS_VERSION}" in case "${CD_OS_VERSION}" in
"8") "8"|"9")
CD_PYTHON_PACKAGE="python3.11" CD_PYTHON_PACKAGE="python3.11"
CD_PYTHON_PACKAGES="/usr/lib64/python3.11/site-packages" CD_PYTHON_PACKAGES="/usr/lib64/python3.11/site-packages"
;; ;;
@ -112,6 +112,8 @@ local text=""
} }
cd_set_packages_repositories () { cd_set_packages_repositories () {
local expression
local file
cd_step "Set packages repositories" cd_step "Set packages repositories"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
"debian") "debian")
@ -122,7 +124,11 @@ deb https://deb.debian.org/debian bookworm-updates main
deb https://deb.debian.org/debian-security bookworm-security main deb https://deb.debian.org/debian-security bookworm-security main
" "
;; ;;
"alma") echo "TODO" ;; "alma")
file="/etc/yum.repos.d/almalinux.repo"
cd_sed "${file}" "|^m|# m|" "|^# b|b|"
cd_cat "${file}"
;;
*) cd_error_os "cd_set_packages_repositories" ;; *) cd_error_os "cd_set_packages_repositories" ;;
esac esac
} }
@ -180,23 +186,31 @@ cd_install_packages_tools () {
esac esac
} }
cd_install_ca () { cd_install_ca_certificates () {
cd_step "Install CA" cd_step "Install CA"
cd_install_package "${CD_CA_PACKAGE}" cd_install_package "${CD_CA_PACKAGE}"
} }
cd_copy_ca () { cd_write_ca_certificates () {
local index
local target local target
local text
cd_step "Copy CA" cd_step "Copy CA"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
"debian") target="/usr/local/share/ca-certificates" ;; "debian") target="/usr/local/share/ca-certificates" ;;
"alma") target="/etc/pki/ca-trust/source/anchors" ;; "alma") target="/etc/pki/ca-trust/source/anchors" ;;
*) cd_error_os "cd_copy_ca" ;; *) cd_error_os "cd_copy_ca" ;;
esac esac
echo "TODO" index=1
eval "text=\${CD_CA_${index}}"
while [ "${text}" ] ; do
cd_write "${target}/${index}.crt" "${text}"
index=$((index+1))
eval "text=\${CD_CA_${index}}"
done
} }
cd_update_ca () { 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 ;; "debian") update-ca-certificates || exit ;;
@ -326,13 +340,31 @@ cd_rm () {
fi fi
} }
cd_sed () {
local expression
local file
if [ -f "${1}" ] ; then
file="${1}"
shift
for expression in "${@}" ; do
sed --in-place "s${expression}g" "${file}" || exit
done
fi
}
cd_split () {
echo -n "\
╶─╌╌┄┄┈┈
"
}
cd_step () { cd_step () {
if [ "${1}" ] ; then if [ "${1}" ] ; then
CD_STEP=$((CD_STEP+1)) CD_STEP=$((CD_STEP+1))
echo -n "\ echo -n "\
╭─╌┄┈ ╭─╌╌┄┄┈
${CD_STEP} ${1} ${CD_STEP} ${1}
╰─╌┄┈ ╰─╌╌┄┄┈
" "
fi fi
} }