[LEDE-DEV] [PATCH] Mountd: Add sysupgrade functionality.
Olivier Hardouin
olivier.hardouin at gmail.com
Fri Jul 8 01:21:26 PDT 2016
Hi Philipp,
> Yes, good point. But then we should rewrite/redesign the whole update
> process
> including the sysupgrade binary in my opinion. For example writing a
> small library and a daemon
> which does the updates for us. A daemon which executes a sysupgrade tool
> doesn't
> make more sense for me as the mountd solution.
I'm not sure why a complete re-design of the sysupgrade would be
needed in this particular case.
At the end you only want to trigger the upgrade when a stick is
inserted, and hotplug can do that.
If the following (untested and unfinished) script is stored in
/etc/hotplug.d/mount/99-autoupgrade, it would perform the upgrade.
#/bin/sh
if [ "${ACTION}" == "add" ]; then
if [[ "$(uci get -q autoupgrade.usbdisk.enabled)" == "1" ]]; then
filename="$(uci get -q
mountd.mountd.path)${NAME}/$(uci get -q autoupgrade.usbdisk.filename)"
[[ ! -f "$filename" ]] && exit
uci get -q autoupgrade.usbdisk.delay >/dev/null &&
delay="-d $(uci get -q autoupgrade.usbdisk.delay)"
[[ "$(uci get -q autoupgrade.usbdisk.save_config)" ==
"1" ]] && backup="-c" || backup="-n"
[[ "$(uci get -q autoupgrade.usbdisk.preserve_part)" =
"1" ]] && preserve_partition="-p"
logger -t hotplug " Starting upgrade with
/sbin/sysupgrade $delay $backup $preserve_partition $filename"
/sbin/sysupgrade $delay $backup $preserve_partition $filename
# TODO find a good way to not execute this at every boot ...
fi
fi
The uci config is the same as what you described in your patch (just
replace mountd by autoupgrade).
This is a proof of concept. You may argue about doing the upgrade from
within a hotplug script. I indeed would be cleaner to have a separate
daemon, especially if they are several sources for the upgrade (and
not only the usb).
Olivier
More information about the Lede-dev
mailing list