ImageBuilder: how to edit /etc/rc.local

I'd like to be able to build an install image using ImageBuilder that has a custom script in /etc/rc.local. OpenWRT 18.06 seems to have a bug on one of the devices I'm using, so I'm working around it by putting this in /etc/rc.local:

(sleep 30; /etc/init.d/dnsmasq restart) &

I'd like to build an image that has that line already in it. Is that possible using ImageBuilder?

Thanks!

Yes.
Follow the advice about custom files in wiki. you need to use FILES= variable in the imagebuilder command line to include a ready /etc/rc.local file into the build.

https://openwrt.org/docs/guide-user/additional-software/imagebuilder#files_variable

2 Likes

That worked perfectly. Thank you. For anyone else who has this same problem, I created files/etc/rc.local in the ImageBuilder directory and then ran:

make PROFILE=WNR2000V4 image FILES=files/ CONFIG_IPV6=n PACKAGES="uhttpd uhttpd-mod-ubus libiwinfo-lua luci-base luci-app-firewall luci-mod-admin-full luci-theme-bootstrap -ppp -ppp-mod-pppoe -ip6tables -odhcp6c -kmod-ipv6 -kmod-ip6tables -odhcpd-ipv6only -opkg" 

That gave me an image that actually works on a WNR2000v4. (Small enough that config space is available.) Yay!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.