#!/bin/sh if_cmd() { doas ifconfig $@ } destroy_interface() { if_cmd $1 > /dev/null 2>&1 [ $? -eq 0 ] && ( doas ifconfig $1 down \ && doas ifconfig $1 destroy ) } destroy_all() { destroy_interface iwx0 destroy_interface re0 destroy_interface ure0 } setup_wifi() { destroy_interface re0 destroy_interface ure0 destroy_interface iwx0 doas route -n flush if_cmd iwx0 -joinlist if_cmd iwx0 join DiscMate wpakey GeekConnection23 if_cmd iwx0 inet autoconf if_cmd iwx0 inet6 autoconf if_cmd iwx0 up } setup_eth() { destroy_interface re0 destroy_interface ure0 destroy_interface iwx0 doas route -n flush if_cmd $1 inet autoconf if_cmd $1 inet6 autoconf if_cmd $1 up } case $1 in wifi) setup_wifi; ;; re) setup_eth re0; ;; ure) setup_eth ure0; ;; esac