-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.py
17 lines (14 loc) · 706 Bytes
/
init.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import os
import ConfigParser
import sys
config = ConfigParser.ConfigParser()
config.read("settings.cfg")
if len(sys.argv) <= 1:
os.system("ip route add %s dev eth0" % config.get("microcontroller", "gateway"))
os.system("route add default gw %s dev eth0" % config.get("microcontroller", "gateway"))
os.system("ip route add %s dev eth0" % config.get("microcontroller", "ip"))
elif sys.argv[1] == "undo":
os.system("ip route del %s dev eth0" % config.get("microcontroller", "gateway"))
os.system("route delete default gw %s dev eth0" % config.get("microcontroller", "gateway"))
os.system("ip route del %s dev eth0" % config.get("microcontroller", "ip"))
os.system("ip route show")