#define _POSIX_SOURCE
+#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <signal.h>
reboot(RB_AUTOBOOT);
}
+#ifndef RECOVERY_GUI
+static int run_default(config_t *cfg)
+{
+ config_setting_t *node;
+ const char *action, *handler;
+
+ node = config_lookup(cfg, "headless_action");
+ if (!node)
+ return -ENOENT;
+
+ action = config_setting_get_string(node);
+ node = config_lookup(cfg, "action_handlers");
+ if (!node)
+ return -ENOENT;
+
+ if (config_setting_lookup_string(node, action, &handler) == CONFIG_FALSE)
+ return -ENOENT;
+
+ return system(handler);
+}
+#endif
+
int main(void)
{
config_t cfg;
ev_exit();
recovery_rui_exit();
#else
- // XXX: run default action
+ ret = run_default(&cfg);
#endif
LOGD("[main] recovery finished.\n");
+ config_destroy(&cfg);
return 0;
}