This is my current workaround for ASUS routers that no longer execute commands in the script_usbmount NVRAM variable on USB mount.
Additionally, the variable is now being cleaned by (most likely) asd (Asus Security Daemon) on newer firmware.
Your router must have a USB port and support ASUS Download Master.
The easiest way to install this is to run the installer while having only one USB storage plugged in:
curl "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/asusware-usb-mount-script/asusware-usb-mount-script.sh" | shcurl is not available? try wget
wget "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/asusware-usb-mount-script/asusware-usb-mount-script.sh" -O - | shIf the installer fails for some reason then you can download asusware-usb-mount-script.zip then extract asusware.arm directory to the root of your USB storage device.
Important
If your router's architecture is not ARM then you will have to replace it with the correct one in these files:
- asusware.arm/lib/ipkg/status
- asusware.arm/lib/info/usb-mount-script.control
- asusware.arm/lib/lists/optware.asus
You will also need to rename asusware.arm directory to contain the new architecture suffix as well.
Known supported architecture values are arm, mipsbig, mipsel.
For mipsel, the directory has to be called just asusware (no suffix).
The script is hardcoded to launch /jffs/scripts/usb-mount-script script after USB storage is mounted.
You can modify asusware.arm/etc/init.d/S50usb-mount-script script to run your own logic.
You can also add more scripts to asusware.arm/etc/init.d directory if you wish.
- grab another USB stick
- plug it into the router (it has to be the only one plugged in)
- install Download Master
- "safely remove disk" through the ASUS web UI
- unplug the USB stick and reboot the router
- plug in the "workaround" stick - it should work now
To reduce the delay before the script is triggered you can prevent the firmware from checking mounted filesystems for errors.
Warning
Do not do this if you're using the USB stick for other purposes like file share or Entware.
Power failures will lead to filesystem corruption, without fsck running regularly it will eventually make the filesystem broken.
nvram set stop_fsck=1
nvram commit