if → &&

This commit is contained in:
Marc Beninca 2024-06-24 21:57:44 +02:00
parent ccd2b803d8
commit 133b8babd8
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
2 changed files with 6 additions and 10 deletions

15
pidd.sh
View file

@ -372,9 +372,8 @@ Acquire::https::Verify-Peer False;
# github → gitea → forgejo # github → gitea → forgejo
if [ -n "${GITHUB_SERVER_URL}" ]; then if [ -n "${GITHUB_SERVER_URL}" ]; then
PIDD_PROJECT_ROOT="$(dirname "${GITHUB_SERVER_URL}")//" PIDD_PROJECT_ROOT="$(dirname "${GITHUB_SERVER_URL}")//"
if [ -n "${GITHUB_TOKEN}" ]; then [ -n "${GITHUB_TOKEN}" ] &&
PIDD_PROJECT_ROOT="${PIDD_PROJECT_ROOT}${GITHUB_TOKEN}@" PIDD_PROJECT_ROOT="${PIDD_PROJECT_ROOT}${GITHUB_TOKEN}@"
fi
PIDD_PROJECT_ROOT="${PIDD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")" PIDD_PROJECT_ROOT="${PIDD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")"
else else
pidd_error_ci "GITHUB_SERVER_URL" pidd_error_ci "GITHUB_SERVER_URL"
@ -701,11 +700,10 @@ pidd_error_os() {
pidd_grep_os() { pidd_grep_os() {
pidd_grep_os__variable="${1}" pidd_grep_os__variable="${1}"
if [ -n "${pidd_grep_os__variable}" ]; then [ -n "${pidd_grep_os__variable}" ] &&
grep "^${pidd_grep_os__variable}=" "/etc/os-release" | grep "^${pidd_grep_os__variable}=" "/etc/os-release" |
sed "s|^${pidd_grep_os__variable}=||" | sed "s|^${pidd_grep_os__variable}=||" |
sed "s|^\"\(.*\)\"$|\1|" sed "s|^\"\(.*\)\"$|\1|"
fi
} }
pidd_install_package() { pidd_install_package() {
@ -719,8 +717,8 @@ pidd_ln_python() {
pidd_ln_python__command="${1}" pidd_ln_python__command="${1}"
if [ -n "${pidd_ln_python__command}" ]; then if [ -n "${pidd_ln_python__command}" ]; then
echo "${PIDD_PYTHON_ALIAS}${pidd_ln_python__command}" echo "${PIDD_PYTHON_ALIAS}${pidd_ln_python__command}"
ln -f -s "${pidd_ln_python__command}" "/usr/bin/${PIDD_PYTHON_ALIAS}" || ln -f -s "${pidd_ln_python__command}" \
exit "/usr/bin/${PIDD_PYTHON_ALIAS}" || exit
fi fi
} }
@ -770,8 +768,7 @@ pidd_sed() {
pidd_cat "${pidd_sed__file}" pidd_cat "${pidd_sed__file}"
for pidd_sed__regex in "${@}"; do for pidd_sed__regex in "${@}"; do
sed --in-place "s${pidd_sed__regex}g" "${pidd_sed__file}" && sed --in-place "s${pidd_sed__regex}g" "${pidd_sed__file}" &&
pidd_cat "${pidd_sed__file}" || pidd_cat "${pidd_sed__file}" || exit
exit
done done
fi fi
} }

View file

@ -92,5 +92,4 @@ from various contexts of CA, CI and OCI / OS.
### .sh ### .sh
* reduce single conditions with &&
* support opensuse * support opensuse