Just an update, I realised that I will need for this the
rc.unslung start or
rc.unslung stop scripts at the USB mount and unmount steps.
I assume it should be something similar as here:
cat << EOF > /tmp/script_usbmount.tmp
if [ \$1 = "/tmp/mnt/MYPART" ]
then
ln -sf \$1 /tmp/opt
/opt/etc/init.d/rc.unslung start
fi
EOF
nvram set script_usbmount="`cat /tmp/script_usbmount.tmp`"
cat << EOF > /tmp/script_usbumount.tmp
if [ \$1 = "/tmp/mnt/MYPART" ]
then
/opt/etc/init.d/rc.unslung stop
fi
EOF
nvram set script_usbumount="`cat /tmp/script_usbumount.tmp`"
nvram commit
reboot
Source:
https://github.com/Entware-ng/Entware-ng/wiki/Install-on-Asus-stock-firmwareHowever, I am somehow stuck because I don't know where and whether this router has an already scripts that start after mounting an USB or not. I found some bits under
/sbin/wwan-add.sh etc. which seem as they are the scripts triggered when one inserts a 3G dongle. But I was unsuccessful finding where these scripts are triggered.
Another thing is the
/sbin/hotplug, but this has only binary code.
And again, there are already some scripts on the router, however I haven't found a location where they are triggered and how to do it:
~ # ls -l /opt/scripts/
-rwxr-xr-x 1 supervis root 33 Aug 28 2014 bcmlog
-rwxr-xr-x 1 supervis root 218 Aug 28 2014 db
-rwxr-xr-x 1 supervis root 223 Aug 28 2014 dh
-rwxr-xr-x 1 supervis root 40 Aug 28 2014 dumpmem
-rwxr-xr-x 1 supervis root 8607 Jul 15 2015 dumpsysinfo.sh
-rwxr-xr-x 1 supervis root 217 Aug 28 2014 dw
-rwxr-xr-x 1 supervis root 153 Aug 28 2014 fb
-rwxr-xr-x 1 supervis root 157 Aug 28 2014 fh
-rwxr-xr-x 1 supervis root 153 Aug 28 2014 fw
-rwxr-xr-x 1 supervis root 134 Aug 28 2014 sb
-rwxr-xr-x 1 supervis root 46 Aug 28 2014 setmem
-rwxr-xr-x 1 supervis root 138 Aug 28 2014 sh
-rwxr-xr-x 1 supervis root 282 Aug 28 2014 spitr
-rwxr-xr-x 1 supervis root 1319 Jul 15 2015 stress-fs-flist.txt
-rwxr-xr-x 1 supervis root 8023 Jul 15 2015 stress-fs.sh
-rwxr-xr-x 1 supervis root 568 Jul 15 2015 stress-proc.sh
-rwxr-xr-x 1 supervis root 715 Jul 15 2015 stress-xdslupdown.sh
-rwxr-xr-x 1 supervis root 134 Aug 28 2014 sw
Any help?