Friday, September 10, 2010

TS101:setup an autorun.sh on your harddrive

The autorun.sh is a script used by the TS to initialise and launch application at startup.
This file is unfortunatly located in an ext2 filesystem in the flash memory of the TS.
This filesystem is unmounted after bootup. Modifying this file can then endanger the system if you forget to unmount it after modification.
To overcome this issue, I propose to setup a file on your harddrive that will be called by autorun.sh at startup.


1. create the file on your harddrive
mkdir /share/HDA_DATA/adminfiles
cd /share/HDA_DATA/adminfiles
touch myautorun.sh
chmod +x myautorun.sh


2. call myautorun.sh from autorun.sh
(see previous post for editing autorun.sh)
add the following lines:

#call user script located on harddrive
[ -f /share/HDA_DATA/adminfiles/myautorun.sh ] && /share/HDA_DATA/adminfiles/myautorun.sh


Don't forget to unmount /tmp/config after modifications

3. I propose that you give your myautorun.sh the following lines:
#!/bin/sh
echo "Starting myautorun script:"
for file in /share/HDA_DATA/adminfiles/*.sh2;
do
echo $file;
[ -f $file ] && $file;
done

Then any file you may add in this directory with extension .sh2 will be executed at startup

0 Comments:

Post a Comment

<< Home