archiso 1.64 KB
Newer Older
Aaron Griffin's avatar
Aaron Griffin committed
1
2
3
4
5
6
7
8
9
10
# vim: set ft=sh:
run_hook ()
{
    if [ "x${ramdisk_size}" = "x" ]; then
        ramdisk_size="75%"
    fi
    msg -n ":: Mounting tmpfs, size=${ramdisk_size}..."
	mount -t tmpfs -o "size=${ramdisk_size}" tmpfs /tmpfs
    msg "done."

11
12
13
    if [ "x${BOOT_MOUNT}" -eq "x" ]; then
        echo "ERROR: BOOT_MOUNT is not set. The boot-cd or boot-usb hook MUST"
        echo "       be run before this one.  This image was improperly built"
Aaron Griffin's avatar
Aaron Griffin committed
14
15
16
        exit 1
    fi

Simo Leone's avatar
Simo Leone committed
17
    squashimg="${BOOT_MOUNT}/archlive.sqfs"
18
    if [ "${copytoram}" = "y" ]; then
Simo Leone's avatar
Simo Leone committed
19
20
        /bin/cat ${squashimg} > /tmpfs/archlive.sqfs
        squashimg="/tmpfs/archlive.sqfs"
21
    fi
Aaron Griffin's avatar
   
Aaron Griffin committed
22

Aaron Griffin's avatar
   
Aaron Griffin committed
23
    msg ":: Mounting squashfs image"
Aaron Griffin's avatar
Aaron Griffin committed
24
    /bin/modprobe -q squashfs >/dev/null 2>&1
Aaron Griffin's avatar
Aaron Griffin committed
25
    /bin/mkdir -p /tmpfs/squashfs_root
Aaron Griffin's avatar
   
Aaron Griffin committed
26
    if ! /bin/losetup /dev/loop0 "${squashimg}" >/dev/null 2>&1; then
Aaron Griffin's avatar
Aaron Griffin committed
27
28
29
        echo "ERROR: Cannot mount loop device /dev/loop0...aborting"
        exit 1
    fi
Aaron Griffin's avatar
   
Aaron Griffin committed
30

Aaron Griffin's avatar
Aaron Griffin committed
31
    /bin/mount -r -t squashfs /dev/loop0 /tmpfs/squashfs_root
Aaron Griffin's avatar
Aaron Griffin committed
32

Aaron Griffin's avatar
   
Aaron Griffin committed
33
    msg ":: Mounting root (union) filesystem"
Aaron Griffin's avatar
Aaron Griffin committed
34
    /bin/modprobe -q unionfs >/dev/null 2>&1
Aaron Griffin's avatar
   
Aaron Griffin committed
35
    /bin/mount -t unionfs -o dirs=/tmpfs=rw:/tmpfs/squashfs_root=ro none /real_root
Aaron Griffin's avatar
Aaron Griffin committed
36

Aaron Griffin's avatar
Aaron Griffin committed
37
    if [ -d /proc/sys/dev/cdrom ]; then
Aaron Griffin's avatar
Aaron Griffin committed
38
39
40
41
42
        echo 0 > /proc/sys/dev/cdrom/lock
        echo 1 > /proc/sys/dev/cdrom/autoeject
    fi

    udevpid=$(/bin/minips -C udevd -o pid=)
Aaron Griffin's avatar
Aaron Griffin committed
43
    [ "x${udevpid}" != "x" ] && /bin/kill -9 $udevpid 2>&1 >/dev/null
Aaron Griffin's avatar
Aaron Griffin committed
44
    #Yep, we're bailing out here.  We don't need kinit.
Aaron Griffin's avatar
Aaron Griffin committed
45
    msg ":: Passing control to Archlinux Initscripts...Please Wait"
Aaron Griffin's avatar
   
Aaron Griffin committed
46
47
48
    /bin/umount /sys
    /bin/umount /proc
    /bin/umount /dev
Aaron Griffin's avatar
Aaron Griffin committed
49
50
    exec /bin/run-init -c /dev/console /real_root /sbin/init ${CMDLINE}
}