aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/unionfs/unionroot/init.unionroot
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/unionfs/unionroot/init.unionroot')
-rwxr-xr-xrecipes/unionfs/unionroot/init.unionroot25
1 files changed, 25 insertions, 0 deletions
diff --git a/recipes/unionfs/unionroot/init.unionroot b/recipes/unionfs/unionroot/init.unionroot
new file mode 100755
index 0000000000..bfd86886a0
--- /dev/null
+++ b/recipes/unionfs/unionroot/init.unionroot
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+PATH=/usr/bin:/usr/sbin:/bin:/sbin
+INIT=/sbin/init.sysvinit
+ROOTBACKUP=/media/realroot
+UNION=/media/union
+
+if ! which unionctl; then
+ echo >&2 "ERROR: Package unionfs-utils not installed!"
+ exec ${INIT} $@
+fi
+
+# For shutdown
+if ! [ -z "$@" ]; then
+ exec ${INIT} $@
+fi
+
+mount.busybox /proc
+insmod /lib/modules/`uname -r`/kernel/fs/unionfs.o
+mount.busybox -t unionfs -o dirs=/.=rw,setattr=all none ${UNION}
+umount.busybox /proc
+
+cd ${UNION}
+pivot_root . ./${ROOTBACKUP}
+exec chroot . ${INIT}