-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·49 lines (40 loc) · 1.64 KB
/
setup.py
File metadata and controls
executable file
·49 lines (40 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python3
import subprocess
import sys
import os
import time
def main():
print("==================================================")
print(" Slideshow Kiosk Setup")
print("==================================================")
# Ensure we run from the repository directory
script_dir = os.path.dirname(os.path.abspath(__file__))
os.chdir(script_dir)
# Ensure scripts are executable
subprocess.run(["chmod", "+x", "tune-pi.sh", "deploy.sh"], check=False)
print("\n>>> 1/2: Running System Tuning (tune-pi.sh)")
print(" This step configures GPU memory, swap, and CPU performance.")
try:
# We run tune-pi.sh with sudo.
subprocess.run(["sudo", "./tune-pi.sh"], check=True)
except subprocess.CalledProcessError as e:
print(f"\n[ERROR] tune-pi.sh failed with exit code {e.returncode}")
sys.exit(1)
print("\n>>> 2/2: Deploying App and Kiosk Autostart (deploy.sh)")
try:
# deploy.sh manages its own internals safely
subprocess.run(["./deploy.sh"], check=True)
except subprocess.CalledProcessError as e:
print(f"\n[ERROR] deploy.sh failed with exit code {e.returncode}")
sys.exit(1)
print("\n==================================================")
print(" Setup Complete! ")
print(" Rebooting Raspberry Pi in 10 seconds to apply changes...")
print("==================================================")
for i in range(10, 0, -1):
print(f"Rebooting in {i}...")
time.sleep(1)
print("Rebooting now!")
subprocess.run(["sudo", "reboot"])
if __name__ == "__main__":
main()