From e8e25e37482b23caecfbef21a4e56747fd45e76e Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Mon, 15 Feb 2010 23:11:43 -0300 Subject: [PATCH] Implement mount hook in archiso hook. Next version of mkinitcpio implements mount hook. So can avoid skipping normal flow of init script, and some cleanups tasks. Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso | 32 +++++++++++--------------------- 1 files changed, 11 insertions(+), 21 deletions(-) diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index 434fd39..3b2a7b3 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -2,15 +2,15 @@ _mnt_bind() { msg "::: Binding ${1} to ${2}" - mkdir -p /real_root${2} - /bin/mount -o bind ${1} /real_root${2} + mkdir -p /new_root${2} + /bin/mount -o bind ${1} /new_root${2} } # args: /path/to/image_file _mnt_squashfs() { /sbin/modprobe -q loop > /dev/null 2>&1 - + img="${1}" base_img="${img##*/}"; mnt="${2}" @@ -34,7 +34,7 @@ _mnt_squashfs() fi /bin/mount -r -t squashfs "/dev/loop${LOOP_NUM}" "/tmpfs/mnt/loop${LOOP_NUM}" if [ "${mnt}" = "/" ]; then - /bin/mount -t aufs -o remount,append:/tmpfs/mnt/loop${LOOP_NUM}=ro none "/real_root" + /bin/mount -t aufs -o remount,append:/tmpfs/mnt/loop${LOOP_NUM}=ro none "/new_root" else _mnt_bind "/tmpfs/mnt/loop${LOOP_NUM}" "${mnt}" fi @@ -61,6 +61,11 @@ run_hook () archisodevice="/dev/archiso" fi + # set mount handler for archiso + mount_handler="archiso_mount_handler" +} + +archiso_mount_handler() { msg -n ":: Mounting tmpfs, size=${tmpfs_size}..." mount -t tmpfs -o "size=${tmpfs_size}" tmpfs /tmpfs msg "done." @@ -70,7 +75,7 @@ run_hook () echo "ERROR: boot device didn't show up after 30 seconds..." echo " Falling back to interactive prompt" echo " You can try to fix the problem manually, log out when you are finished" - PS1="ramfs$ " /bin/sh -i + launch_interactive_shell done FSTYPE=$(blkid -o value -s TYPE ${archisodevice} 2> /dev/null) @@ -91,7 +96,7 @@ run_hook () fi msg ":: Mounting root (aufs) filesystem" - /bin/mount -t aufs -o dirs=/tmpfs=rw none /real_root + /bin/mount -t aufs -o dirs=/tmpfs=rw none /new_root if [ $? -ne 0 ]; then echo "ERROR: while mounting root (aufs) filesystem." exit 1 @@ -124,21 +129,6 @@ run_hook () fi fi - if [ "${break}" = "y" ]; then - echo ":: Break requested, type 'exit' to resume operation" - PS1="ramfs$ " /bin/sh -i - fi - - #Special handling if udev is running - udevpid=$(/bin/pidof udevd) - if [ -n "${udevpid}" ]; then - /bin/kill -9 ${udevpid} > /dev/null 2>&1 - /bin/sleep 0.01 - fi - msg ":: Passing control to Arch Linux Initscripts...Please Wait" - /bin/umount /sys - /bin/umount /proc - exec /sbin/switch_root -c /dev/console /real_root /sbin/init ${CMDLINE} } # vim:ft=sh:ts=4:sw=4:et: -- 1.6.6.1