Open ChrisWiGit opened 6 years ago
I wouldn't change the init.d/s99custom. If you look in that file it calls to the shared mount to execute a custom.sh file. You make your changes there.
Here's a fully working install file. Just paste the below into a new batocera_install.sh file. Then SFTP it to the box, make it executable and then run it. Everything works as expected.
#!/bin/bash
#Step 1 make /boot writable---------------------------------
sleep 2s
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
sleep 2s
if grep -q "^system.power.switch=PIN356ONOFFRESET*" "/recalbox/share/system/recalbox.conf";
then
echo "PIN356ONOFFRESET configuration already enabled."
else
echo "system.power.switch=PIN356ONOFFRESET" >> /recalbox/share/system/recalbox.conf
echo "PIN356ONOFFRESET configuration enabled."
fi
#-----------------------------------------------------------
#Step 3) Download Python script-----------------------------
mkdir /recalbox/share/scripts;
sleep 2s
script=/recalbox/share/scripts/SafeShutdown.py
if [ -e $script ];
then
echo "Script SafeShutdown.py already exists. Doing nothing."
else
wget --no-check-certificate -O $script "https://raw.githubusercontent.com/RetroFlag/retroflag-picase/master/recalbox_SafeShutdown.py"
fi
#-----------------------------------------------------------
sleep 2s
#Step 4) Enable Python script to run on start up------------
DIR=/recalbox/share/system/custom.sh
if grep -q "python $script &" "custom.sh";
then
if [ -x $DIR];
then
echo "Executable S99RetroFlag($DIR) already configured. Doing nothing."
else
chmod +x $DIR
fi
else
echo "python $script &" >> $DIR
chmod +x $DIR
echo "Executable S99RetroFlag($DIR) configured."
fi
#-----------------------------------------------------------
#Step 5) Reboot to apply changes----------------------------
echo "RetroFlag Pi Case Switch installation done. Will now reboot after 3 seconds."
sleep 3
shutdown -r now
#-----------------------------------------------------------
For https://batocera-linux.xorhub.com/ you need to change this line DIR=/etc/init.d/S99RetroFlag to DIR=/etc/init.d/S99custom
Also use this FAQ for persisting file system changes: https://batocera-linux.xorhub.com/wiki/doku.php?id=en:modify_the_system_while_it_s_running