summaryrefslogtreecommitdiff
path: root/packages/unionfs/unionroot/init.unionroot
blob: bfd86886a06a2348af9018dd39e6f063882e9b1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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}