diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 5bb2345a..39fbe723 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -33,8 +33,23 @@ jobs: with: python-version: "3.x" - - name: Install shellcheck - run: sudo apt-get update -qq && sudo apt-get install -y -qq shellcheck + # Pinned, not apt-installed. `language: system` hooks run whatever is on + # PATH, so an unpinned shellcheck makes CI disagree with every developer + # machine: Ubuntu's package flagged SC2236 in a file that 0.11.0 locally + # does not, and the build went red for a difference in tool version + # rather than in the code. + - name: Install shellcheck (pinned) + env: + SHELLCHECK_VERSION: v0.11.0 + SHELLCHECK_SHA256: 8c3be12b05d5c177a04c29e3c78ce89ac86f1595681cab149b65b97c4e227198 + run: | + set -euo pipefail + url="https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" + curl -fsSL "$url" -o /tmp/sc.tar.xz + echo "${SHELLCHECK_SHA256} /tmp/sc.tar.xz" | sha256sum -c - + tar -xJf /tmp/sc.tar.xz -C /tmp + sudo install -m 0755 "/tmp/shellcheck-${SHELLCHECK_VERSION}/shellcheck" /usr/local/bin/shellcheck + shellcheck --version - uses: actions/cache@v4 with: diff --git a/Programming/PSD/zin3/python/run_temperature_system.sh b/Programming/PSD/zin3/python/run_temperature_system.sh index db8315fc..a784cc36 100755 --- a/Programming/PSD/zin3/python/run_temperature_system.sh +++ b/Programming/PSD/zin3/python/run_temperature_system.sh @@ -31,17 +31,17 @@ cleanup() { echo -e "${YELLOW}Shutting down the temperature monitoring system...${NC}" # Kill all background processes - if [[ ! -z $GENERATOR_PID ]]; then + if [[ -n "${GENERATOR_PID}" ]]; then echo "Stopping temperature generator..." kill $GENERATOR_PID 2>/dev/null || true fi - if [[ ! -z $DETECTOR_PID ]]; then + if [[ -n "${DETECTOR_PID}" ]]; then echo "Stopping anomaly detector..." kill $DETECTOR_PID 2>/dev/null || true fi - if [[ ! -z $VISUALIZER_PID ]]; then + if [[ -n "${VISUALIZER_PID}" ]]; then echo "Stopping alarm visualizer..." kill $VISUALIZER_PID 2>/dev/null || true fi