It can be good for UI to show to the user that the system was booted
from initramfs ie. no writable permanent storage is available.
I imagine LuCI only serving applications which are explicitely marked
as being shown even in initramfs mode, ie. nothing but status,
network->interfaces, network->wireless, system->upgrade,
system->backup, system->backuprestore tabs.
Also sysupgrade could take into account we are running on initramfs
and perform offline backup/restore of whatever is in the flash.
In that way OpenWrt-generated initramfs-images can serve as recovery
OS on devices with dual-boot in a meaningful way.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
if (plugd_proc.pid > 0)
kill(plugd_proc.pid, SIGKILL);
- unsetenv("INITRAMFS");
unsetenv("PREINIT");
unlink("/tmp/.preinit");
static struct blob_buf b;
static int notify;
static struct ubus_context *_ctx;
+static int initramfs;
enum vjson_state {
VJSON_ERROR,
blob_buf_init(&b, 0);
+ if (initramfs)
+ blobmsg_add_u8(&b, "initramfs", 1);
+
if (uname(&utsname) >= 0)
{
blobmsg_add_string(&b, "kernel", utsname.release);
int ret;
_ctx = ctx;
+
+ initramfs = !!getenv("INITRAMFS");
+ if (initramfs)
+ unsetenv("INITRAMFS");
+
ret = ubus_add_object(ctx, &system_object);
if (ret)
ERROR("Failed to add object: %s\n", ubus_strerror(ret));