From 4ed8c776d4323de6a5cac406dbec355b3010c7d8 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 29 Apr 2024 11:42:11 +0200 Subject: [PATCH] error_os --- cd.sh | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/cd.sh b/cd.sh index a85860c..06ab309 100644 --- a/cd.sh +++ b/cd.sh @@ -38,16 +38,10 @@ cd_set_environment () { "bookworm") echo "TODO" ;; - *) - echo "CD_OS_VERSION" - exit 2 - ;; + *) cd_error_os "CD_OS_VERSION=" ;; esac ;; - *) - echo "CD_OS_NAME" - exit 1 - ;; + *) cd_error_os "CD_OS_NAME=" ;; esac # ci / github if [ "${GITHUB_ACTIONS}" ] ; then @@ -117,7 +111,7 @@ deb https://deb.debian.org/debian-security bookworm-security main " cd_cat "/etc/apt/sources.list" ;; - *) exit 1 ;; + *) cd_error_os "cd_set_packages_repositories" ;; esac } @@ -135,7 +129,7 @@ Dir::Etc::SourceParts \"\"; " cd_cat "/etc/apt/apt.conf.d/apt.conf" ;; - *) exit 1 ;; + *) cd_error_os "cd_set_packages_configuration" ;; esac } @@ -148,7 +142,7 @@ Acquire::https::Verify-Peer False; " cd_cat "/etc/apt/apt.conf.d/https" ;; - *) exit 1 ;; + *) cd_error_os "cd_set_https_verification_off" ;; esac } @@ -156,7 +150,7 @@ cd_update_packages_catalog () { cd_step "Update packages catalog" case "${CD_OS_NAME}" in "debian") apt-get update || exit ;; - *) exit 1 ;; + *) cd_error_os "cd_update_packages_catalog" ;; esac } @@ -164,7 +158,7 @@ cd_install_packages_tools () { cd_step "Install packages tools" case "${CD_OS_NAME}" in "debian") cd_install_package "apt-utils" ;; - *) exit 1 ;; + *) cd_error_os "cd_install_packages_tools" ;; esac } @@ -172,7 +166,7 @@ cd_install_ca () { cd_step "Install CA" case "${CD_OS_NAME}" in "debian") cd_install_package "ca-certificates" ;; - *) exit 1 ;; + *) cd_error_os "cd_install_ca" ;; esac } @@ -181,7 +175,7 @@ local target cd_step "Copy CA" case "${CD_OS_NAME}" in "debian") target="/usr/local/share/ca-certificates" ;; - *) exit 1 ;; + *) cd_error_os "cd_copy_ca" ;; esac # TODO copy } @@ -190,7 +184,7 @@ cd_update_ca () { cd_step "Update CA" case "${CD_OS_NAME}" in "debian") update-ca-certificates || exit ;; - *) exit 1 ;; + *) cd_error_os "cd_update_ca" ;; esac } @@ -198,7 +192,7 @@ cd_set_https_verification_on () { cd_step "Set HTTPS verification on" case "${CD_OS_NAME}" in "debian") cd_rm "/etc/apt/apt.conf.d/https" ;; - *) exit 1 ;; + *) cd_error_os "cd_set_https_verification_on" ;; esac } @@ -206,7 +200,7 @@ cd_upgrade_packages () { cd_step "Upgrade packages" case "${CD_OS_NAME}" in "debian") apt-get upgrade --yes || exit ;; - *) exit 1 ;; + *) cd_error_os "cd_upgrade_packages" ;; esac } @@ -214,7 +208,7 @@ cd_install_git () { cd_step "Install Git" case "${CD_OS_NAME}" in "debian") cd_install_package "git" ;; - *) exit 1 ;; + *) cd_error_os "cd_install_git" ;; esac } @@ -222,7 +216,7 @@ cd_install_python () { cd_step "Install Python" case "${CD_OS_NAME}" in "debian") cd_install_package "python3" ;; - *) exit 1 ;; + *) cd_error_os "cd_install_python" ;; esac } @@ -230,7 +224,7 @@ cd_clean_packages_cache () { cd_step "Clean packages cache" case "${CD_OS_NAME}" in "debian") apt-get clean || exit ;; - *) exit 1 ;; + *) cd_error_os "cd_clean_packages_cache" ;; esac }