summaryrefslogtreecommitdiff
path: root/misc/wifitoggle
diff options
context:
space:
mode:
authorTimmy Keller <tjk@tjkeller.xyz>2021-09-11 00:36:13 -0500
committerTimmy Keller <tjk@tjkeller.xyz>2021-09-11 00:36:13 -0500
commit0a9053c2902adab8b94eaacdb15390441143078c (patch)
tree1f1a38272dbd554cde8cdec263187112b9c6a7e8 /misc/wifitoggle
downloadscripts-0a9053c2902adab8b94eaacdb15390441143078c.tar.xz
scripts-0a9053c2902adab8b94eaacdb15390441143078c.zip
redid repo cus of fucking chromium rip old commit messages
Diffstat (limited to 'misc/wifitoggle')
-rwxr-xr-xmisc/wifitoggle34
1 files changed, 34 insertions, 0 deletions
diff --git a/misc/wifitoggle b/misc/wifitoggle
new file mode 100755
index 0000000..4c74da4
--- /dev/null
+++ b/misc/wifitoggle
@@ -0,0 +1,34 @@
+#!/bin/sh
+printusage() { echo "Usage: $0 [up|on|down|off|toggle]" && exit; }
+if [ "$COMPUTER" = "laptop" ]; then
+ down() {
+ doas sv stop dhcpcd sshd rsyncd
+ }
+ up() {
+ doas sv start dhcpcd sshd rsyncd
+ }
+ toggle() {
+ case `doas sv status dhcpcd | cut -d':' -f1` in
+ run) down ;;
+ down) up ;;
+ *) echo "Error: sv returned an invalid string. Is dhcpcd being used on this system? Is runit the init system?" ;;
+ esac
+ }
+elif [ "$COMPUTER" = "desktop" ]; then
+ down() {
+ echo hi;
+ }
+ up() {
+ echo hi;
+ }
+fi
+
+[ -z "$1" ] && toggle && exit
+
+case "$1" in
+ up|on) up ;;
+ down|off) down ;;
+ toggle) toggle ;;
+ *) printusage ;;
+esac
+