diff options
author | tv <tv@krebsco.de> | 2020-10-03 12:22:04 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2020-10-03 13:14:11 +0200 |
commit | 64a9aeed2298295d204efd05b321dea271ecdb2a (patch) | |
tree | e516f06d2542aa7390bf98e986bfc8651a682d38 /tv/2configs | |
parent | 3c9945364c294ab65c62c01447d00ebc980558bc (diff) |
tv ppp: add connect script
Diffstat (limited to 'tv/2configs')
-rw-r--r-- | tv/2configs/ppp.nix | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tv/2configs/ppp.nix b/tv/2configs/ppp.nix index ecb17c3f8..0c74e1642 100644 --- a/tv/2configs/ppp.nix +++ b/tv/2configs/ppp.nix @@ -31,4 +31,30 @@ in { ATDT*99***1# CONNECT ''}" ''; + users.users.root.packages = [ + (pkgs.writeDashBin "connect" '' + # usage: + # connect wlan + # connect wwan [PEERNAME] + set -efu + rfkill_wlan=/sys/class/rfkill/rfkill2 + rfkill_wwan=/sys/class/rfkill/rfkill1 + case $1 in + wlan) + ${pkgs.procps}/bin/pkill pppd || : + echo 0 > "$rfkill_wwan"/state + echo 1 > "$rfkill_wlan"/state + ;; + wwan) + name=''${2-o2} + echo 0 > "$rfkill_wlan"/state + echo 1 > "$rfkill_wwan"/state + ${pkgs.ppp}/bin/pppd call "$name" updetach + ;; + *) + echo "$0: error: bad arguments: $*" >&2 + exit 1 + esac + '') + ]; } |