summaryrefslogtreecommitdiff
path: root/system.c
diff options
context:
space:
mode:
Diffstat (limited to 'system.c')
-rw-r--r--system.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/system.c b/system.c
index 7855659..83aea42 100644
--- a/system.c
+++ b/system.c
@@ -36,6 +36,7 @@
static struct blob_buf b;
static int notify;
static struct ubus_context *_ctx;
+static int initramfs;
enum vjson_state {
VJSON_ERROR,
@@ -55,6 +56,9 @@ static int system_board(struct ubus_context *ctx, struct ubus_object *obj,
blob_buf_init(&b, 0);
+ if (initramfs)
+ blobmsg_add_u8(&b, "initramfs", 1);
+
if (uname(&utsname) >= 0)
{
blobmsg_add_string(&b, "kernel", utsname.release);
@@ -759,6 +763,11 @@ void ubus_init_system(struct ubus_context *ctx)
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));