From 672b10b6fbe4ce185f804ec1809c38d5043b40f4 Mon Sep 17 00:00:00 2001 From: Tobias Powalowski Date: Thu, 25 Jul 2024 07:48:17 +0200 Subject: [PATCH] shellcheck fixes --- usr/bin/archboot-clock.sh | 1 + usr/bin/archboot-pacsetup.sh | 7 ++++--- usr/bin/archboot-server-update.sh | 2 +- usr/bin/archboot-testsuite.sh | 1 + usr/lib/archboot/common.sh | 10 ++++------ 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/usr/bin/archboot-clock.sh b/usr/bin/archboot-clock.sh index 5f99d0c0f..95e463305 100755 --- a/usr/bin/archboot-clock.sh +++ b/usr/bin/archboot-clock.sh @@ -54,6 +54,7 @@ _timeset() { _dialog --title " Time " --no-cancel --timebox "Use to navigate and up/down to change values." 0 0 2>"${_ANSWER}" _TIME="$(cat "${_ANSWER}")" # save the time + #shellcheck disable=SC2027 _DATETIME=""${_DATE}" "${_TIME}"" timedatectl set-time "${_DATETIME}" _SET_TIME="1" diff --git a/usr/bin/archboot-pacsetup.sh b/usr/bin/archboot-pacsetup.sh index 179105781..37d480779 100755 --- a/usr/bin/archboot-pacsetup.sh +++ b/usr/bin/archboot-pacsetup.sh @@ -59,13 +59,14 @@ _select_mirror() { fi } +#shellcheck disable=SC2120 _enable_testing() { + _DOTESTING="" if ! rg -q "^\[.*testing\]" /etc/pacman.conf; then - _DOTESTING="" - _dialog --title " Testing Repositories " --defaultno --yesno "Do you want to enable testing repositories?\n\nOnly enable this if you need latest\navailable packages for testing purposes!" 8 50 && _DOTESTING=1 - if [[ -n "${_DOTESTING}" ]]; then + if _dialog --title " Testing Repositories " --defaultno --yesno "Do you want to enable testing repositories?\n\nOnly enable this if you need latest\navailable packages for testing purposes!" 8 50; then #shellcheck disable=SC2016 sd '^#(\[[c,e].*-testing\]\n)#' '$1' "${1}/etc/pacman.conf" + _DOTESTING=1 fi else _DOTESTING=1 diff --git a/usr/bin/archboot-server-update.sh b/usr/bin/archboot-server-update.sh index 6219d9a62..802b12f07 100755 --- a/usr/bin/archboot-server-update.sh +++ b/usr/bin/archboot-server-update.sh @@ -4,7 +4,7 @@ . /etc/archboot/defaults . /etc/archboot/server-update.conf [[ -d "${_ISO_HOME_CHROOTS}" ]] || mkdir -p "${_ISO_HOME_CHROOTS}" -cd "${_ISO_HOME_CHROOTS}" +cd "${_ISO_HOME_CHROOTS}" || exit 1 # stop if MASK is set [[ -e MASK ]] && exit 0 for i in ${_SERVER_ARCH}; do diff --git a/usr/bin/archboot-testsuite.sh b/usr/bin/archboot-testsuite.sh index fa422ce52..04cad0e23 100755 --- a/usr/bin/archboot-testsuite.sh +++ b/usr/bin/archboot-testsuite.sh @@ -86,6 +86,7 @@ _result fw-error.log # uninstall base again! pacman --noconfirm -Rdd base gettext &>>"${_LOG}" _run_test "licenses" +#shellcheck disable=SC2046 for i in $(pacman -Ql $(pacman -Q | sd ' .*' '') | rg -o '/usr/share/licenses/.*'); do [[ -e "${i}" ]] || echo "${i}" | rg -v '/xz/' >>license-error.log done diff --git a/usr/lib/archboot/common.sh b/usr/lib/archboot/common.sh index 2279fb7f7..4e119eefd 100644 --- a/usr/lib/archboot/common.sh +++ b/usr/lib/archboot/common.sh @@ -250,19 +250,17 @@ _fix_network() { _create_archboot_db() { echo "Creating reproducible repository db..." - pushd ${1} >"${_NO_LOG}" || return 1 + pushd "${1}" >"${_NO_LOG}" || return 1 #shellcheck disable=SC2046 LC_ALL=C.UTF-8 fd -u -t f -E '*.sig' . -X repo-add -q archboot.db.tar for i in archboot.{db.tar,files.tar}; do mkdir repro - cd repro - bsdtar -xf ../${i} || return 1 - fd . -u --min-depth 1 -X touch -hcd "@0" - fd --strip-cwd-prefix -t f -t l -u --min-depth 1 -0 | sort -z | + bsdtar -C repro -xf "${i}" || return 1 + fd --base-directory repro . -u --min-depth 1 -X touch -hcd "@0" + fd --base-directory repro --strip-cwd-prefix -t f -t l -u --min-depth 1 -0 | sort -z | LC_ALL=C.UTF-8 bsdtar --null -cnf - -T - | LC_ALL=C.UTF-8 bsdtar --null -cf - --format=gnutar @- | zstd -T0 -19 >> "../${i}.zst" || return 1 - cd .. rm -r repro done rm archboot.{db,files}