net-static.run (502B)
1 #!/bin/sh 2 exec 2>&1 3 4 [ -f ./conf ] && . ./conf 5 6 # bring interface up 7 ip link set "${IFACE:-wlan0}" up 8 9 # flush old IPs 10 ip addr flush dev "${IFACE:-wlan0}" 11 12 # assign static IP 13 ip addr add "${IP:-192.168.1.22}/${NETMASK:-24}" dev "${IFACE:-wlan0}" 14 15 # set default route 16 ip route add default via "${GATEWAY:-192.168.1.1}" 17 18 # configure DNS 19 echo "nameserver ${GATEWAY:-192.168.1.1}" > /etc/resolv.conf 20 echo "nameserver 8.8.8.8" >> /etc/resolv.conf 21 22 # block forever so runit keeps it "up" 23 exec sleep infinity