RMerlin
Asuswrt-Merlin dev
Something that was asked a couple of times: how can you replace one of the webui pages without having to recompile the firmware?
First, you need to make a complete copy of the router's /www folder into a USB disk. Assuming your disk is mounted under /mnt/usb1/:
Next, if using ext2/ext3, make these pages writable:
Now the fun part: we want to tell the router to mount that writable folder on the USB disk on TOP of the router's /www directory. This is called a "bind mount".
And now, to tell the httpd service to restart itself, so it can notice the change:
There you go. The webui will still access the web content from /www, except that this folder will now point to the content from the USB disk instead of the content flashed in the firmware. So if you make any change:
You will be able to write your changes back. They will be stored on the USB disk, but the web server will be redirected to that content.
To have those modified pages used at every reboot, just have a services-start script to do the mount:
From now on, your router will be serving the pages from your USB disk.
Those bind mounts can be used for a lot of things. You just modified the "dnsmasq" binary, and want your router to always use the modified version? No problem - you can apply this to a single binary file as well.
Put the modified dnsmasq binary in the JFFS partition, inside /jffs/ (so it becomes available earlier than USB disks, which get mounted quite late)
Then, in init-start:
From now on, whenever the router will run the dnsmasq daemon, it will always use your modified version instead of the one flashed in the router's firmware.
First, you need to make a complete copy of the router's /www folder into a USB disk. Assuming your disk is mounted under /mnt/usb1/:
Code:
mkdir /mnt/usb1/www
cp -a /www/* /mnt/usb1/www
Next, if using ext2/ext3, make these pages writable:
Code:
chmod -R a+rwx /mnt/usb1/www/*
Now the fun part: we want to tell the router to mount that writable folder on the USB disk on TOP of the router's /www directory. This is called a "bind mount".
Code:
mount /mnt/usb1/www /www -o bind
And now, to tell the httpd service to restart itself, so it can notice the change:
Code:
service restart_httpd
There you go. The webui will still access the web content from /www, except that this folder will now point to the content from the USB disk instead of the content flashed in the firmware. So if you make any change:
Code:
nano -w /www/Advanced_Wireless_Survey.asp
You will be able to write your changes back. They will be stored on the USB disk, but the web server will be redirected to that content.
To have those modified pages used at every reboot, just have a services-start script to do the mount:
Code:
#!/bin/sh
mount /mnt/usb1/www /www -o bind
service restart_httpd
From now on, your router will be serving the pages from your USB disk.
Those bind mounts can be used for a lot of things. You just modified the "dnsmasq" binary, and want your router to always use the modified version? No problem - you can apply this to a single binary file as well.
Put the modified dnsmasq binary in the JFFS partition, inside /jffs/ (so it becomes available earlier than USB disks, which get mounted quite late)
Then, in init-start:
Code:
#!/bin/sh
mount /jffs/dnsmasq /usr/sbin/dnsmasq -o bind
From now on, whenever the router will run the dnsmasq daemon, it will always use your modified version instead of the one flashed in the router's firmware.