summary refs log tree commit diff
path: root/pkgs/os-specific/linux/rfkill/rfkill-hook.sh
blob: d07c72981831765a499c85dc1bd72bf907956f47 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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 /var/run/current-system/etc/rfkill.hook ]; then
  exec /var/run/current-system/etc/rfkill.hook
elif [ ! -z "$RFKILL_HOOK" ]; then
  exec $RFKILL_HOOK
else
  echo "rfkill-hook: $RFKILL_STATE"
fi