aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
Diffstat (limited to 'target')
-rwxr-xr-xtarget/linux/generic/other-files/init12
1 files changed, 11 insertions, 1 deletions
diff --git a/target/linux/generic/other-files/init b/target/linux/generic/other-files/init
index 514be57e66..521655b8c2 100755
--- a/target/linux/generic/other-files/init
+++ b/target/linux/generic/other-files/init
@@ -1,4 +1,14 @@
#!/bin/sh
# Copyright (C) 2006 OpenWrt.org
export INITRAMFS=1
-exec /sbin/init
+
+# switch to tmpfs to allow run daemons in jail on initramfs boot
+DIRS=$(echo *)
+NEW_ROOT=/new_root
+
+mkdir -p $NEW_ROOT
+mount -t tmpfs tmpfs $NEW_ROOT
+
+cp -pr $DIRS $NEW_ROOT
+
+exec switch_root $NEW_ROOT /sbin/init