Commit 27fe6708 authored by Kristian Klausen's avatar Kristian Klausen 🎉
Browse files

Fix shellcheck complains due to new version

Shellcheck v0.7.2[1] added more checks resulting in the following
complains in our case:
In build-host.sh line 12:
  readonly TMPDIR="$(mktemp --dry-run --directory --tmpdir="${PWD}/tmp")"
           ^----^ SC2155: Declare and assign separately to avoid masking return values.
In build-inside-vm.sh line 16:
  readonly TMPDIR="$(mktemp --dry-run --directory --tmpdir="${PWD}/tmp")"
           ^----^ SC2155: Declare and assign separately to avoid masking return values.
In build-inside-vm.sh line 19:
    chown "${SUDO_UID}:${SUDO_GID}" "${OUTPUT}" "${TMPDIR}"
                       ^---------^ SC2153: Possible misspelling: SUDO_GID may not be assigned, but SUDO_UID is.

[1] https://github.com/koalaman/shellcheck/blob/331e89be990547b6e21ad1b6e56065bcda1ba053/CHANGELOG.md#v072---2021-04-19
parent 53b1c79f
...@@ -9,7 +9,9 @@ readonly MIRROR="https://mirror.pkgbuild.com" ...@@ -9,7 +9,9 @@ readonly MIRROR="https://mirror.pkgbuild.com"
function init() { function init() {
readonly ORIG_PWD="${PWD}" readonly ORIG_PWD="${PWD}"
readonly OUTPUT="${PWD}/output" readonly OUTPUT="${PWD}/output"
readonly TMPDIR="$(mktemp --dry-run --directory --tmpdir="${PWD}/tmp")" local tmpdir
tmpdir="$(mktemp --dry-run --directory --tmpdir="${PWD}/tmp")"
readonly TMPDIR="${tmpdir}"
mkdir -p "${OUTPUT}" "${TMPDIR}" mkdir -p "${OUTPUT}" "${TMPDIR}"
cd "${TMPDIR}" cd "${TMPDIR}"
......
...@@ -13,9 +13,11 @@ readonly MIRROR='https://mirror.pkgbuild.com/$repo/os/$arch' ...@@ -13,9 +13,11 @@ readonly MIRROR='https://mirror.pkgbuild.com/$repo/os/$arch'
function init() { function init() {
readonly ORIG_PWD="${PWD}" readonly ORIG_PWD="${PWD}"
readonly OUTPUT="${PWD}/output" readonly OUTPUT="${PWD}/output"
readonly TMPDIR="$(mktemp --dry-run --directory --tmpdir="${PWD}/tmp")" local tmpdir
tmpdir="$(mktemp --dry-run --directory --tmpdir="${PWD}/tmp")"
readonly TMPDIR="${tmpdir}"
mkdir -p "${OUTPUT}" "${TMPDIR}" mkdir -p "${OUTPUT}" "${TMPDIR}"
if [ -n "${SUDO_UID:-}" ]; then if [ -n "${SUDO_UID:-}" ] && [[ -n "${SUDO_GID:-}" ]]; then
chown "${SUDO_UID}:${SUDO_GID}" "${OUTPUT}" "${TMPDIR}" chown "${SUDO_UID}:${SUDO_GID}" "${OUTPUT}" "${TMPDIR}"
fi fi
cd "${TMPDIR}" cd "${TMPDIR}"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment