summaryrefslogtreecommitdiffstats
path: root/files/90mgalive/mgalive-root.sh
blob: 96f1fb1e6390ae2be83ea1dcde86849ab9a243a7 (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
26
27
28
29
30
31
32
33
#!/bin/sh

. /lib/dracut-lib.sh

[ -f /tmp/root.info ] && . /tmp/root.info

PATH=/usr/sbin:/usr/bin:/sbin:/bin

[ -z "$1" ] && exit 1
livedev="$1"

# create live tree
mkdir -m 0755 -p /live/media
mkdir -m 0755 -p /live/distrib
mkdir -m 0755 -p /live/memory
mkdir -m 0755 -p /live/union

# mount the livecd
mount -n -t iso9660 -o ro $livedev /live/media

LOOPDEV=$( losetup -f )
losetup -r $LOOPDEV /live/media/loopbacks/distrib-lzma.sqfs
mount -n -t squashfs -o ro $LOOPDEV /live/distrib
mount -n -t tmpfs -o mode=755 /live/memory /live/memory
mount -n -t unionfs -o dirs=/live/memory=rw:/live/distrib=ro unionfs /live/union

ln -s /live/union /dev/root

printf '/bin/mount --rbind /live/union %s\n' "$NEWROOT" > $hookdir/mount/01-$$-live.sh

need_shutdown

exit 0