Compare commits

..

No commits in common. "8739a7be34a4a741087bcf495edb9c53cbf76f62" and "44b4b5b3572d32410d8bd4c8b88c8ee70a562b65" have entirely different histories.

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_certificates cd_install_ca
cd_write_ca_certificates cd_copy_ca
cd_update_ca_certificates cd_update_ca
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"|"9") "8")
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,8 +112,6 @@ 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")
@ -124,11 +122,7 @@ 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") "alma") echo "TODO" ;;
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
} }
@ -186,31 +180,23 @@ cd_install_packages_tools () {
esac esac
} }
cd_install_ca_certificates () { cd_install_ca () {
cd_step "Install CA" cd_step "Install CA"
cd_install_package "${CD_CA_PACKAGE}" cd_install_package "${CD_CA_PACKAGE}"
} }
cd_write_ca_certificates () { cd_copy_ca () {
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
index=1 echo "TODO"
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_certificates () { cd_update_ca () {
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 ;;
@ -340,31 +326,13 @@ 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
} }