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>
95 lines
3.5 KiB
Bash
95 lines
3.5 KiB
Bash
#!/usr/bin/env bats
|
|
|
|
load test_helper
|
|
|
|
# Taildrop: Files' "Send with Tailscale" script, and the captive portal helper,
|
|
# with a fake tailscale
|
|
|
|
setup() {
|
|
common_setup
|
|
stub notify-send
|
|
echo one > "$BATS_TEST_TMPDIR/one.txt"
|
|
echo two > "$BATS_TEST_TMPDIR/two.txt"
|
|
mkdir "$BATS_TEST_TMPDIR/folder"
|
|
stub tailscale 'if [ "$3" = --targets ]; then printf "100.64.0.2\tlaptop\n100.64.0.3\tdesktop\n"; fi'
|
|
stub zenity 'echo 100.64.0.3'
|
|
}
|
|
|
|
@test "Send with Tailscale sends the chosen files to the chosen computer" {
|
|
NAUTILUS_SCRIPT_SELECTED_FILE_PATHS="$BATS_TEST_TMPDIR/one.txt"$'\n'"$BATS_TEST_TMPDIR/folder"$'\n'"$BATS_TEST_TMPDIR/two.txt"$'\n' \
|
|
run bash "$REPO/system/send-with-tailscale"
|
|
[ "$status" -eq 0 ]
|
|
called tailscale file cp --update-interval=0 -- "$BATS_TEST_TMPDIR/one.txt" "$BATS_TEST_TMPDIR/two.txt" 100.64.0.3:
|
|
grep -q '^notify-send .*Sent to desktop 2 files$' "$STUB_LOG"
|
|
}
|
|
|
|
@test "Send with Tailscale does nothing when the choice is cancelled" {
|
|
stub zenity 'exit 1'
|
|
run bash "$REPO/system/send-with-tailscale" "$BATS_TEST_TMPDIR/one.txt"
|
|
[ "$status" -eq 0 ]
|
|
uncalled tailscale file cp --update-interval=0 -- "$BATS_TEST_TMPDIR/one.txt" 100.64.0.3:
|
|
}
|
|
|
|
@test "Send with Tailscale says when no computer can take files" {
|
|
stub tailscale
|
|
run bash "$REPO/system/send-with-tailscale" "$BATS_TEST_TMPDIR/one.txt"
|
|
[ "$status" -eq 1 ]
|
|
grep -q '^notify-send .*No computer to send to' "$STUB_LOG"
|
|
not_called zenity
|
|
}
|
|
|
|
@test "Send with Tailscale says when sending fails" {
|
|
stub tailscale 'if [ "$3" = --targets ]; then printf "100.64.0.3\tdesktop\n"; else echo "no route"; exit 1; fi'
|
|
run bash "$REPO/system/send-with-tailscale" "$BATS_TEST_TMPDIR/one.txt"
|
|
[ "$status" -eq 1 ]
|
|
grep -q "^notify-send .*Couldn't send to desktop no route$" "$STUB_LOG"
|
|
}
|
|
|
|
# --- Captive portal ----------------------------------------------------------
|
|
|
|
portal_setup() {
|
|
export CAPTIVE_PORTAL_STATE="$BATS_TEST_TMPDIR/paused"
|
|
export EXIT_NODE="${EXIT_NODE-100.64.0.9/32}"
|
|
stub logger
|
|
stub tailscale 'if [ "$1" = status ]; then
|
|
if [ -n "$EXIT_NODE" ]; then echo "{\"ExitNodeStatus\": {\"TailscaleIPs\": [\"$EXIT_NODE\"]}}"; else echo "{}"; fi
|
|
fi'
|
|
}
|
|
|
|
@test "at a captive portal, the exit node is paused, and comes back once online" {
|
|
portal_setup
|
|
CONNECTIVITY_STATE=PORTAL run bash "$REPO/system/captive-portal" wlan0 connectivity-change
|
|
[ "$status" -eq 0 ]
|
|
called tailscale set --exit-node=
|
|
[ "$(cat "$CAPTIVE_PORTAL_STATE")" = 100.64.0.9 ]
|
|
|
|
EXIT_NODE="" CONNECTIVITY_STATE=FULL run bash "$REPO/system/captive-portal" wlan0 connectivity-change
|
|
[ "$status" -eq 0 ]
|
|
called tailscale set --exit-node=100.64.0.9
|
|
[ ! -e "$CAPTIVE_PORTAL_STATE" ]
|
|
}
|
|
|
|
@test "a captive portal changes nothing without an exit node" {
|
|
EXIT_NODE="" portal_setup
|
|
CONNECTIVITY_STATE=PORTAL run bash "$REPO/system/captive-portal" wlan0 connectivity-change
|
|
CONNECTIVITY_STATE=FULL run bash "$REPO/system/captive-portal" wlan0 connectivity-change
|
|
uncalled tailscale set --exit-node=
|
|
[ ! -e "$CAPTIVE_PORTAL_STATE" ]
|
|
}
|
|
|
|
@test "an exit node chosen while at the portal is left alone" {
|
|
portal_setup
|
|
echo 100.64.0.9 > "$CAPTIVE_PORTAL_STATE"
|
|
EXIT_NODE=100.64.0.7/32 CONNECTIVITY_STATE=FULL run bash "$REPO/system/captive-portal" wlan0 connectivity-change
|
|
[ "$status" -eq 0 ]
|
|
refute grep -q '^tailscale set' "$STUB_LOG"
|
|
[ ! -e "$CAPTIVE_PORTAL_STATE" ]
|
|
}
|
|
|
|
@test "the captive portal helper ignores other events" {
|
|
portal_setup
|
|
CONNECTIVITY_STATE=PORTAL run bash "$REPO/system/captive-portal" wlan0 up
|
|
[ "$status" -eq 0 ]
|
|
not_called tailscale
|
|
}
|