hey folks,
here's my generic debug.cfg,
as i've seen so many limited to the usbstick-name,
and you must know, after the recent firmware update,
my usb sticks get recognized under a different name.
i'm not quite sure, but i also think that the appended
numbers change, when i put a stick in another port of
my attached usb hub.
but since i applied my generic debug.cfg to /var/flash/debug.cfg,
i never needed to adjust it again, but rather have the ability
to conveniently change any startup settings on any usb stick
by simply using smb (or ftp) to access and change the startup
script !!
using smb it is possible to directly edit files on a stick ;D
and if there's a problem while booting after a firmware update,
just detach the stick ;D
single stick version (tested)
how it works:
chooses the FIRST stick that becomes available, that
has the file '/_script' contained in its root.
then it executes '/debugext.cfg' of that stick.
the absolute path of the stick is passed as an argument
to debugext.cfg. (you'll see why later)
NOTE: only ONE stick may have such a '_script' tag,
because debugext.cfg will be executed only for the
first stick that is found with such tag.
multi stick version (UNTESTED)
executes debugext.cfg on EVERY stick where
the '_script' tag is found.
example of my debugext.cfg
i create /var/ext as a symbolic link to my scripts stick,
so that i can conveniently access all the stuff in
a generic way without having to rely on the usbstick-name,
which is soo beautiful
(see reasons mentioned in the intro text !!)
cheers!
here's my generic debug.cfg,
as i've seen so many limited to the usbstick-name,
and you must know, after the recent firmware update,
my usb sticks get recognized under a different name.
i'm not quite sure, but i also think that the appended
numbers change, when i put a stick in another port of
my attached usb hub.
but since i applied my generic debug.cfg to /var/flash/debug.cfg,
i never needed to adjust it again, but rather have the ability
to conveniently change any startup settings on any usb stick
by simply using smb (or ftp) to access and change the startup
script !!
using smb it is possible to directly edit files on a stick ;D
and if there's a problem while booting after a firmware update,
just detach the stick ;D
single stick version (tested)
how it works:
chooses the FIRST stick that becomes available, that
has the file '/_script' contained in its root.
then it executes '/debugext.cfg' of that stick.
the absolute path of the stick is passed as an argument
to debugext.cfg. (you'll see why later)
NOTE: only ONE stick may have such a '_script' tag,
because debugext.cfg will be executed only for the
first stick that is found with such tag.
Code:
#!/bin/sh
# wait for the usb-stick to become available [mounted]
# took 46 secs in a test, in another test it took 52 secs
sleep 40
mntpoint="0"
i=0
i_max=15
while [ $i -lt $i_max ]
do
sleep 4
let i=i+1
for j in $( ls /var/media/ftp/ ); do
#echo "j: "$j
if [ -f "/var/media/ftp/"$j"/_script" ]
then
mntpoint=$j
#echo "mntpoint: "$mntpoint
i=$i_max
break
elif [ -f "/var/media/ftp/"$j"/_noscript" ]
then
i=$i_max
break
fi
done
done
if [ $mntpoint != "0" ]
then
#echo "i: "$i >"/var/media/ftp/"$mntpoint"/_script_info.txt"
"/var/media/ftp/"$mntpoint"/debugext.cfg" '"/var/media/ftp/'$mntpoint'"'
fi
multi stick version (UNTESTED)
executes debugext.cfg on EVERY stick where
the '_script' tag is found.
Code:
#!/bin/sh
# wait for the usb-stick to become available [mounted]
# took 46 secs in a test, in another test it took 52 secs
sleep 40
mntpoint="0"
i=0
i_max=15
while [ $i -lt $i_max ]
do
sleep 4
let i=i+1
for j in $( ls /var/media/ftp/ ); do
#echo "j: "$j
if [ -f "/var/media/ftp/"$j"/_script" ]
then
mntpoint=$j
#echo "mntpoint: "$mntpoint
i=$i_max
#echo "i: "$i >"/var/media/ftp/"$mntpoint"/_script_info.txt"
"/var/media/ftp/"$mntpoint"/debugext.cfg" '"/var/media/ftp/'$mntpoint'"'
fi
done
done
example of my debugext.cfg
i create /var/ext as a symbolic link to my scripts stick,
so that i can conveniently access all the stuff in
a generic way without having to rely on the usbstick-name,
which is soo beautiful
(see reasons mentioned in the intro text !!)
Code:
#!/bin/sh
if [ ! -e "/var/ext" ]; then
dir=${1}
# strip quotes
dir=`echo ${dir}|sed -e 's/^\"//'`
dir=`echo ${dir}|sed -e 's/\"$//'`
if [ "${dir}" != "" ]; then
ln -s ${dir} /var/ext
fi
fi
# if! no else or elif !
if [ -e "/var/ext" ]; then
PATH=/var/ext:$PATH
/var/ext/swsplit.sh
/var/ext/dropbear.sh -E
/var/ext/apache/apache -f /var/ext/apache/conf/apache.conf
/var/ext/busybox crond -c /var/ext/etc/crontabs -L /var/ext/logs/cron.log
/var/ext/privoxy.sh start
fi
cheers!
Zuletzt bearbeitet: