From 04d9661def29d37f50fa3ca186e0db86ace0e26c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 7 Jun 2024 10:26:18 +0200 Subject: [PATCH 01/31] " --- cd/__init__.py | 70 +++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/cd/__init__.py b/cd/__init__.py index befcf35..6b90987 100644 --- a/cd/__init__.py +++ b/cd/__init__.py @@ -6,7 +6,7 @@ import env from rwx import fs from rwx import ps -COMMANDS_PREFIX = 'cd-' +COMMANDS_PREFIX = "cd-" projects = Projects(os.environ) project = Project(projects) @@ -17,8 +17,8 @@ def cd_browse_workspace(): def cd_build_project(): - for extension in ['py', 'sh']: - path = os.path.join(project.root, f'build.{extension}') + for extension in ["py", "sh"]: + path = os.path.join(project.root, f"build.{extension}") if os.path.exists(path): ps.run(path) break @@ -27,14 +27,14 @@ def cd_build_project(): def cd_clone_branch(): - print(f'''\ + print(f"""\ {project.url} ↓ -''', end=str(), flush=True) - ps.run('git', - 'clone', - '--branch', project.branch, - '--', +""", end=str(), flush=True) + ps.run("git", + "clone", + "--branch", project.branch, + "--", project.url, project.root, ) @@ -42,25 +42,25 @@ def cd_clone_branch(): def cd_list_environment(): for variable, value in sorted(projects.environment.items()): - print(variable, '=', value) + print(variable, "=", value) def cd_synchronize(): - host = 'rwx.work' - source = 'out' - user = 'cd' + host = "rwx.work" + source = "out" + user = "cd" # root = os.sep.join([str(), user, project.branch, projects.group, project.name]) # - target = f'{user}@{host}:{root}' - ps.run('rsync', - '--archive', - '--delete-before', - '--verbose', - f'{source}/', - f'{target}/', - '--dry-run', + target = f"{user}@{host}:{root}" + ps.run("rsync", + "--archive", + "--delete-before", + "--verbose", + f"{source}/", + f"{target}/", + "--dry-run", ) @@ -84,38 +84,38 @@ def cat(file: str): def install_commands(path): - step('Install commands') - user = '/usr/local/bin' + step("Install commands") + user = "/usr/local/bin" for command in [ - 'browse-workspace', - 'build-project', - 'clone-branch', - 'list-environment', - 'synchronize', + "browse-workspace", + "build-project", + "clone-branch", + "list-environment", + "synchronize", ]: print(command) - os.symlink(path, os.path.join(user, f'{COMMANDS_PREFIX}{command}')) + os.symlink(path, os.path.join(user, f"{COMMANDS_PREFIX}{command}")) def set_ssh(*arguments): - step('Set SSH') + step("Set SSH") # ssh_key, ssh_hosts = arguments # - ssh_type = 'ed25519' + ssh_type = "ed25519" # - home = os.path.expanduser('~') + home = os.path.expanduser("~") # - ssh = os.path.join(home, '.ssh') + ssh = os.path.join(home, ".ssh") os.makedirs(ssh, exist_ok=True) os.chmod(ssh, 0o700) # - key = os.path.join(ssh, f'id_{ssh_type}') + key = os.path.join(ssh, f"id_{ssh_type}") if ssh_key: fs.write(key, ssh_key) os.chmod(key, 0o400) # - known = os.path.join(ssh, 'known_hosts') + known = os.path.join(ssh, "known_hosts") if ssh_hosts: fs.write(known, ssh_hosts) os.chmod(known, 0o400) From 9421afcedbe8b14bc57d72fd8187d3ff7ee5e48e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 7 Jun 2024 10:36:24 +0200 Subject: [PATCH 02/31] "" --- cd/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cd/__init__.py b/cd/__init__.py index 6b90987..4ea730e 100644 --- a/cd/__init__.py +++ b/cd/__init__.py @@ -30,7 +30,7 @@ def cd_clone_branch(): print(f"""\ {project.url} ↓ -""", end=str(), flush=True) +""", end="", flush=True) ps.run("git", "clone", "--branch", project.branch, @@ -50,7 +50,7 @@ def cd_synchronize(): source = "out" user = "cd" # - root = os.sep.join([str(), + root = os.sep.join(["", user, project.branch, projects.group, project.name]) # target = f"{user}@{host}:{root}" @@ -125,12 +125,12 @@ def set_ssh(*arguments): def open(*arguments): - print(env.CD_OPEN, end=str()) + print(env.CD_OPEN, end="") print(*arguments, flush=True) def shut(*arguments): - print(env.CD_SHUT, end=str()) + print(env.CD_SHUT, end="") print(*arguments, flush=True) From 1813a03803a5687aad4adb05bc2f5477633b30c2 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 7 Jun 2024 15:20:51 +0200 Subject: [PATCH 03/31] unused --- cd.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/cd.sh b/cd.sh index 5058593..80e40d9 100644 --- a/cd.sh +++ b/cd.sh @@ -373,7 +373,6 @@ Acquire::https::Verify-Peer False; } cd_set_packages_repositories () { -local expression local file cd_step "Set packages repositories" case "${CD_OS_ID}" in From 013d3bb8f387b6abda68c2afba3821ef70469531 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 7 Jun 2024 15:25:37 +0200 Subject: [PATCH 04/31] || --- cd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cd.sh b/cd.sh index 80e40d9..13141fd 100644 --- a/cd.sh +++ b/cd.sh @@ -442,7 +442,7 @@ cd_list_working_directory () { } cd_set_https_verification_off () { - if [ "${CD_CA}" -o "${CD_PM}" = "${CD_PM_APT}" ] ; then + if [ "${CD_CA}" ] || [ "${CD_PM}" = "${CD_PM_APT}" ] ; then cd_step "Set HTTPS verification off" cd_mkdir "$(dirname "${CD_PM_HTTPS_PATH}")" cd_write "${CD_PM_HTTPS_PATH}" "${CD_PM_HTTPS_TEXT}" From 1a6241033fd2fe503abc1181c2274af3d46fc468 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 7 Jun 2024 15:45:18 +0200 Subject: [PATCH 05/31] =?UTF-8?q?echo=20-n=20=E2=86=92=20printf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cd.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cd.sh b/cd.sh index 13141fd..833a7b9 100644 --- a/cd.sh +++ b/cd.sh @@ -548,7 +548,7 @@ local url for repository in "${CD_GIT_CHILD}" "${CD_GIT_PARENT}" ; do cd_split url="${CD_PROJECTS_URL}/${repository}" - echo -n "\ + printf "\ ${url} ↓ " @@ -556,7 +556,7 @@ ${url} "${url}" "${root}/${repository}" \ || exit path="${root}/${repository}/${repository}" - echo -n "\ + printf "\ ${path} ↓ ${CD_PYTHON_PACKAGES} @@ -589,7 +589,7 @@ local path cd_step "Switch to Python" # path="$(realpath "${0}")" - echo -n "\ + printf "\ ${path} ↓ ${CD_PYTHON_PACKAGES}/${CD_GIT_CHILD} @@ -623,7 +623,7 @@ cd_error_ci () { cd_error_os () { local variable="${1}" - echo -n "× OS: " + printf "× OS: " cd_echo "${variable}" exit ${CD_ERROR_OS} } @@ -709,7 +709,7 @@ cd_split () { cd_step () { CD_STEP=$((CD_STEP+1)) - echo -n "\ + printf "\ ${CD_DOWN} ${CD_VERT} ${CD_STEP} ${@} ${CD___UP} @@ -722,7 +722,7 @@ local text="${2}" if [ "${file}" ] ; then [ -f "${file}" ] && cd_cat "${file}" echo "→ ${1}" - echo -n "${text}" > "${file}" || exit + printf "${text}" > "${file}" || exit cd_cat "${file}" fi } From 6a93b10cf8cf5c80a724f71120d5f68c7cf29215 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 11:56:38 +0200 Subject: [PATCH 06/31] echo --- cd.sh | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/cd.sh b/cd.sh index 833a7b9..a59aa80 100644 --- a/cd.sh +++ b/cd.sh @@ -548,19 +548,17 @@ local url for repository in "${CD_GIT_CHILD}" "${CD_GIT_PARENT}" ; do cd_split url="${CD_PROJECTS_URL}/${repository}" - printf "\ + echo "\ ${url} -↓ -" +↓" git clone \ "${url}" "${root}/${repository}" \ || exit path="${root}/${repository}/${repository}" - printf "\ + echo "\ ${path} ↓ -${CD_PYTHON_PACKAGES} -" +${CD_PYTHON_PACKAGES}" cp --recursive \ "${path}" "${CD_PYTHON_PACKAGES}" \ || exit @@ -589,11 +587,10 @@ local path cd_step "Switch to Python" # path="$(realpath "${0}")" - printf "\ + echo "\ ${path} ↓ -${CD_PYTHON_PACKAGES}/${CD_GIT_CHILD} -" +${CD_PYTHON_PACKAGES}/${CD_GIT_CHILD}" "${CD_PYTHON_ALIAS}" -m "${CD_GIT_CHILD}" "${@}" } @@ -709,11 +706,10 @@ cd_split () { cd_step () { CD_STEP=$((CD_STEP+1)) - printf "\ + echo "\ ${CD_DOWN} ${CD_VERT} ${CD_STEP} ${@} -${CD___UP} -" +${CD___UP}" } cd_write () { @@ -722,7 +718,7 @@ local text="${2}" if [ "${file}" ] ; then [ -f "${file}" ] && cd_cat "${file}" echo "→ ${1}" - printf "${text}" > "${file}" || exit + printf "%s" "${text}" > "${file}" || exit cd_cat "${file}" fi } From be0f461304f9d6af6c449624a94838a4c42e5f31 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 12:05:37 +0200 Subject: [PATCH 07/31] cd_write --- cd.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cd.sh b/cd.sh index a59aa80..7c6b261 100644 --- a/cd.sh +++ b/cd.sh @@ -713,13 +713,14 @@ ${CD___UP}" } cd_write () { -local file="${1}" -local text="${2}" - if [ "${file}" ] ; then - [ -f "${file}" ] && cd_cat "${file}" - echo "→ ${1}" - printf "%s" "${text}" > "${file}" || exit - cd_cat "${file}" + cd_write__file="${1}" + cd_write__text="${2}" + # + if [ "${cd_write__file}" ] ; then + [ -f "${cd_write__file}" ] && cd_cat "${cd_write__file}" + echo "→ ${cd_write__file}" + printf "%s" "${cd_write__text}" > "${cd_write__file}" || exit + cd_cat "${cd_write__file}" fi } From 891d3a4067a9946b056e54e306ee0d1a8335cd37 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 12:14:52 +0200 Subject: [PATCH 08/31] =?UTF-8?q?${@}=20=E2=86=92=20${*}?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cd.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cd.sh b/cd.sh index 7c6b261..9ae374a 100644 --- a/cd.sh +++ b/cd.sh @@ -664,7 +664,7 @@ cd_mkdir () { } cd_open () { - echo "${CD_OPEN}${@}" + echo "${CD_OPEN}${*}" } cd_openssl () { @@ -697,7 +697,7 @@ shift } cd_shut () { - echo "${CD_SHUT}${@}" + echo "${CD_SHUT}${*}" } cd_split () { @@ -708,7 +708,7 @@ cd_step () { CD_STEP=$((CD_STEP+1)) echo "\ ${CD_DOWN} -${CD_VERT} ${CD_STEP} ${@} +${CD_VERT} ${CD_STEP} ${*} ${CD___UP}" } From 99af49e1a846313146e3687f7428a1ad3fee2274 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 12:18:39 +0200 Subject: [PATCH 09/31] cd_openssl --- cd.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cd.sh b/cd.sh index 9ae374a..ecb9f92 100644 --- a/cd.sh +++ b/cd.sh @@ -668,9 +668,12 @@ cd_open () { } cd_openssl () { -local file="${1}" - if [ -f "${file}" ] ; then - openssl x509 -noout -text -in "${file}" || exit + cd_openssl__file="${1}" + if [ -f "${cd_openssl__file}" ] ; then + openssl x509 \ + -in "${cd_openssl__file}" \ + -noout -text \ + || exit fi } From 1100cf423433f7e6a3a5c3bca7f579244c4b8118 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 12:32:21 +0200 Subject: [PATCH 10/31] cd_sed --- cd.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cd.sh b/cd.sh index ecb9f92..561dc0e 100644 --- a/cd.sh +++ b/cd.sh @@ -686,14 +686,14 @@ local path="${1}" } cd_sed () { -local expression -local file="${1}" -shift - if [ -f "${file}" ] ; then - cd_cat "${file}" - for expression in "${@}" ; do - sed --in-place "s${expression}g" "${file}" \ - && cd_cat "${file}" \ + cd_sed__file="${1}" + shift + # + if [ -f "${cd_sed__file}" ] ; then + cd_cat "${cd_sed__file}" + for cd_sed__regex in "${@}" ; do + sed --in-place "s${cd_sed__regex}g" "${cd_sed__file}" \ + && cd_cat "${cd_sed__file}" \ || exit done fi From 571497c5cfa4ac612e5bca06f2c6b39c8412754e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 12:35:51 +0200 Subject: [PATCH 11/31] cd_rm --- cd.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cd.sh b/cd.sh index 561dc0e..9445890 100644 --- a/cd.sh +++ b/cd.sh @@ -678,17 +678,16 @@ cd_openssl () { } cd_rm () { -local path="${1}" - if [ -e "${path}" ] ; then - echo "← ${path}" - rm -r "${path}" || exit + cd_rm__path="${1}" + if [ -e "${cd_rm__path}" ] ; then + echo "← ${cd_rm__path}" + rm -r "${cd_rm__path}" || exit fi } cd_sed () { cd_sed__file="${1}" shift - # if [ -f "${cd_sed__file}" ] ; then cd_cat "${cd_sed__file}" for cd_sed__regex in "${@}" ; do @@ -718,7 +717,6 @@ ${CD___UP}" cd_write () { cd_write__file="${1}" cd_write__text="${2}" - # if [ "${cd_write__file}" ] ; then [ -f "${cd_write__file}" ] && cd_cat "${cd_write__file}" echo "→ ${cd_write__file}" From 953fb8103210ec508f4b5a20bad5e9ed8088bf71 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 12:37:06 +0200 Subject: [PATCH 12/31] cd_mkdir --- cd.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cd.sh b/cd.sh index 9445890..1fda11b 100644 --- a/cd.sh +++ b/cd.sh @@ -657,9 +657,10 @@ cd_ls () { } cd_mkdir () { - if [ "${1}" ] ; then - echo "→ ${1}" - mkdir --parents "${1}" || exit + cd_mkdir__path="${1}" + if [ "${cd_mkdir__path}" ] ; then + echo "→ ${cd_mkdir__path}" + mkdir --parents "${cd_mkdir__path}" || exit fi } From ff58a3b3974865e66cead024c7f4d059e52362ec Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 12:42:10 +0200 Subject: [PATCH 13/31] cd_ls --- cd.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cd.sh b/cd.sh index 1fda11b..d1c14ad 100644 --- a/cd.sh +++ b/cd.sh @@ -649,10 +649,11 @@ local command="${1}" } cd_ls () { - if [ -d "${1}" ] ; then - cd_open "${1}" - ls -a -l "${1}" || exit - cd_shut "${1}" + cd_ls__path="${1}" + if [ "${cd_ls__path}" ] ; then + cd_open "${cd_ls__path}" + ls -a -l "${cd_ls__path}" || exit + cd_shut "${cd_ls__path}" fi } From 5217951380e41b39422cf545e68445e064d05b0d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 12:45:43 +0200 Subject: [PATCH 14/31] cd_ln_python --- cd.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cd.sh b/cd.sh index d1c14ad..804d963 100644 --- a/cd.sh +++ b/cd.sh @@ -641,10 +641,11 @@ cd_install_package () { } cd_ln_python () { -local command="${1}" - if [ "${command}" ] ; then - echo "→ ${CD_PYTHON_ALIAS} → ${command}" - ln -f -s "${command}" "/usr/bin/${CD_PYTHON_ALIAS}" || exit + cd_ln_python__command="${1}" + if [ "${cd_ln_python__command}" ] ; then + echo "→ ${CD_PYTHON_ALIAS} → ${cd_ln_python__command}" + ln -f -s "${cd_ln_python__command}" "/usr/bin/${CD_PYTHON_ALIAS}" \ + || exit fi } From 58262405bfc57fa96b7a10ae320de87b2a9cdd4b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 13:21:17 +0200 Subject: [PATCH 15/31] cd_install_package --- cd.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cd.sh b/cd.sh index 804d963..8c7e9c9 100644 --- a/cd.sh +++ b/cd.sh @@ -635,8 +635,9 @@ local variable="${1}" } cd_install_package () { - if [ "${1}" ] ; then - ${CD_PM_INSTALL} "${1}" || exit + cd_install_package__name="${1}" + if [ "${cd_install_package__name}" ] ; then + ${CD_PM_INSTALL} "${cd_install_package__name}" || exit fi } From 5e8dd6fec210315d4fb20e7c4d4ce38c155fea86 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 13:24:43 +0200 Subject: [PATCH 16/31] cd_grep_os --- cd.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cd.sh b/cd.sh index 8c7e9c9..bb50c68 100644 --- a/cd.sh +++ b/cd.sh @@ -626,10 +626,10 @@ local variable="${1}" } cd_grep_os () { -local variable="${1}" - if [ "${variable}" ] ; then - grep "^${variable}=" "/etc/os-release" \ - | sed "s|^${variable}=||" \ + cd_grep_os__variable="${1}" + if [ "${cd_grep_os__variable}" ] ; then + grep "^${cd_grep_os__variable}=" "/etc/os-release" \ + | sed "s|^${cd_grep_os__variable}=||" \ | sed "s|^\"\(.*\)\"$|\1|" fi } From d786c87a789d784294d09a05f074672562faa54f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 16:08:06 +0200 Subject: [PATCH 17/31] cd_error_ --- cd.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cd.sh b/cd.sh index bb50c68..e88fcac 100644 --- a/cd.sh +++ b/cd.sh @@ -614,14 +614,14 @@ local name } cd_error_ci () { - echo "× CI: ${1}" + echo "× CI: ${*}" exit ${CD_ERROR_CI} } cd_error_os () { -local variable="${1}" + cd_error_os__variable="${1}" printf "× OS: " - cd_echo "${variable}" + cd_echo "${cd_error_os__variable}" exit ${CD_ERROR_OS} } From a8be6fdf648b510df84b2c95d3113f5e7c18b182 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 16:09:18 +0200 Subject: [PATCH 18/31] cd_echo --- cd.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cd.sh b/cd.sh index e88fcac..f15b989 100644 --- a/cd.sh +++ b/cd.sh @@ -605,10 +605,9 @@ cd_cat () { } cd_echo () { -local name if [ "${1}" ] ; then - for name in "${@}" ; do - eval "echo ${name} = \\\"\${${name}}\\\"" + for cd_echo__name in "${@}" ; do + eval "echo ${cd_echo__name} = \\\"\${${cd_echo__name}}\\\"" done fi } From 17d22283f8bff393e91ff662a7f46147c468eb86 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 16:10:45 +0200 Subject: [PATCH 19/31] cd_cat --- cd.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cd.sh b/cd.sh index f15b989..5bec963 100644 --- a/cd.sh +++ b/cd.sh @@ -597,10 +597,11 @@ ${CD_PYTHON_PACKAGES}/${CD_GIT_CHILD}" # functions cd_cat () { - if [ -f "${1}" ] ; then - cd_open "${1}" - cat "${1}" || exit - cd_shut "${1}" + cd_cat__file="${1}" + if [ "${cd_cat__file}" ] ; then + cd_open "${cd_cat__file}" + cat "${cd_cat__file}" || exit + cd_shut "${cd_cat__file}" fi } From 2a19db986c55bcef909126d3c13999f9ded8dd4c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 16:21:46 +0200 Subject: [PATCH 20/31] cd_path --- cd.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cd.sh b/cd.sh index 5bec963..b12c1e7 100644 --- a/cd.sh +++ b/cd.sh @@ -40,6 +40,9 @@ cd_main () { cd_set_environment_variables () { cd_step "Set environment variables" + # set path + CD_PATH="$(realpath "${0}")" + cd_echo "CD_PATH" # set operating system id CD_OS_ID="$(cd_grep_os ID)" case "${CD_OS_ID}" in @@ -105,6 +108,7 @@ cd_set_environment_variables () { esac ;; esac + cd_split cd_echo "CD_OS_ID" "CD_OS_VERSION" # universal CD_DNS_FILE="/etc/resolv.conf" @@ -583,12 +587,9 @@ CD_STEP = $((CD_STEP+1)) } cd_switch_to_python () { -local path cd_step "Switch to Python" - # - path="$(realpath "${0}")" echo "\ -${path} +${CD_PATH} ↓ ${CD_PYTHON_PACKAGES}/${CD_GIT_CHILD}" "${CD_PYTHON_ALIAS}" -m "${CD_GIT_CHILD}" "${@}" From 5fdf986cde7dd660651e6dae00d684c11a99bd19 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 16:39:44 +0200 Subject: [PATCH 21/31] cd_write_ca_certificates --- cd.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/cd.sh b/cd.sh index b12c1e7..fe65ea1 100644 --- a/cd.sh +++ b/cd.sh @@ -480,20 +480,22 @@ cd_install_ca_certificates () { } cd_write_ca_certificates () { -local index -local path -local text cd_step "Write CA certificates" cd_mkdir "${CD_CA_ROOT}" - index=1 - eval "text=\"\${CD_CA_${index}}\"" - while [ "${text}" ] ; do - path="${CD_CA_ROOT}/${index}.crt" + cd_write_ca_certificates__index=1 + eval "cd_write_ca_certificates__text=\ +\"\${CD_CA_${cd_write_ca_certificates__index}}\"" + while [ "${cd_write_ca_certificates__text}" ] ; do + cd_write_ca_certificates__path="\ +${CD_CA_ROOT}/${cd_write_ca_certificates__index}.crt" cd_split - cd_write "${path}" "${text}" - cd_openssl "${path}" - index=$((index+1)) - eval "text=\"\${CD_CA_${index}}\"" + cd_write \ + "${cd_write_ca_certificates__path}" \ + "${cd_write_ca_certificates__text}" + cd_openssl "${cd_write_ca_certificates__path}" + cd_write_ca_certificates__index=$((cd_write_ca_certificates__index+1)) + eval "cd_write_ca_certificates__text=\ +\"\${CD_CA_${cd_write_ca_certificates__index}}\"" done } From 68c4444367ee27d9d62792af8f495c3b4d2c4108 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 17:15:53 +0200 Subject: [PATCH 22/31] cd_install_python_modules --- cd.sh | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/cd.sh b/cd.sh index fe65ea1..8823326 100644 --- a/cd.sh +++ b/cd.sh @@ -544,35 +544,38 @@ cd_clean_packages_cache () { } cd_install_python_modules () { -local path -local repository -local root -local url cd_step "Install Python modules" - root="$(mktemp --directory)" || exit - echo "→ ${root}" - for repository in "${CD_GIT_CHILD}" "${CD_GIT_PARENT}" ; do + cd_install_python_modules__root="$(mktemp --directory)" || exit + echo "→ ${cd_install_python_modules__root}" + for cd_install_python_modules__repository \ + in "${CD_GIT_CHILD}" "${CD_GIT_PARENT}" ; do cd_split - url="${CD_PROJECTS_URL}/${repository}" + cd_install_python_modules__url="\ +${CD_PROJECTS_URL}/${cd_install_python_modules__repository}" echo "\ -${url} +${cd_install_python_modules__url} ↓" git clone \ - "${url}" "${root}/${repository}" \ + "${cd_install_python_modules__url}" \ + "${cd_install_python_modules__root}\ +/${cd_install_python_modules__repository}" \ || exit - path="${root}/${repository}/${repository}" + cd_install_python_modules__path="\ +${cd_install_python_modules__root}\ +/${cd_install_python_modules__repository}\ +/${cd_install_python_modules__repository}" echo "\ -${path} +${cd_install_python_modules__path} ↓ ${CD_PYTHON_PACKAGES}" cp --recursive \ - "${path}" "${CD_PYTHON_PACKAGES}" \ + "${cd_install_python_modules__path}" "${CD_PYTHON_PACKAGES}" \ || exit done cd_split cd_ls "${CD_PYTHON_PACKAGES}" cd_split - cd_rm "${root}" + cd_rm "${cd_install_python_modules__root}" } cd_write_python_module () { From d2f060b6a151a7a3dc93354b0607c08158eaeeed Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 17:20:13 +0200 Subject: [PATCH 23/31] cd_set_dns_resolving --- cd.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cd.sh b/cd.sh index 8823326..eaba5d2 100644 --- a/cd.sh +++ b/cd.sh @@ -454,14 +454,13 @@ cd_set_https_verification_off () { } cd_set_dns_resolving () { -local server -local text="" cd_step "Set DNS resolving" - for server in ${CD_DNS} ; do - text="${text}nameserver ${server} + for cd_set_dns_resolving__server in ${CD_DNS} ; do + cd_set_dns_resolving__text="${cd_set_dns_resolving__text}\ +nameserver ${cd_set_dns_resolving__server} " done - cd_write "${CD_DNS_FILE}" "${text}" + cd_write "${CD_DNS_FILE}" "${cd_set_dns_resolving__text}" } cd_update_packages_catalog () { From 3c16e68d91d102eed23a3fa1b8949013e4c40da1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 17:28:38 +0200 Subject: [PATCH 24/31] cd_set_packages_repositories --- cd.sh | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/cd.sh b/cd.sh index eaba5d2..65571c1 100644 --- a/cd.sh +++ b/cd.sh @@ -377,29 +377,30 @@ Acquire::https::Verify-Peer False; } cd_set_packages_repositories () { -local file cd_step "Set packages repositories" case "${CD_OS_ID}" in "${CD_OS_ALMA}") case "${CD_OS_VERSION}" in - "8") file="/etc/yum.repos.d/almalinux.repo" ;; - "9") file="/etc/yum.repos.d/almalinux-baseos.repo" ;; + "8") \ +cd_set_packages_repositories__file="/etc/yum.repos.d/almalinux.repo" ;; + "9") \ +cd_set_packages_repositories__file="/etc/yum.repos.d/almalinux-baseos.repo" ;; esac - cd_sed "${file}" \ + cd_sed "${cd_set_packages_repositories__file}" \ "|^mirrorlist|# mirrorlist|" \ "|${CD_URL_DEFAULT}|${CD_URL_CHOSEN}|" \ "|^# baseurl|baseurl|" ;; "${CD_OS_ALPINE}") - file="/etc/apk/repositories" - cd_write "${file}" "\ + cd_set_packages_repositories__file="/etc/apk/repositories" + cd_write "${cd_set_packages_repositories__file}" "\ ${CD_URL_CHOSEN}/v${CD_OS_VERSION}/main ${CD_URL_CHOSEN}/v${CD_OS_VERSION}/community " ;; "${CD_OS_DEBIAN}") - file="/etc/apt/sources.list" - cd_write "${file}" "\ + cd_set_packages_repositories__file="/etc/apt/sources.list" + cd_write "${cd_set_packages_repositories__file}" "\ deb ${CD_URL_CHOSEN} ${CD_OS_VERSION} main deb ${CD_URL_CHOSEN} ${CD_OS_VERSION}-backports main deb ${CD_URL_CHOSEN} ${CD_OS_VERSION}-updates main @@ -408,17 +409,19 @@ deb ${CD_URL_CHOSEN}-security ${CD_OS_VERSION}-security main ;; "${CD_OS_ROCKY}") case "${CD_OS_VERSION}" in - "8") file="/etc/yum.repos.d/Rocky-BaseOS.repo" ;; - "9") file="/etc/yum.repos.d/rocky.repo" ;; + "8") \ +cd_set_packages_repositories__file="/etc/yum.repos.d/Rocky-BaseOS.repo" ;; + "9") \ +cd_set_packages_repositories__file="/etc/yum.repos.d/rocky.repo" ;; esac - cd_sed "${file}" \ + cd_sed "${cd_set_packages_repositories__file}" \ "|^mirrorlist|# mirrorlist|" \ "|${CD_URL_DEFAULT}|${CD_URL_CHOSEN}|" \ "|^#baseurl|baseurl|" ;; "${CD_OS_UBUNTU}") - file="/etc/apt/sources.list" - cd_write "${file}" "\ + cd_set_packages_repositories__file="/etc/apt/sources.list" + cd_write "${cd_set_packages_repositories__file}" "\ deb ${CD_URL_CHOSEN} ${CD_OS_VERSION} main deb ${CD_URL_CHOSEN} ${CD_OS_VERSION}-backports main deb ${CD_URL_CHOSEN} ${CD_OS_VERSION}-updates main From d73dd66251cfac6a6cbf681f5b6e09b973946b70 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 17:41:57 +0200 Subject: [PATCH 25/31] cd_project_url --- cd.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cd.sh b/cd.sh index 65571c1..470a666 100644 --- a/cd.sh +++ b/cd.sh @@ -359,7 +359,6 @@ Acquire::https::Verify-Peer False; [ "${CD_PROJECT_BRANCH}" ] || cd_error_ci "CD_PROJECT_BRANCH" # CD_PROJECTS_URL="${CD_SERVER_URL}/${CD_PROJECTS_GROUP}" - CD_PROJECT_URL="${CD_PROJECTS_URL}/${CD_PROJECT_NAME}" # cd_split cd_echo "CD_CA" @@ -367,7 +366,7 @@ Acquire::https::Verify-Peer False; cd_echo "CD_SERVER_URL" \ "CD_PROJECTS_GROUP" "CD_PROJECT_NAME" "CD_PROJECT_BRANCH" cd_split - cd_echo "CD_PROJECTS_URL" "CD_PROJECT_URL" + cd_echo "CD_PROJECTS_URL" # TODO move to Python case "${CD_PM}" in "${CD_PM_APK}"|"${CD_PM_APT}") CD_PKG_SSH="openssh-client" ;; From c5852824a360099d302f12b5cf09b1aebe8f8b32 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 18:11:41 +0200 Subject: [PATCH 26/31] -n --- cd.sh | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/cd.sh b/cd.sh index 470a666..9496890 100644 --- a/cd.sh +++ b/cd.sh @@ -1,11 +1,11 @@ #! /usr/bin/env sh # defaults -[ "${CD_DNS}" ] || CD_DNS="\ +[ -n "${CD_DNS}" ] || CD_DNS="\ 9.9.9.9 \ " -[ "${CD_GIT_CHILD}" ] || CD_GIT_CHILD="cd" -[ "${CD_GIT_PARENT}" ] || CD_GIT_PARENT="rwx" +[ -n "${CD_GIT_CHILD}" ] || CD_GIT_CHILD="cd" +[ -n "${CD_GIT_PARENT}" ] || CD_GIT_PARENT="rwx" # main cd_main () { @@ -260,28 +260,28 @@ Acquire::https::Verify-Peer False; CD_URL_CHOSEN="${CD_URL_DEFAULT}" case "${CD_OS_ID}" in "${CD_OS_ALMA}") - [ "${CD_URL_ALMA}" ] && CD_URL_CHOSEN="${CD_URL_ALMA}" + [ -n "${CD_URL_ALMA}" ] && CD_URL_CHOSEN="${CD_URL_ALMA}" ;; "${CD_OS_ALPINE}") - [ "${CD_URL_ALPINE}" ] && CD_URL_CHOSEN="${CD_URL_ALPINE}" + [ -n "${CD_URL_ALPINE}" ] && CD_URL_CHOSEN="${CD_URL_ALPINE}" ;; "${CD_OS_ARCH}") - [ "${CD_URL_ARCH}" ] && CD_URL_CHOSEN="${CD_URL_ARCH}" + [ -n "${CD_URL_ARCH}" ] && CD_URL_CHOSEN="${CD_URL_ARCH}" ;; "${CD_OS_DEBIAN}") - [ "${CD_URL_DEBIAN}" ] && CD_URL_CHOSEN="${CD_URL_DEBIAN}" \ + [ -n "${CD_URL_DEBIAN}" ] && CD_URL_CHOSEN="${CD_URL_DEBIAN}" \ || CD_URL_CHOSEN="https://deb.debian.org/debian" ;; "${CD_OS_FEDORA}") - [ "${CD_URL_FEDORA}" ] && CD_URL_CHOSEN="${CD_URL_FEDORA}" \ + [ -n "${CD_URL_FEDORA}" ] && CD_URL_CHOSEN="${CD_URL_FEDORA}" \ || CD_URL_CHOSEN="https://rpmfind.net/linux/fedora/linux/releases" ;; "${CD_OS_ROCKY}") - [ "${CD_URL_ROCKY}" ] && CD_URL_CHOSEN="${CD_URL_ROCKY}" \ + [ -n "${CD_URL_ROCKY}" ] && CD_URL_CHOSEN="${CD_URL_ROCKY}" \ || CD_URL_CHOSEN="https://dl.rockylinux.org/\$contentdir" ;; "${CD_OS_UBUNTU}") - [ "${CD_URL_UBUNTU}" ] && CD_URL_CHOSEN="${CD_URL_UBUNTU}" \ + [ -n "${CD_URL_UBUNTU}" ] && CD_URL_CHOSEN="${CD_URL_UBUNTU}" \ || CD_URL_CHOSEN="https://ubuntu.mirrors.ovh.net/ubuntu" ;; esac @@ -335,15 +335,15 @@ Acquire::https::Verify-Peer False; cd_split cd_echo "CD_PYTHON_COMMAND" "CD_PYTHON_PACKAGE" "CD_PYTHON_PACKAGES" # variables - [ "${CD_CA_1}" ] && CD_CA=true + [ -n "${CD_CA_1}" ] && CD_CA=true # continuous integration platform - if [ "${GITHUB_ACTIONS}" ] ; then + if [ -n "${GITHUB_ACTIONS}" ] ; then # github → gitea → forgejo CD_SERVER_URL="${GITHUB_SERVER_URL}" CD_PROJECTS_GROUP="$(dirname "${GITHUB_REPOSITORY}")" CD_PROJECT_NAME="$(basename "${GITHUB_REPOSITORY}")" CD_PROJECT_BRANCH="${GITHUB_REF_NAME}" - elif [ "${GITLAB_CI}" ] ; then + elif [ -n "${GITLAB_CI}" ] ; then # gitlab CD_SERVER_URL="${CI_SERVER_URL}" CD_PROJECTS_GROUP="$(dirname "${CI_PROJECT_PATH}")" @@ -353,10 +353,10 @@ Acquire::https::Verify-Peer False; # unsupported cd_error_ci "ø" fi - [ "${CD_SERVER_URL}" ] || cd_error_ci "CD_SERVER_URL" - [ "${CD_PROJECTS_GROUP}" ] || cd_error_ci "CD_PROJECTS_GROUP" - [ "${CD_PROJECT_NAME}" ] || cd_error_ci "CD_PROJECT_NAME" - [ "${CD_PROJECT_BRANCH}" ] || cd_error_ci "CD_PROJECT_BRANCH" + [ -n "${CD_SERVER_URL}" ] || cd_error_ci "CD_SERVER_URL" + [ -n "${CD_PROJECTS_GROUP}" ] || cd_error_ci "CD_PROJECTS_GROUP" + [ -n "${CD_PROJECT_NAME}" ] || cd_error_ci "CD_PROJECT_NAME" + [ -n "${CD_PROJECT_BRANCH}" ] || cd_error_ci "CD_PROJECT_BRANCH" # CD_PROJECTS_URL="${CD_SERVER_URL}/${CD_PROJECTS_GROUP}" # @@ -448,7 +448,7 @@ cd_list_working_directory () { } cd_set_https_verification_off () { - if [ "${CD_CA}" ] || [ "${CD_PM}" = "${CD_PM_APT}" ] ; then + if [ -n "${CD_CA}" ] || [ "${CD_PM}" = "${CD_PM_APT}" ] ; then cd_step "Set HTTPS verification off" cd_mkdir "$(dirname "${CD_PM_HTTPS_PATH}")" cd_write "${CD_PM_HTTPS_PATH}" "${CD_PM_HTTPS_TEXT}" @@ -486,7 +486,7 @@ cd_write_ca_certificates () { cd_write_ca_certificates__index=1 eval "cd_write_ca_certificates__text=\ \"\${CD_CA_${cd_write_ca_certificates__index}}\"" - while [ "${cd_write_ca_certificates__text}" ] ; do + while [ -n "${cd_write_ca_certificates__text}" ] ; do cd_write_ca_certificates__path="\ ${CD_CA_ROOT}/${cd_write_ca_certificates__index}.crt" cd_split @@ -605,7 +605,7 @@ ${CD_PYTHON_PACKAGES}/${CD_GIT_CHILD}" cd_cat () { cd_cat__file="${1}" - if [ "${cd_cat__file}" ] ; then + if [ -n "${cd_cat__file}" ] ; then cd_open "${cd_cat__file}" cat "${cd_cat__file}" || exit cd_shut "${cd_cat__file}" @@ -613,7 +613,7 @@ cd_cat () { } cd_echo () { - if [ "${1}" ] ; then + if [ -n "${1}" ] ; then for cd_echo__name in "${@}" ; do eval "echo ${cd_echo__name} = \\\"\${${cd_echo__name}}\\\"" done @@ -634,7 +634,7 @@ cd_error_os () { cd_grep_os () { cd_grep_os__variable="${1}" - if [ "${cd_grep_os__variable}" ] ; then + if [ -n "${cd_grep_os__variable}" ] ; then grep "^${cd_grep_os__variable}=" "/etc/os-release" \ | sed "s|^${cd_grep_os__variable}=||" \ | sed "s|^\"\(.*\)\"$|\1|" @@ -643,14 +643,14 @@ cd_grep_os () { cd_install_package () { cd_install_package__name="${1}" - if [ "${cd_install_package__name}" ] ; then + if [ -n "${cd_install_package__name}" ] ; then ${CD_PM_INSTALL} "${cd_install_package__name}" || exit fi } cd_ln_python () { cd_ln_python__command="${1}" - if [ "${cd_ln_python__command}" ] ; then + if [ -n "${cd_ln_python__command}" ] ; then echo "→ ${CD_PYTHON_ALIAS} → ${cd_ln_python__command}" ln -f -s "${cd_ln_python__command}" "/usr/bin/${CD_PYTHON_ALIAS}" \ || exit @@ -659,7 +659,7 @@ cd_ln_python () { cd_ls () { cd_ls__path="${1}" - if [ "${cd_ls__path}" ] ; then + if [ -n "${cd_ls__path}" ] ; then cd_open "${cd_ls__path}" ls -a -l "${cd_ls__path}" || exit cd_shut "${cd_ls__path}" @@ -668,7 +668,7 @@ cd_ls () { cd_mkdir () { cd_mkdir__path="${1}" - if [ "${cd_mkdir__path}" ] ; then + if [ -n "${cd_mkdir__path}" ] ; then echo "→ ${cd_mkdir__path}" mkdir --parents "${cd_mkdir__path}" || exit fi @@ -728,7 +728,7 @@ ${CD___UP}" cd_write () { cd_write__file="${1}" cd_write__text="${2}" - if [ "${cd_write__file}" ] ; then + if [ -n "${cd_write__file}" ] ; then [ -f "${cd_write__file}" ] && cd_cat "${cd_write__file}" echo "→ ${cd_write__file}" printf "%s" "${cd_write__text}" > "${cd_write__file}" || exit From 640d651a78d1f8d781d0d37b58820408e507a0cd Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 18:29:10 +0200 Subject: [PATCH 27/31] " --- cd.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cd.sh b/cd.sh index 9496890..7cd5837 100644 --- a/cd.sh +++ b/cd.sh @@ -622,14 +622,14 @@ cd_echo () { cd_error_ci () { echo "× CI: ${*}" - exit ${CD_ERROR_CI} + exit "${CD_ERROR_CI}" } cd_error_os () { cd_error_os__variable="${1}" printf "× OS: " cd_echo "${cd_error_os__variable}" - exit ${CD_ERROR_OS} + exit "${CD_ERROR_OS}" } cd_grep_os () { From a9c8aa6b541f91e99a59885becc0b04c436b3d75 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 19:15:47 +0200 Subject: [PATCH 28/31] cd_write_python_module --- cd.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/cd.sh b/cd.sh index 7cd5837..850307c 100644 --- a/cd.sh +++ b/cd.sh @@ -581,13 +581,15 @@ ${CD_PYTHON_PACKAGES}" cd_write_python_module () { cd_step "Write Python module" - cd_write "${CD_PYTHON_PACKAGES}/env.py" "\ -$(cd_echo CD_OPEN CD_DOWN) -$(cd_echo CD_VERT CD_SPLT) -$(cd_echo CD___UP CD_SHUT) - -$(cd_echo CD_OS_ID CD_OS_VERSION) - + for cd_write_python_module__variable \ + in OPEN DOWN VERT SPLT __UP SHUT OS_ID OS_VERSION ; do + cd_write_python_module__value="\ +$(cd_echo "CD_${cd_write_python_module__variable}")" + cd_write_python_module__text="${cd_write_python_module__text}\ +${cd_write_python_module__value} +" + done + cd_write "${CD_PYTHON_PACKAGES}/env.py" "${cd_write_python_module__text}\ CD_STEP = $((CD_STEP+1)) " } From 9450e7cb8ab770260adbc38ac8a1a3b6c0a49c18 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 19:21:59 +0200 Subject: [PATCH 29/31] cd_list_working_directory --- cd.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cd.sh b/cd.sh index 850307c..30f7de0 100644 --- a/cd.sh +++ b/cd.sh @@ -444,7 +444,8 @@ cd_set_packages_configuration () { cd_list_working_directory () { cd_step "List working directory" - cd_ls "$(realpath .)" + cd_list_working_directory__path="$(realpath .)" + cd_ls "${cd_list_working_directory__path}" } cd_set_https_verification_off () { From e6f9e2d0dd61dee9d3fabec9cfbfa286723e6e66 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 19:33:46 +0200 Subject: [PATCH 30/31] *) --- cd.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cd.sh b/cd.sh index 30f7de0..2ca6f20 100644 --- a/cd.sh +++ b/cd.sh @@ -372,6 +372,7 @@ Acquire::https::Verify-Peer False; "${CD_PM_APK}"|"${CD_PM_APT}") CD_PKG_SSH="openssh-client" ;; "${CD_PM_DNF}") CD_PKG_SSH="openssh-clients" ;; "${CD_PM_PACMAN}") CD_PKG_SSH="openssh" ;; + *) esac } @@ -384,6 +385,7 @@ cd_set_packages_repositories () { cd_set_packages_repositories__file="/etc/yum.repos.d/almalinux.repo" ;; "9") \ cd_set_packages_repositories__file="/etc/yum.repos.d/almalinux-baseos.repo" ;; + *) esac cd_sed "${cd_set_packages_repositories__file}" \ "|^mirrorlist|# mirrorlist|" \ @@ -412,6 +414,7 @@ deb ${CD_URL_CHOSEN}-security ${CD_OS_VERSION}-security main cd_set_packages_repositories__file="/etc/yum.repos.d/Rocky-BaseOS.repo" ;; "9") \ cd_set_packages_repositories__file="/etc/yum.repos.d/rocky.repo" ;; + *) esac cd_sed "${cd_set_packages_repositories__file}" \ "|^mirrorlist|# mirrorlist|" \ @@ -427,6 +430,7 @@ deb ${CD_URL_CHOSEN} ${CD_OS_VERSION}-updates main deb ${CD_URL_CHOSEN} ${CD_OS_VERSION}-security main " ;; + *) esac } @@ -437,6 +441,7 @@ cd_set_packages_configuration () { "${CD_OS_DEBIAN}"|"${CD_OS_UBUNTU}") export DEBIAN_FRONTEND="noninteractive" ;; + *) esac } From 76070daa431e3cf2ac7c8a3b864db2bb0951b3df Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 8 Jun 2024 19:44:32 +0200 Subject: [PATCH 31/31] *) --- cd.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cd.sh b/cd.sh index 2ca6f20..eddae10 100644 --- a/cd.sh +++ b/cd.sh @@ -68,6 +68,7 @@ cd_set_environment_variables () { "${CD_OS_DEBIAN}"|"${CD_OS_UBUNTU}") CD_OS_VERSION="$(cd_grep_os VERSION_CODENAME)" ;; + *) esac # check operating system version case "${CD_OS_ID}" in @@ -107,6 +108,7 @@ cd_set_environment_variables () { *) cd_error_os "CD_OS_VERSION" ;; esac ;; + *) esac cd_split cd_echo "CD_OS_ID" "CD_OS_VERSION" @@ -137,6 +139,7 @@ cd_set_environment_variables () { CD_CA_ROOT="/usr/local/share/ca-certificates" CD_CMD_CA="update-ca-certificates" ;; + *) esac cd_split cd_echo "CD_CA_ROOT" "CD_CMD_CA" @@ -154,6 +157,7 @@ cd_set_environment_variables () { "${CD_OS_ARCH}") CD_PM="${CD_PM_PACMAN}" ;; + *) esac cd_split cd_echo "CD_PM" @@ -227,6 +231,7 @@ Dir::Etc::SourceParts \"\"; Acquire::https::Verify-Peer False; " ;; + *) esac cd_split cd_echo "CD_PM_CLEAN" \ @@ -256,6 +261,7 @@ Acquire::https::Verify-Peer False; "${CD_OS_UBUNTU}") CD_URL_DEFAULT="http://archive.ubuntu.com/ubuntu" ;; + *) esac CD_URL_CHOSEN="${CD_URL_DEFAULT}" case "${CD_OS_ID}" in @@ -284,6 +290,7 @@ Acquire::https::Verify-Peer False; [ -n "${CD_URL_UBUNTU}" ] && CD_URL_CHOSEN="${CD_URL_UBUNTU}" \ || CD_URL_CHOSEN="https://ubuntu.mirrors.ovh.net/ubuntu" ;; + *) esac cd_split cd_echo "CD_URL_DEFAULT" "CD_URL_CHOSEN" @@ -305,6 +312,7 @@ Acquire::https::Verify-Peer False; case "${CD_OS_VERSION}" in "bookworm") CD_PYTHON_COMMAND="python3.11" ;; "bullseye") CD_PYTHON_COMMAND="python3.9" ;; + *) esac CD_PYTHON_PACKAGE="python3" ;; @@ -316,9 +324,11 @@ Acquire::https::Verify-Peer False; case "${CD_OS_VERSION}" in "noble") CD_PYTHON_COMMAND="python3.12" ;; "jammy") CD_PYTHON_COMMAND="python3.10" ;; + *) esac CD_PYTHON_PACKAGE="python3" ;; + *) esac # set python packages case "${CD_OS_ID}" in @@ -331,6 +341,7 @@ Acquire::https::Verify-Peer False; "${CD_OS_DEBIAN}"|"${CD_OS_UBUNTU}") CD_PYTHON_PACKAGES="/usr/lib/${CD_PYTHON_ALIAS}/dist-packages" ;; + *) esac cd_split cd_echo "CD_PYTHON_COMMAND" "CD_PYTHON_PACKAGE" "CD_PYTHON_PACKAGES"