From 903e203857caf9ab2842db440b969684aa35c048 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 29 Apr 2024 20:07:17 +0200 Subject: [PATCH 1/2] cd_cat --- cd.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cd.sh b/cd.sh index d4d7f2f..d7d9fd1 100644 --- a/cd.sh +++ b/cd.sh @@ -109,7 +109,6 @@ local text="" " done cd_write "${CD_DNS_FILE}" "${text}" - cd_cat "${CD_DNS_FILE}" } cd_set_packages_repositories () { @@ -122,7 +121,6 @@ deb https://deb.debian.org/debian bookworm-backports main deb https://deb.debian.org/debian bookworm-updates main deb https://deb.debian.org/debian-security bookworm-security main " - cd_cat "/etc/apt/sources.list" ;; "alma") echo "TODO" ;; *) cd_error_os "cd_set_packages_repositories" ;; @@ -141,7 +139,6 @@ APT::Install-Recommends False; APT::Install-Suggests False; Dir::Etc::SourceParts \"\"; " - cd_cat "/etc/apt/apt.conf.d/apt.conf" ;; "alma") mkdir "/etc/dnf/dnf.conf.d" || exit ;; *) cd_error_os "cd_set_packages_configuration" ;; @@ -155,13 +152,11 @@ cd_set_https_verification_off () { cd_write "/etc/apt/apt.conf.d/https" "\ Acquire::https::Verify-Peer False; " - cd_cat "/etc/apt/apt.conf.d/https" ;; "alma") cd_write "/etc/dnf/dnf.conf.d/https.conf" "\ sslverify=False " - cd_cat "/etc/dnf/dnf.conf.d/https.conf" ;; *) cd_error_os "cd_set_https_verification_off" ;; esac @@ -293,7 +288,7 @@ ${1} cd_cat () { if [ -f "${1}" ] ; then - echo "╭$(realpath "${1}")" + echo "╭ $(realpath "${1}")" cat "${1}" || exit fi } @@ -342,6 +337,7 @@ local text="${2}" echo -n "${text}" \ > "${file}" \ || exit + cd_cat "${file}" fi } From 58c689a05979722b563e004cfa696434d6f7fae1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 29 Apr 2024 20:16:14 +0200 Subject: [PATCH 2/2] cd_mkdir --- cd.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cd.sh b/cd.sh index d7d9fd1..bf7248a 100644 --- a/cd.sh +++ b/cd.sh @@ -140,7 +140,7 @@ APT::Install-Suggests False; Dir::Etc::SourceParts \"\"; " ;; - "alma") mkdir "/etc/dnf/dnf.conf.d" || exit ;; + "alma") cd_mkdir "/etc/dnf/dnf.conf.d" ;; *) cd_error_os "cd_set_packages_configuration" ;; esac } @@ -288,7 +288,7 @@ ${1} cd_cat () { if [ -f "${1}" ] ; then - echo "╭ $(realpath "${1}")" + echo " ↙ /etc╭ $(realpath "${1}")" cat "${1}" || exit fi } @@ -312,9 +312,16 @@ cd_install_package () { fi } +cd_mkdir () { + if [ "${1}" ] ; then + echo "→ ${1}" + mkdir --parents "${1}" || exit + fi +} + cd_rm () { if [ -e "${1}" ] ; then - echo "× $(realpath "${1}")" + echo "← $(realpath "${1}")" rm --recursive "${1}" || exit fi }