-
Notifications
You must be signed in to change notification settings - Fork 2
/
recalbox_install.sh
60 lines (52 loc) · 1.75 KB
/
recalbox_install.sh
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
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
#Step 1 make /boot writable---------------------------------
mount -o remount, rw /boot
mount -o remount, rw /
#Step 2) enable UART and system.power.switch----------------
File=/boot/config.txt
if grep -q "enable_uart=1" "$File";
then
echo "UART already enabled. Doing nothing."
else
echo "enable_uart=1" >> $File
echo "UART enabled."
fi
if grep -q "^system.power.switch=PIN56PUSH*" "/recalbox/share/system/recalbox.conf";
then
echo "PIN56PUSH configuration already enabled."
else
echo "system.power.switch=PIN56PUSH" >> /recalbox/share/system/recalbox.conf
echo "PIN56PUSH configuration enabled."
fi
#-----------------------------------------------------------
#Step 3) Download Python script-----------------------------
mkdir /opt/Rasptendo
script=/opt/Rasptendo/halt_wake.py
if [ -e $script ];
then
echo "Script halt_wake.py already exists. Doing nothing."
else
wget --no-check-certificate -O $script "https://raw.githubusercontent.com/Argon40Tech/Super-Rasptendo-Case-Power-Switch/master/halt_wake_non_gpiozero.py"
fi
#-----------------------------------------------------------
#Step 4) Enable Python script to run on start up------------
DIR=/etc/init.d/S99Rasptendo
if grep -q "python $script &" "$S99Rasptendo";
then
if [ -x $DIR];
then
echo "Executable S99Rasptendo already configured. Doing nothing."
else
chmod +x $DIR
fi
else
echo "python $script &" >> $DIR
chmod +x $DIR
echo "Executable S99Rasptendo configured."
fi
#-----------------------------------------------------------
#Step 5) Reboot to apply changes----------------------------
echo "RASPTENDO SNES Switch installation done. Will now reboot after 3 seconds."
sleep 3
shutdown -r now
#-----------------------------------------------------------