Actually, all config files get an `-opkg' extension if they are not upgraded. Is there any way to merge these configs automatically? If a conflict occurs, always take the latest option for a config value from a config file.
Maybe we could do following:
- The uci defaults are in
/rom/etc/uci-defaults
and the config is under/rom/etc/config
- Copy the default config to
cp -r /rom/etc/config /tmp/config
- Run the uci defaults on the /tmp/config (not sure I have to test this, but maybe something like
uci -c /tmp/config
or some (-p
or-P
option)- Do a diff with diffutils
diff /tmp/config /etc/config > changes.patch
Hmmm, maybe we could do something with
sed -i 's/uci/uci -c \/tmp\/config/g' *
(https://github.com/Freifunk-Spalter/packages/issues/18#issuecomment-679139414)
That did not work.
Further I found a script to compare uci configs in the openwrt forum archive. But I can not find the forum post anymore.
#!/bin/sh
cd /etc/config
for F in *
do
echo
echo "===== $F ====="
uci -c /rom/etc/config export $F >/tmp/$F.default 2>/dev/null
case $? in 0) ;; *) echo '>> no default in /rom <<' ;; esac
uci export $F >/tmp/$F.current
diff /tmp/$F.default /tmp/$F.current
rm -f /tmp/$F.default /tmp/$F.current
done
Maybe diff is better with diff -a -b -d /rom/etc/config/dhcp /etc/config/dhcp
Thank u!
Any idea how can I get the config after a firstboot? I need to get the diff after the uci-default
scripts were applied.
This is a bit of a hassle:
Thought about this, too.
But between 2 and 3 is a reboot. Actually, I want to do this at some remote AP, so I need some automation to get back to the first backup automatically.
your welcome to give my rollback.sh a try... beta and very messy but gives you some ideas... ( will be integrating some of the master @vgaetera 's work into it, thanyou! )
Did u remove the link?
you can find it in the rtfs.tar.gz on the top post here ...