diff options
Diffstat (limited to 'nixpkgs/pkgs/os-specific/linux/rfkill/rfkill-hook.sh')
-rwxr-xr-x | nixpkgs/pkgs/os-specific/linux/rfkill/rfkill-hook.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/os-specific/linux/rfkill/rfkill-hook.sh b/nixpkgs/pkgs/os-specific/linux/rfkill/rfkill-hook.sh new file mode 100755 index 000000000000..bf6e679660c9 --- /dev/null +++ b/nixpkgs/pkgs/os-specific/linux/rfkill/rfkill-hook.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# Executes a hook in case of a change to the +# rfkill state. The hook can be passed as +# environment variable, or present as executable +# file. + +if [ -z "$RFKILL_STATE" ]; then + echo "rfkill-hook: error: RFKILL_STATE variable not set" + exit 1 +fi + +if [ -x /run/current-system/etc/rfkill.hook ]; then + exec /run/current-system/etc/rfkill.hook +elif [ ! -z "$RFKILL_HOOK" ]; then + exec $RFKILL_HOOK +else + echo "rfkill-hook: $RFKILL_STATE" +fi |