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