I am trying to build a custom image in the imagebuilder docker image and I must be doing something wring with my custom files because they are never copied. I have tried both relative and absolute file paths in FILES="..."
, but neither seem to work.
Per https://openwrt.org/docs/guide-user/additional-software/imagebuilder#custom_files and https://openwrt.org/docs/guide-developer/uci-defaults#integrating_custom_settings : I have created the folder /builder/files/etc/uci-defaults
inside the docker image and put my script in there.
here is the script I am trying to add:
cat << "EOF" > /etc/uci-defaults/90-mxi-defaults
uci -q batch << EOI
# Configure network interface for Docker
uci set network.dockerlan=interface
uci set network.dockerlan.proto='none'
uci set network.dockerlan.device='docker1'
# Configure firewall zone for Docker
uci set firewall.docker=zone
uci set firewall.docker.input='ACCEPT'
uci set firewall.docker.output='ACCEPT'
uci set firewall.docker.forward='ACCEPT'
uci set firewall.docker.name='docker'
uci set firewall.docker.network='dockerlan' 'docker'
# Configure firewall forwards for Docker zone
uci add firewall forwarding
uci set firewall.@forwarding[-1].src='docker'
uci set firewall.@forwarding[-1].dest='lan'
uci add firewall forwarding
uci set firewall.@forwarding[-1].src='docker'
uci set firewall.@forwarding[-1].dest='wan'
uci add firewall forwarding
uci set firewall.@forwarding[-1].src='lan'
uci set firewall.@forwarding[-1].dest='docker'
# Add redirect rule for luci-http
uci add firewall redirect
uci set firewall.@redirect[-1].target='DNAT'
uci set firewall.@redirect[-1].name='luci-http'
uci set firewall.@redirect[-1].src='wan'
uci set firewall.@redirect[-1].src_dport='8180'
uci set firewall.@redirect[-1].dest_port='80'
# Add redirect rule for ssh-wan
uci add firewall redirect
uci set firewall.@redirect[-1].target='DNAT'
uci set firewall.@redirect[-1].name='ssh-wan'
uci set firewall.@redirect[-1].src='wan'
uci set firewall.@redirect[-1].src_dport='2200'
uci set firewall.@redirect[-1].dest_port='22'
# Add firewall rule for code-server
uci add firewall rule
uci set firewall.@rule[-1].name='code-server'
uci set firewall.@rule[-1].src='wan'
uci set firewall.@rule[-1].dest_port='8443'
uci set firewall.@rule[-1].target='ACCEPT'
uci set firewall.@rule[-1].enabled='0'
# Add firewall rule for mxi-agent
uci add firewall rule
uci set firewall.@rule[-1].name='mxi-agent'
uci set firewall.@rule[-1].src='wan'
uci set firewall.@rule[-1].dest_port='5000'
uci set firewall.@rule[-1].target='ACCEPT'
uci set firewall.@rule[-1].enabled='0'
# Add redirect rule for dozzle
uci add firewall redirect
uci set firewall.@redirect[-1].target='DNAT'
uci set firewall.@redirect[-1].name='dozzle'
uci set firewall.@redirect[-1].src='wan'
uci set firewall.@redirect[-1].src_dport='8880'
uci set firewall.@redirect[-1].dest_port='8080'
uci set firewall.@redirect[-1].enabled='0'
# Add firewall rule for mxi-config
uci add firewall rule
uci set firewall.@rule[-1].name='mxi-config'
uci set firewall.@rule[-1].src='wan'
uci set firewall.@rule[-1].dest_port='8000'
uci set firewall.@rule[-1].target='ACCEPT'
uci set firewall.@rule[-1].enabled='0'
# Add firewall rule for ttyd (webtty) on port 7681
uci add firewall rule
uci set firewall.@rule[-1].name='ttyd'
uci set firewall.@rule[-1].src='wan'
uci set firewall.@rule[-1].dest_port='7681'
uci set firewall.@rule[-1].target='ACCEPT'
uci set firewall.@rule[-1].enabled='1'
# Set system time zone and hostname
uci set system.@system[0].zonename='America/Los_Angeles'
uci set system.@system[0].hostname='OpenWrt'
# Commit the changes
uci commit
EOI
EOF
I launch the build with
make image PROFILE=friendlyarm_nanopi-r5s ROOTFS_PARTSIZE="512" PACKAGES="luci luci-app-dockerman luci-app-ttyd nano docker dockerd docker-compose block-mount git-http lsblk fdisk" FILES="/builder/files/"
(Have also tried FILES="files"
relative path)
The build goes fine, I grab the resulting image and flash my device.
...after flashing... the uci settings arent applied and both /etc/uci-defaults
and /rom/etc/uci-defaults
are both empty.
Am I adding custom files correctly? or am i doing something wrong?