mirror of
https://gitlab.com/hacklab01/pivilion.git
synced 2026-08-06 16:08:22 +00:00
Make Pivilion the exclusive dnsmasq owner
This commit is contained in:
parent
5a27dfeceb
commit
0238f3a531
3 changed files with 61 additions and 7 deletions
18
tests/run.sh
18
tests/run.sh
|
|
@ -41,7 +41,8 @@ installer_safety() {
|
|||
grep -q -- '--repair' "$ROOT/install.sh" &&
|
||||
grep -q 'backup_managed_files' "$ROOT/install.sh" &&
|
||||
grep -q 'rollback()' "$ROOT/install.sh" &&
|
||||
! grep -Eq 'disable( --now)? dnsmasq' "$ROOT/install.sh" &&
|
||||
grep -Fq 'systemctl disable --now dnsmasq.service' "$ROOT/install.sh" &&
|
||||
grep -Fq 'systemctl disable pivilion-dnsmasq.service pivilion-hostapd.service' "$ROOT/install.sh" &&
|
||||
! grep -q 'rm -f.*CAPTIVE\|rm -f.*\.htaccess' "$ROOT/usr/local/bin/onion"
|
||||
}
|
||||
|
||||
|
|
@ -88,6 +89,20 @@ networkmanager_startup_contract() {
|
|||
grep -q 'nmcli connection up "$connection" ifname "$iface"' "$ROOT/usr/local/lib/pivilion/networkmanager.sh"
|
||||
}
|
||||
|
||||
dnsmasq_ownership_contract() {
|
||||
[ -f "$ROOT/etc/systemd/system/pivilion-dnsmasq.service" ] &&
|
||||
! find "$ROOT/etc/systemd/system" -type l \( -name 'dnsmasq.service' -o -name 'pivilion-dnsmasq.service' \) -print -quit | grep -q . &&
|
||||
grep -Fq 'systemctl stop dnsmasq.service pivilion-dnsmasq.service' "$ROOT/usr/local/lib/pivilion/mode.sh" &&
|
||||
grep -Fq 'systemctl stop pivilion-dnsmasq.service' "$ROOT/usr/local/lib/pivilion/mode.sh" &&
|
||||
grep -q 'start_pivilion_dnsmasq' "$ROOT/usr/local/lib/pivilion/mode.sh" &&
|
||||
grep -q 'systemctl is-active --quiet pivilion-dnsmasq.service' "$ROOT/usr/local/lib/pivilion/mode.sh" &&
|
||||
grep -Fq 'address=/#/10.1.1.1' "$ROOT/usr/local/lib/pivilion/mode.sh" &&
|
||||
grep -q 'android_probe.*302' "$ROOT/usr/local/lib/pivilion/diagnose.sh" &&
|
||||
grep -q 'apple_probe.*302' "$ROOT/usr/local/lib/pivilion/diagnose.sh" &&
|
||||
grep -q 'microsoft_probe.*302' "$ROOT/usr/local/lib/pivilion/diagnose.sh" &&
|
||||
grep -Fqx 'RewriteCond %{REQUEST_FILENAME} -f [OR]' "$ROOT/home/pi/pivilion/config/html/.htaccess"
|
||||
}
|
||||
|
||||
shellcheck_scripts() {
|
||||
command -v shellcheck >/dev/null 2>&1 || return 0
|
||||
shellcheck "$ROOT/install.sh" "$ROOT"/usr/local/lib/pivilion/*.sh "$ROOT"/usr/local/bin/pivilion* "$ROOT/usr/local/bin/hotspot" "$ROOT/usr/local/bin/onion" "$ROOT/usr/local/bin/pikey"
|
||||
|
|
@ -106,6 +121,7 @@ run "canonical boot configuration contract" boot_config_contract
|
|||
run "same-boot hotspot and onion activation contract" same_boot_mode_contract
|
||||
run "NetworkManager software-radio and delayed-device handling" "$ROOT/tests/test-networkmanager.sh"
|
||||
run "NetworkManager hotspot startup contract" networkmanager_startup_contract
|
||||
run "exclusive captive dnsmasq ownership contract" dnsmasq_ownership_contract
|
||||
run "ShellCheck (when installed)" shellcheck_scripts
|
||||
|
||||
[ "$failures" -eq 0 ] || { echo "$failures test group(s) failed." >&2; exit 1; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue