summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2014-06-11 03:37:08 +0200
committerJohn Crispin <blogic@openwrt.org>2014-06-11 03:37:08 +0200
commitb76eda6cd8ba061f49af4074838e6a42ae94144c (patch)
treed1352b0c171a391bc1cb47988de7c5035dc3482d
parent13259259bc53657617844660f2664f4b4fb4ac02 (diff)
downloadunitd-b76eda6cd8ba061f49af4074838e6a42ae94144c.tar
unitd-b76eda6cd8ba061f49af4074838e6a42ae94144c.zip
only add the nandupgrade method when /sbin/upgraded exists
Signed-off-by: John Crispin <blogic@openwrt.org>
-rw-r--r--system.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/system.c b/system.c
index 2110035..29ca656 100644
--- a/system.c
+++ b/system.c
@@ -342,6 +342,8 @@ static const struct ubus_method system_methods[] = {
UBUS_METHOD_NOARG("upgrade", system_upgrade),
UBUS_METHOD("watchdog", watchdog_set, watchdog_policy),
UBUS_METHOD("signal", proc_signal, signal_policy),
+
+ /* must remain at the end as it ia not always loaded */
UBUS_METHOD("nandupgrade", nand_set, nand_policy),
};
@@ -371,8 +373,12 @@ procd_bcast_event(char *event, struct blob_attr *msg)
void ubus_init_system(struct ubus_context *ctx)
{
+ struct stat s;
int ret;
+ if (stat("/sbin/upgraded", &s))
+ system_object.n_methods -= 1;
+
_ctx = ctx;
ret = ubus_add_object(ctx, &system_object);
if (ret)