Last active
August 28, 2024 09:20
-
-
Save rakslice/3873b7e419c1d959cd51754acda752a1 to your computer and use it in GitHub Desktop.
An ifupdown-ng executor fragment to check if the wlan is disabled by rfkill before trying to bring it up
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 | |
# /usr/libexec/ifupdown-ng/rfkillcheck | |
rfkill_iface=wlan0 | |
rfkill_file=/sys/class/rfkill/rfkill1/soft | |
check() { | |
if [ "$IFACE" = "$rfkill_iface" ] && [ "$PHASE" = "pre-up" ]; then | |
if [ -e $rfkill_file ] && [ "`cat $rfkill_file`" != "0" ] | |
then | |
echo "$IFACE is disabled by rfkill" 1>&2 | |
exit 1 | |
fi | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Because the rfkill entry I was originally checking was a little race conditiony at boot, I reworked this to just hardcode the interface name and rfkill entry to check.