mirror of
https://github.com/ben-grande/qusal.git
synced 2025-02-25 09:11:18 -05:00

Make shell a little bit safer with: - add-default-case - check-extra-masked-returns - check-set-e-suppressed - quote-safe-variables - check-unassigned-uppercase Although there are some stylistic decisions for uniformity: - avoid-nullary-conditions - deprecated-which - require-variable-braces
22 lines
757 B
Bash
Executable File
22 lines
757 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# SPDX-FileCopyrightText: 2022 - 2023 unman <unman@thirdeyesecurity.org>
|
|
# SPDX-FileCopyrightText: 2023 - 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
set -eu
|
|
|
|
## Change the netvm of every qube that has (disp-)sys-firewall to pihole.
|
|
for qube in $(qvm-ls --raw-data --fields=NAME,NETVM |
|
|
awk -F '|' '/\|(disp-)?sys-firewall$/{print $1}')
|
|
do
|
|
## Avoid overwriting netvm to sys-pihole when instead it should use the
|
|
## default_netvm, so better to prevent overwriting user choices.
|
|
qvm-prefs "${qube}" | grep -q "^netvm[[:space:]]\+D" && continue
|
|
## Set netvm for qubes that were using (disp-)sys-firewall to sys-pihole.
|
|
qvm-prefs "${qube}" netvm sys-pihole
|
|
done
|
|
|
|
exit 0
|