Last active
December 10, 2016 00:39
-
-
Save jpouellet/aaeecdf34b2d066371a5acfead978467 to your computer and use it in GitHub Desktop.
Restarts your sys-net without requiring shutting everything else down first. Useful if your wifi drivers hang regularly... :(
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# TODO: detect sys-net(s) by pci attachment & sys-firewall(s) by netvm == $sys-net(s) | |
if [ -z "$NET_RESTART_LOCK" ]; then | |
if env NET_RESTART_LOCK=ok flock -o -n /var/run/qubes/net-restart.lock "$0" "$@"; then | |
exit 0 | |
else | |
echo "$0: Failed to aquire lock" >&2 | |
exit 1 | |
fi | |
fi | |
[ X"$1" = X-v ] && v=true || v=false | |
step() { | |
step="$1" | |
shift | |
if $v; then | |
echo "$step" | |
"$@" 2>&1 | sed 's/^/\t/' | |
else | |
echo -n "$step... " | |
"$@" >/dev/null 2>&1 | |
echo done | |
fi | |
} | |
step "Removing netvm from sys-firewall" qvm-prefs -s sys-firewall netvm none | |
step "Shutting down sys-net" qvm-shutdown --wait sys-net | |
step "Starting sys-net" qvm-start sys-net | |
step "Restoring netvm to sys-firewall" qvm-prefs -s sys-firewall netvm sys-net |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So actually, if you just add the relevant drivers to
/rw/config/suspend-module-blacklist
in your sys-net, Qubes will {un,re}load them for you on suspend/resume, which is a much better (faster, and no manual button pressing on fail) solution than this.