shellcheck / shellcheck (push) Failing after 19s
Adapted from Omarchy (github.com/omacom/omarchy) for Arch with GNOME: - A pacman hook stops a full upgrade run without update (pacman -Syu, yay -Syu), which would skip the snapshot and update's checks. update and install.sh set COREDESKTOP_ALLOW_PACMAN=1, which the hook finds on pacman or any process above it; you can set it too. - When the Arch upgrade stops on files no package owns, update lists them and asks to move them to /var/lib/coredesktop/replaced and try again, putting back what the retry didn't replace. When packages conflict, it runs pacman again so you can choose. - update and install keep the computer from sleeping until they finish. - system/hardware.sh (install, and a migration): the Wi-Fi country from the time zone, thermald and intel-lpmd on Intel laptops, and Wi-Fi 6 on Intel BE200/BE211 cards, whose driver gets Wi-Fi 7 wrong. - configure security-key and configure fingerprint: touch a FIDO2 key or a finger instead of typing your password for sudo and polkit, falling back to the password. Each shows only when the hardware is there. The fingerprint skips to the password with the lid shut. - webapp: put a website in the app grid as its own app window. - Taildrop: Files' Scripts > Send with Tailscale, and a user service that saves files sent here to Downloads, started when configure tailscale joins. - A NetworkManager dispatcher script pauses a Tailscale exit node while you sign in to a captive portal, and resumes it once online. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
62 lines
1.7 KiB
Bash
62 lines
1.7 KiB
Bash
#!/bin/bash
|
|
|
|
# Shared setup for the bats tests. Each test gets its own HOME and a bin dir at
|
|
# the front of PATH where it can put fake versions of pacman, yay, sudo, etc.
|
|
|
|
# Used by the .bats files that load this one
|
|
# shellcheck disable=SC2034
|
|
REPO="$(cd "$BATS_TEST_DIRNAME/.." && pwd)"
|
|
|
|
common_setup() {
|
|
export HOME="$BATS_TEST_TMPDIR/home"
|
|
export STUB_BIN="$BATS_TEST_TMPDIR/bin"
|
|
export STUB_LOG="$BATS_TEST_TMPDIR/stub.log"
|
|
mkdir -p "$HOME" "$STUB_BIN"
|
|
: > "$STUB_LOG"
|
|
export PATH="$STUB_BIN:$PATH"
|
|
unset COREDESKTOP
|
|
# Set when the tests run inside a smoketest (a pre-push hook's checks, say),
|
|
# where they would point the smoketest tests at the real VM
|
|
unset VM_GIT_SSH VM_GIT_URL SMOKETEST_REPO SMOKETEST_RESULTS SMOKETEST_SHARED \
|
|
SMOKETEST_REF SMOKETEST_VM_DIR IMAGE_REF VARIANT
|
|
}
|
|
|
|
# A test file that needs more setup defines its own setup that calls this first
|
|
setup() {
|
|
common_setup
|
|
}
|
|
|
|
# stub NAME [BODY]: put a fake NAME on PATH that appends "NAME args..." to
|
|
# $STUB_LOG and then runs BODY, a bash snippet that sees the args as "$@"
|
|
stub() {
|
|
local name="$1" body="${2:-}"
|
|
cat > "$STUB_BIN/$name" << EOF
|
|
#!/bin/bash
|
|
echo "$name \$*" >> "\$STUB_LOG"
|
|
$body
|
|
EOF
|
|
chmod +x "$STUB_BIN/$name"
|
|
}
|
|
|
|
# called NAME ARGS...: true if the stub log has exactly the line "NAME ARGS..."
|
|
called() {
|
|
grep -qxF "$*" "$STUB_LOG"
|
|
}
|
|
|
|
# not_called NAME: true if the stub NAME never ran
|
|
not_called() {
|
|
! grep -q "^$1 " "$STUB_LOG"
|
|
}
|
|
|
|
# uncalled NAME ARGS...: the opposite of called. (A bare "! called ..." would
|
|
# not fail the test: bats, like set -e, ignores the status of a ! command.)
|
|
uncalled() {
|
|
! called "$@"
|
|
}
|
|
|
|
# refute COMMAND...: true if COMMAND fails. Use it instead of "! COMMAND",
|
|
# which doesn't fail a test (see uncalled).
|
|
refute() {
|
|
! "$@"
|
|
}
|