forked from vitriolix/commotion-linux-py
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfallback.py
More file actions
executable file
·23 lines (18 loc) · 797 Bytes
/
fallback.py
File metadata and controls
executable file
·23 lines (18 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/python
import commotionc
import subprocess
import sys
profile = sys.argv[1]
operation = sys.argv[2]
if operation == 'up':
commotion = commotionc.CommotionCore('commotion-fallback')
commotion.fallbackConnect(sys.argv[1])
if operation == 'down':
commotion.log('Bringing down mesh connection. The six following lines should show return values of zero')
commotion.log(subprocess.call(['pkill', '-9', 'commotion_wpa']))
commotion.log(subprocess.call(['pkill', '-9', 'olsrd']))
commotion.log(subprocess.call(['nmcli', 'nm', 'sleep', 'false']))
commotion.log(subprocess.call(['rfkill', 'block', 'wifi']))
commotion.log(subprocess.call(['rfkill', 'unblock', 'wifi']))
# Add full up/down/status logic (if up, then; if down, then)
# Add ArgumentParser logic