[arch-releng] [PATCH 3/4] Welcome back copytoram= option
Fixes FS#17182: copytoram=y does not work with aufs The solution is simple, just use a directory outside aufs tree. * If copytoram=y, then another tmpfs is mounted but on /tmpfs.sqfs * Add a new option: tmpfs_sqfs_size= (default to 75%) * Lock cdrom drive is not locked if copytoram=y Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- archiso/hooks/archiso | 27 ++++++++++++++++++++++----- archiso/install/archiso | 1 + 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index 9997b38..1ac4d86 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -15,6 +15,12 @@ _mnt_squashfs() { img_name="${img_fullname%.*}" tmp_mnt="/tmpfs/mnt/${img_name}" + if [ "${copytoram}" = "y" ]; then + msg ":: Copying squashfs image to RAM" + /bin/cp "${img}" "/tmpfs.sqfs/${img_fullname}" + img="/tmpfs.sqfs/${img_fullname}" + fi + msg "::: Adding new aufs branch: ${img_name}" mkdir -p "${tmp_mnt}" /bin/mount -r -t squashfs "${img}" "${tmp_mnt}" @@ -34,6 +40,10 @@ run_hook () { tmpfs_size="75%" fi + if [ "x${tmpfs_sqfs_size}" = "x" ]; then + tmpfs_sqfs_size="75%" + fi + if [ "x${isomounts}" != "x" ]; then isomounts="/bootmnt/${isomounts}" else @@ -55,6 +65,12 @@ archiso_mount_handler() { mount -t tmpfs -o "size=${tmpfs_size}" tmpfs /tmpfs msg "done." + if [ "${copytoram}" = "y" ]; then + msg -n ":: Mounting tmpfs (for squashfs), size=${tmpfs_sqfs_size}..." + mount -t tmpfs -o "size=${tmpfs_sqfs_size}" tmpfs /tmpfs.sqfs + msg "done." + fi + msg ":: Waiting for boot device..." while ! poll_device ${archisodevice} 30; do echo "ERROR: boot device didn't show up after 30 seconds..." @@ -114,13 +130,14 @@ archiso_mount_handler() { # Bind our bootmnt dir into the live system _mnt_bind /bootmnt "${newroot}/bootmnt" - if [ "${FSTYPE}" = "iso9660" -o "${FSTYPE}" = "udf" ]; then - if [ -d /proc/sys/dev/cdrom ]; then - echo 0 > /proc/sys/dev/cdrom/lock - echo 0 > /proc/sys/dev/cdrom/autoeject + if [ "${copytoram}" != "y" ]; then + if [ "${FSTYPE}" = "iso9660" ] || [ "${FSTYPE}" = "udf" ]; then + if [ -d /proc/sys/dev/cdrom ]; then + echo 0 > /proc/sys/dev/cdrom/lock + echo 0 > /proc/sys/dev/cdrom/autoeject + fi fi fi - } # vim:ft=sh:ts=4:sw=4:et: diff --git a/archiso/install/archiso b/archiso/install/archiso index 4d36412..d01ab25 100644 --- a/archiso/install/archiso +++ b/archiso/install/archiso @@ -10,6 +10,7 @@ install () BINARIES="" FILES="" add_dir /tmpfs + add_dir /tmpfs.sqfs add_dir /bootmnt add_device /dev/loop0 b 7 0 SCRIPT="archiso" -- 1.7.0
New function _mnt_aufs(). Don't display incorrect message (Adding new aufs...) when no aufs branch is mounted, because mount type is bind. Also, makes the code more clean :) Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- archiso/hooks/archiso | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index 1ac4d86..73f4df9 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -1,4 +1,13 @@ # args: source, mountpoint +_mnt_aufs() { + src="${1}" + mnt="${2}" + msg "::: Adding new aufs branch: ${src} to ${mnt}" + mkdir -p "${mnt}" + /bin/mount -t aufs -o remount,append:"${src}"=ro none "${mnt}" +} + +# args: source, mountpoint _mnt_bind() { src="${1}" mnt="${2}" @@ -16,16 +25,17 @@ _mnt_squashfs() { tmp_mnt="/tmpfs/mnt/${img_name}" if [ "${copytoram}" = "y" ]; then - msg ":: Copying squashfs image to RAM" + msg -n ":: Copying squashfs image to RAM" /bin/cp "${img}" "/tmpfs.sqfs/${img_fullname}" img="/tmpfs.sqfs/${img_fullname}" + msg "done." fi - msg "::: Adding new aufs branch: ${img_name}" mkdir -p "${tmp_mnt}" /bin/mount -r -t squashfs "${img}" "${tmp_mnt}" + if [ "/${mnt#/*/}" = "/" ]; then - /bin/mount -t aufs -o remount,append:"${tmp_mnt}"=ro none "${mnt}" + _mnt_aufs "${tmp_mnt}" "${mnt}" else _mnt_bind "${tmp_mnt}" "${mnt}" fi -- 1.7.0
participants (1)
-
Gerardo Exequiel Pozzi