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>
This commit is contained in:
Gerardo Exequiel Pozzi 2010-03-01 10:39:01 -03:00
parent 1a80486e95
commit c65f463ce3
2 changed files with 23 additions and 5 deletions

View File

@ -15,6 +15,12 @@ _mnt_squashfs() {
img_name="${img_fullname%.*}" img_name="${img_fullname%.*}"
tmp_mnt="/tmpfs/mnt/${img_name}" 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}" msg "::: Adding new aufs branch: ${img_name}"
mkdir -p "${tmp_mnt}" mkdir -p "${tmp_mnt}"
/bin/mount -r -t squashfs "${img}" "${tmp_mnt}" /bin/mount -r -t squashfs "${img}" "${tmp_mnt}"
@ -34,6 +40,10 @@ run_hook () {
tmpfs_size="75%" tmpfs_size="75%"
fi fi
if [ "x${tmpfs_sqfs_size}" = "x" ]; then
tmpfs_sqfs_size="75%"
fi
if [ "x${isomounts}" != "x" ]; then if [ "x${isomounts}" != "x" ]; then
isomounts="/bootmnt/${isomounts}" isomounts="/bootmnt/${isomounts}"
else else
@ -55,6 +65,12 @@ archiso_mount_handler() {
mount -t tmpfs -o "size=${tmpfs_size}" tmpfs /tmpfs mount -t tmpfs -o "size=${tmpfs_size}" tmpfs /tmpfs
msg "done." 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..." msg ":: Waiting for boot device..."
while ! poll_device ${archisodevice} 30; do while ! poll_device ${archisodevice} 30; do
echo "ERROR: boot device didn't show up after 30 seconds..." 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 # Bind our bootmnt dir into the live system
_mnt_bind /bootmnt "${newroot}/bootmnt" _mnt_bind /bootmnt "${newroot}/bootmnt"
if [ "${FSTYPE}" = "iso9660" -o "${FSTYPE}" = "udf" ]; then if [ "${copytoram}" != "y" ]; then
if [ -d /proc/sys/dev/cdrom ]; then if [ "${FSTYPE}" = "iso9660" ] || [ "${FSTYPE}" = "udf" ]; then
echo 0 > /proc/sys/dev/cdrom/lock if [ -d /proc/sys/dev/cdrom ]; then
echo 0 > /proc/sys/dev/cdrom/autoeject echo 0 > /proc/sys/dev/cdrom/lock
echo 0 > /proc/sys/dev/cdrom/autoeject
fi
fi fi
fi fi
} }
# vim:ft=sh:ts=4:sw=4:et: # vim:ft=sh:ts=4:sw=4:et:

View File

@ -10,6 +10,7 @@ install ()
BINARIES="" BINARIES=""
FILES="" FILES=""
add_dir /tmpfs add_dir /tmpfs
add_dir /tmpfs.sqfs
add_dir /bootmnt add_dir /bootmnt
add_device /dev/loop0 b 7 0 add_device /dev/loop0 b 7 0
SCRIPT="archiso" SCRIPT="archiso"