()
Some checks failed
/ job (push) Failing after 8s

This commit is contained in:
Marc Beninca 2024-04-27 19:56:19 +02:00
parent bfba3700ee
commit 692f37fd4d
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

40
cd.sh
View file

@ -2,7 +2,7 @@
set 'cd' 'rwx' set 'cd' 'rwx'
function cd_main { cd_main () {
cd_set_environment cd_set_environment
cd_write_environment cd_write_environment
cd_set_dns_resolving \ cd_set_dns_resolving \
@ -23,7 +23,7 @@ function cd_main {
cd_bootstrap "${@}" cd_bootstrap "${@}"
} }
function cd_set_environment { cd_set_environment () {
CD_DNS_FILE='/etc/resolv.conf' CD_DNS_FILE='/etc/resolv.conf'
CD_ENV="$(mktemp)" CD_ENV="$(mktemp)"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
@ -83,7 +83,7 @@ function cd_set_environment {
CD_PROJECT_URL="${CD_PROJECTS_URL}/${CD_PROJECT_NAME}" CD_PROJECT_URL="${CD_PROJECTS_URL}/${CD_PROJECT_NAME}"
} }
function cd_write_environment { cd_write_environment () {
cd_write "${CD_ENV}" "{ cd_write "${CD_ENV}" "{
\"project\": { \"project\": {
\"branch\": \"${CD_PROJECT_BRANCH}\", \"branch\": \"${CD_PROJECT_BRANCH}\",
@ -99,7 +99,7 @@ function cd_write_environment {
cat "${CD_ENV}" cat "${CD_ENV}"
} }
function cd_step { cd_step () {
if [ "${1}" ] ; then if [ "${1}" ] ; then
CD_STEP=$((CD_STEP+1)) CD_STEP=$((CD_STEP+1))
echo " echo "
@ -108,7 +108,7 @@ function cd_step {
fi fi
} }
function cd_write { cd_write () {
local file="${1}" local file="${1}"
local text="${2}" local text="${2}"
if [ "${file}" ] ; then if [ "${file}" ] ; then
@ -118,7 +118,7 @@ local text="${2}"
fi fi
} }
function cd_set_dns_resolving { cd_set_dns_resolving () {
local server local server
local text='' local text=''
cd_step "${FUNCNAME}" cd_step "${FUNCNAME}"
@ -129,7 +129,7 @@ local text=''
cd_write "${CD_DNS_FILE}" "${text}" cd_write "${CD_DNS_FILE}" "${text}"
} }
function cd_set_packages_repositories { cd_set_packages_repositories () {
cd_step "${FUNCNAME}" cd_step "${FUNCNAME}"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
'debian') 'debian')
@ -144,7 +144,7 @@ deb https://deb.debian.org/debian-security bookworm-security main
esac esac
} }
function cd_set_packages_configuration { cd_set_packages_configuration () {
cd_step "${FUNCNAME}" cd_step "${FUNCNAME}"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
'debian') 'debian')
@ -161,7 +161,7 @@ Dir::Etc::SourceParts \"\";
esac esac
} }
function cd_set_https_verification_off { cd_set_https_verification_off () {
cd_step "${FUNCNAME}" cd_step "${FUNCNAME}"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
'debian') 'debian')
@ -173,7 +173,7 @@ Acquire::https::Verify-Peer False;
esac esac
} }
function cd_update_packages_catalog { cd_update_packages_catalog () {
cd_step "${FUNCNAME}" cd_step "${FUNCNAME}"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
'debian') apt-get update || exit ;; 'debian') apt-get update || exit ;;
@ -181,7 +181,7 @@ function cd_update_packages_catalog {
esac esac
} }
function cd_install_package { cd_install_package () {
if [ "${1}" ] ; then if [ "${1}" ] ; then
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
'debian') apt-get install --yes "${1}" || exit ;; 'debian') apt-get install --yes "${1}" || exit ;;
@ -190,7 +190,7 @@ function cd_install_package {
fi fi
} }
function cd_install_ca { cd_install_ca () {
cd_step "${FUNCNAME}" cd_step "${FUNCNAME}"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
'debian') cd_install_package 'ca-certificates' ;; 'debian') cd_install_package 'ca-certificates' ;;
@ -198,7 +198,7 @@ function cd_install_ca {
esac esac
} }
function cd_install_git { cd_install_git () {
cd_step "${FUNCNAME}" cd_step "${FUNCNAME}"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
'debian') cd_install_package 'git' ;; 'debian') cd_install_package 'git' ;;
@ -206,7 +206,7 @@ function cd_install_git {
esac esac
} }
function cd_install_packages_tools { cd_install_packages_tools () {
cd_step "${FUNCNAME}" cd_step "${FUNCNAME}"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
'debian') cd_install_package 'apt-utils' ;; 'debian') cd_install_package 'apt-utils' ;;
@ -214,7 +214,7 @@ function cd_install_packages_tools {
esac esac
} }
function cd_install_python { cd_install_python () {
cd_step "${FUNCNAME}" cd_step "${FUNCNAME}"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
'debian') cd_install_package 'python3' ;; 'debian') cd_install_package 'python3' ;;
@ -222,7 +222,7 @@ function cd_install_python {
esac esac
} }
function cd_set_https_verification_on { cd_set_https_verification_on () {
cd_step "${FUNCNAME}" cd_step "${FUNCNAME}"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
'debian') rm '/etc/apt/apt.conf.d/https' ;; 'debian') rm '/etc/apt/apt.conf.d/https' ;;
@ -230,7 +230,7 @@ function cd_set_https_verification_on {
esac esac
} }
function cd_upgrade_packages { cd_upgrade_packages () {
cd_step "${FUNCNAME}" cd_step "${FUNCNAME}"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
'debian') apt-get upgrade --yes || exit ;; 'debian') apt-get upgrade --yes || exit ;;
@ -238,7 +238,7 @@ function cd_upgrade_packages {
esac esac
} }
function cd_clean_packages_cache { cd_clean_packages_cache () {
cd_step "${FUNCNAME}" cd_step "${FUNCNAME}"
case "${CD_OS_NAME}" in case "${CD_OS_NAME}" in
'debian') apt-get clean || exit ;; 'debian') apt-get clean || exit ;;
@ -246,7 +246,7 @@ function cd_clean_packages_cache {
esac esac
} }
function cd_install { cd_install () {
local repository local repository
local root local root
cd_step "${FUNCNAME}" cd_step "${FUNCNAME}"
@ -262,7 +262,7 @@ local root
rm --force --recursive "${root}" || exit rm --force --recursive "${root}" || exit
} }
function cd_bootstrap { cd_bootstrap () {
cd_step "${FUNCNAME}" cd_step "${FUNCNAME}"
"${CD_PYTHON_COMMAND}" -m "${1}" "${CD_PYTHON_COMMAND}" -m "${1}"
} }