summaryrefslogtreecommitdiffstats
path: root/tv
diff options
context:
space:
mode:
Diffstat (limited to 'tv')
-rw-r--r--tv/2configs/ppp.nix26
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
+ '')
+ ];
}