Help Creating A Sd Card Detecting Autorun Script


Joined
Aug 27, 2006
Messages
231
Age
34
Location
Western New York, USA
Website
rememberthe8bit.blogspot.com
I was trying to create an SD card detecting script, so that I could always run cpu/lcd tweaker in the NAND to fix my screen, but also be able to run gmenu2x when the SD card is inserted on bootup.

This is what I have now. (it's pretty hack-ey :p )

CODE

# Run GMenu2X if it's on the SD card
if -e /mnt/sd/Apps/gmenu2x/yay.txt; \

then \

cd /mnt/sd/Apps/gmenu2x; \
exec ./gmenu2x; \

# Run default interface
cd /usr/gp2x; \
exec ./gp2xmenu --disable-autorun; \

else \

# Run default interface
cd /usr/gp2x; \
exec ./gp2xmenu --disable-autorun; \

fi; \



"yay.txt" is just a file I made, because I didn't know if it would detect the gmenu2x executable.
 
rememberthe8bit said:
I was trying to create an SD card detecting script, so that I could always run cpu/lcd tweaker in the NAND to fix my screen, but also be able to run gmenu2x when the SD card is inserted on bootup.
A simpler script:

CODE

#!/bin/bash
SDMOUNTED=`mount | grep '/mnt/sd'`
if [ -n "$SDMOUNTED" ]; then
# The SD is mounted
cd /mnt/sd/Apps/gmenu2x
./gmenu2x
cd /usr/gp2x
exec ./gp2xmenu --disable-autorun
else
# The SD is not mounted
cd /usr/gp2x
exec ./gp2xmenu --disable-autorun
fi



Notice that only the call to the gp2xmenu has an 'exec'. In your script you have two commands with exec, and since the 'exec' replace the whole script with the specified command, the second call (the one to ./gp2xmenu) is never executed.

Besides, you do not need the backslash in every line, nor the commas, but you need squares in your 'ifs'. Finally, the gmenu2x executable should be as detectable as yay.txt
 
Last edited by a moderator:
Back
Top