Image builder fail to load custom files for firewall in GL-AR150

HI

Im looking how to create a custom image for GL-AR150 with custom files,and Im using

Imagebuilder from Github

All part to update and install packages goes nice, my problem is to use files function. In my case Im checking to use “customize.json” file from root imagebuildrer folder adding this lines

“project”:{
“profile”: “gl-ar150”,
“version”: “3.027”,
“imagebuilder”: “3.1/openwrt-imagebuilder-ar71xx-generic_3.1”,
“packages”: “gl-base-files-ar $basic $vpn $storage $usb $glinet tcpdump logrotate curl gawk”,
“files”: “etc/config/firewall”
}

and not appears any error but firewall file not appears modified. I create a “files” folder to create all tree like

$IMAGEFOLDER_ROOT/files/etc/config/firewall

being in same level that imagebuilder folder used in “imagebuilder” section. To understand:

imagebuilder
├── bin
├── config
├── customize.json
├── Dockerfile
├── gl_image
├── glinet
├── imagebuilder
├── openwrt
├── files

After to exec

gl_image -c customize.json -p project 

Create the image .bin but not appears new file being always default file. Any idea?

I was checking inside history and only I saw similar this topic, but still incomplete.

The files path should be the root path of all your files. For example, if you put /etc/config/firewall in

/home/xxx/openwrt/files/etc/config/firewall, you need to write
“files”: “/home/xxx/openwrt/files”

It will simply copy all the contents to your firmware to override the other files. Note, you have to set the correct access right first. For example if you have a executable script you need to use chmod +x yourshcript.sh in your host system.

To update this case, for now I detected that only you can upload non config files, because script process will remove files in the process to setup.

inside customize.json you need to add for example:

"files": "imagebuilder/3.1/openwrt-imagebuilder-ar71xx-generic_3.1/files" 

and this folder “files” is the root tree to copy files, in my case I created

imagebuilder/3.1/openwrt-imagebuilder-ar71xx-generic_3.1/files/etc/config/test

but I don’t know how to change config templates.

What do you want to change?

Which files do you want to modify?
Could you please show me your operate step by step?
Thanks.

My idea in this thread is only to change firewall file config. Other idea is justly to setup crontab and logrotate, but I imagine is a bit different

You better not modify the firewall configuration directly.
This may cause you to lose access to the router. And you had to use uboot to debrick your router.
I recommend you to write a startup script to change it.

is it possible to put firewall in / / /files/root/firewall
and a modded /files/etc/rc.local

where rc.local has
onetime()
cp /root/firewall /etc/config
rm /root/firewall

Your changes about the firewall need to be based on the firewall configuration after the system initialized.
Therefore, you can copy the firewall configuration from the router to the Imagebuilder to make a default configuration.

Yes, but I can’t find the file that configs default values. I was looking different folders but never change de file when compile.

You need to copy a firewall config from your existing working firmware and put it in your imagebuilder files.

It is actually just easy.

Hi

I copied customized firewall file into:

./gl_imagebuilder/imagebuilder/3.1/openwrt-imagebuilder-ar71xx-generic_3.1/build_dir/target-mips_24kc_musl/root-ar71xx/etc/config/firewall 

I compiled

./gl_image --offline -c customize.json -p ondego 

(I used offline mode to be sure than nothing is replaced)

and extracted:

binwalk -e openwrt-ondego-3.027-0219_customize.bin

inside the package I can’t find any file firewall with similar content

$ find ./ -name “*firewall”
./S19firewall
./gl-firewall
./firewall
./20-firewall

being firewall file this code;

#!/bin/sh /etc/rc.common

START=19
USE_PROCD=1
QUIET=“”
etc…

Where is setting firewall openwrt?

You should put your firewall in your “files” path, not root-ar71xx. That is how “files” work.

imagebuilder/3.1/openwrt-imagebuilder-ar71xx-generic_3.1/files/etc/config/firewall

Checking I see how I included in both places. test file works, firewall file is changed.

Hi

to update and close thread the problem was the form to use sysupgrade command

By default sysupgrade not remove system. To work fine is

sysupgrade -n /tmp/image.bin

Documentation advise but putting bad the first example and induce to error.

1 Like