Consider consolidation of owut config into /etc/config/attendedsysupgrade
Closed this issue · 3 comments
From openwrt/packages#24324 (comment) very last comment
Maybe we can move all settings to attended-sysupgrade UCI config file instead of having another one just for owut?
The only hard part is installation, how do we get the initial entry into /etc/config/attendedsysupgrade
? Traditionally it's via automatically generated opkg
via conffiles, but this needs to add to the already-existing file, but only if it has not already been modified.
Maybe an opkg postinst script that does something like this? Or something I don't know about?
owut=$(uci get attendedsysupgrade.owut)
if [ -z "$owut" ]; then
...
I scanned the postinst
sections in all the package makefiles where it's used, and none of them use uci
directly. So, based on that the following makes me somewhat uncomfortable, but it seems to work just fine.
@BKPepe Would this be acceptable as a means for extending an existing config file? It would replace the existing conffiles
section in https://github.com/openwrt/packages/pull/24324/files
define Package/owut/postinst
#!/bin/sh
conf_file="/etc/config/attendedsysupgrade"
[ -z "$$(uci get attendedsysupgrade.owut 2> /dev/null)" ] && \
cat <<CONF >> "$$conf_file"
# Example configuration for 'owut'. The option names are the same
# as those used on the command line, with all '-' dashes replaced by
# '_' underscores. Use 'owut --help' to see more.
config owut 'owut'
# option verbosity 0
# option keep 0
# option init_script '/root/data/my-init-script.sh'
# option image '/tmp/my-firmware-img.bin'
# option rootfs_size '256'
CONF
echo "Please see owut section of $$conf_file for example options."
exit 0
endef
Implemented via uci-defaults
script in 86a5f6f and deployed in openwrt/packages@bb0b4e7