-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
17 lines (17 loc) · 1.02 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import os
if not os.geteuid() == 0:
raise PermissionError(' [-] Script must be run as root/sudo!')
print("[+] Installing required packages/libraries & setting up everything!\n\n")
os.system("apt-get -o Acquire::ForceIPv4=true update")
os.system("apt-get -o Acquire::ForceIPv4=true install -y python3 python3-pip xboxdrv python3-dbus supervisor")
os.system("pip3 install hid aioconsole dbus-python")
os.system("pip3 install hid==1.0.0")
os.system("pip3 install inputs")
os.system('echo "[program:switchX]" > /etc/supervisor/conf.d/switchX.conf')
os.system('echo "priority=10" >> /etc/supervisor/conf.d/switchX.conf')
os.system('echo "directory='+os.getcwd()+'" >> /etc/supervisor/conf.d/switchX.conf')
os.system('echo "command=python3 switchX.py" >> /etc/supervisor/conf.d/switchX.conf')
os.system('echo "user=root" >> /etc/supervisor/conf.d/switchX.conf')
os.system('echo "autostart=true" >> /etc/supervisor/conf.d/switchX.conf')
os.system('echo "autorestart=true" >> /etc/supervisor/conf.d/switchX.conf')
print("[+] Done.")