[archiso] Use different logic when archisodevice == cow_device

* Now bootmnt/img_dev is always a ro-mount,
  and cowspace is first ro-mount then rw-mount.

* Fix a "hidden" bug: at the time of test [[ -ef ]], if devices nodes
  are not ready, such test will fail then archisodevice will mounted ro and
  when cow_device is mounted to be rw it fails.
  (I recently suffered this on a machine with slow USB)

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
This commit is contained in:
Gerardo Exequiel Pozzi 2011-11-28 10:35:05 -03:00
parent e135003c13
commit e03ed816e0
3 changed files with 7 additions and 11 deletions

View File

@ -167,11 +167,7 @@ archiso_mount_handler() {
_init_loop_dev _init_loop_dev
if [[ "${archisodevice}" -ef "${cow_device}" ]]; then _mnt_dev "${archisodevice}" "/run/archiso/bootmnt" "-r"
_mnt_dev "${archisodevice}" "/run/archiso/bootmnt"
else
_mnt_dev "${archisodevice}" "/run/archiso/bootmnt" "-r"
fi
if [[ ! -f "${aitab}" ]]; then if [[ ! -f "${aitab}" ]]; then
echo "ERROR: '${aitab}' file does not exist." echo "ERROR: '${aitab}' file does not exist."
@ -203,7 +199,8 @@ archiso_mount_handler() {
fi fi
if [[ -n "${cow_device}" ]]; then if [[ -n "${cow_device}" ]]; then
_mnt_dev "${cow_device}" "/run/archiso/cowspace" _mnt_dev "${cow_device}" "/run/archiso/cowspace" "-r"
mount -o remount,rw "/run/archiso/cowspace"
else else
msg ":: Mounting /run/archiso/cowspace (tmpfs) filesystem, size=${cowspace_size}..." msg ":: Mounting /run/archiso/cowspace (tmpfs) filesystem, size=${cowspace_size}..."
mkdir -p /run/archiso/cowspace mkdir -p /run/archiso/cowspace

View File

@ -11,11 +11,7 @@ archiso_loop_mount_handler () {
newroot="${1}" newroot="${1}"
msg ":: Setup a loop device from ${img_loop} located at device ${img_dev}" msg ":: Setup a loop device from ${img_loop} located at device ${img_dev}"
if [[ "${img_dev}" -ef "${cow_device}" ]]; then _mnt_dev "${img_dev}" "/run/archiso/img_dev" "-r"
_mnt_dev "${img_dev}" "/run/archiso/img_dev"
else
_mnt_dev "${img_dev}" "/run/archiso/img_dev" "-r"
fi
_dev_loop=$(losetup -f) _dev_loop=$(losetup -f)
if ! losetup "${_dev_loop}" "/run/archiso/img_dev/${img_loop}"; then if ! losetup "${_dev_loop}" "/run/archiso/img_dev/${img_loop}"; then

View File

@ -14,6 +14,9 @@ build ()
add_file /lib/udev/rules.d/95-dm-notify.rules add_file /lib/udev/rules.d/95-dm-notify.rules
add_file /lib/initcpio/udev/11-dm-initramfs.rules /lib/udev/rules.d/11-dm-initramfs.rules add_file /lib/initcpio/udev/11-dm-initramfs.rules /lib/udev/rules.d/11-dm-initramfs.rules
# Add an empty fstab to avoid mount warning when -o remount is used (this should go to install/base)
: > "$BUILDROOT/etc/fstab"
SCRIPT="archiso" SCRIPT="archiso"
} }