-
Notifications
You must be signed in to change notification settings - Fork 235
/
recalbox_install.sh
76 lines (65 loc) · 2.06 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
SourcePath=https://raw.githubusercontent.com/RetroFlag/retroflag-picase/master
#make /boot writable---------------------------------
sleep 2s
mount -o remount, rw /boot
mount -o remount, rw /
#RetroFlag pw io ;2:in ;3:in ;4:in ;14:out 1----------------------------------------
File=/boot/config.txt
wget -O "/boot/overlays/RetroFlag_pw_io.dtbo" "$SourcePath/RetroFlag_pw_io.dtbo"
if grep -q "RetroFlag_pw_io" "$File";
then
sed -i '/RetroFlag_pw_io/c dtoverlay=RetroFlag_pw_io.dtbo' $File
echo "PW IO fix."
else
echo "dtoverlay=RetroFlag_pw_io.dtbo" >> $File
echo "PW IO enabled."
fi
if grep -q "enable_uart" "$File";
then
sed -i '/enable_uart/c enable_uart=1' $File
echo "UART fix."
else
echo "enable_uart=1" >> $File
echo "UART enabled."
fi
#-----------------------------------------------------------
sleep 2s
File=/recalbox/share/system/recalbox.conf
if grep -q "system.power.switch" "$File";
then
sed -i '/system.power.switch/c system.power.switch=PIN356ONOFFRESET' "$File"
echo "power switch fix."
else
echo "system.power.switch=PIN356ONOFFRESET" >> $File
echo "power switch enabled."
fi
#-----------------------------------------------------------
#Download Python script-----------------------------
mkdir /opt/RetroFlag
sleep 2s
script=/opt/RetroFlag/SafeShutdown.py
wget --no-check-certificate -O $script "$SourcePath/recalbox_SafeShutdown.py"
#-----------------------------------------------------------
sleep 2s
#Enable Python script to run on start up------------
DIR=/etc/init.d/S99RetroFlag
if grep -q "python $script &" "$DIR";
then
if [ -x $DIR ];
then
echo "Executable S99RetroFlag already configured. Doing nothing."
else
chmod +x $DIR
fi
else
echo "python $script &" >> $DIR
chmod +x $DIR
echo "Executable S99RetroFlag configured."
fi
#-----------------------------------------------------------
#Reboot to apply changes----------------------------
echo "RetroFlag Pi Case Switch installation done. Will now reboot after 3 seconds."
sleep 3
reboot
#-----------------------------------------------------------