Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archiso/hooks
diff options
context:
space:
mode:
authorGerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>2010-02-16 16:59:18 -0300
committerGerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>2010-02-16 16:59:18 -0300
commitb880be1ae9d5fc2190d4e2178626776aecfa5243 (patch)
treeb62846c611ec31f85659255992ac68186cfbd5c8 /archiso/hooks
parent22f910736da3b225f46840bc7ad1ec41fefddece (diff)
Implement mount hook function in archiso hook.
Next version of mkinitcpio > 0.6.2 implements mount hook functionality. So can avoid skipping normal flow of main init script, and removing common end code with it. Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Diffstat (limited to 'archiso/hooks')
-rw-r--r--archiso/hooks/archiso34
1 files changed, 13 insertions, 21 deletions
diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso
index 434fd39..7b4d756 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 $newroot${2}
+ /bin/mount -o bind ${1} $newroot${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 "$newroot"
else
_mnt_bind "/tmpfs/mnt/loop${LOOP_NUM}" "${mnt}"
fi
@@ -61,6 +61,13 @@ run_hook ()
archisodevice="/dev/archiso"
fi
+ # set mount handler for archiso
+ mount_handler="archiso_mount_handler"
+}
+
+archiso_mount_handler() {
+ newroot="$1"
+
msg -n ":: Mounting tmpfs, size=${tmpfs_size}..."
mount -t tmpfs -o "size=${tmpfs_size}" tmpfs /tmpfs
msg "done."
@@ -70,7 +77,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 +98,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 $newroot
if [ $? -ne 0 ]; then
echo "ERROR: while mounting root (aufs) filesystem."
exit 1
@@ -124,21 +131,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: