From 3321fb41381358767209aefa5232c32a67dd6144 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Sun, 23 Oct 2011 21:24:17 -0300 Subject: [archiso] Mount all fs on /run/archiso instead of / This allow to take control again of these mountpoints outside initramfs. (i.e: on deinitramfs stage at shutdown for unmount it) Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso | 66 +++++++++++++++++++++------------------- archiso/hooks/archiso_loop_mnt | 5 +-- archiso/install/archiso | 4 --- archiso/install/archiso_loop_mnt | 2 +- 4 files changed, 39 insertions(+), 38 deletions(-) (limited to 'archiso') diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index 4b512ef..e4872e2 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -40,23 +40,23 @@ _mnt_fs() { if [[ "${cow_persistent}" == "P" ]]; then - if [[ -f "/cowspace/${cow_directory}/${img_name}.cow" ]]; then - msg ":: Found '/cowspace/${cow_directory}/${img_name}.cow', using as persistent." + if [[ -f "/run/archiso/cowspace/${cow_directory}/${img_name}.cow" ]]; then + msg ":: Found '/run/archiso/cowspace/${cow_directory}/${img_name}.cow', using as persistent." else - msg ":: Creating '/cowspace/${cow_directory}/${img_name}.cow' as persistent." - dd of="/cowspace/${cow_directory}/${img_name}.cow" count=0 seek=${ro_dev_size} &> /dev/null + msg ":: Creating '/run/archiso/cowspace/${cow_directory}/${img_name}.cow' as persistent." + dd of="/run/archiso/cowspace/${cow_directory}/${img_name}.cow" count=0 seek=${ro_dev_size} &> /dev/null fi else - if [[ -f "/cowspace/${cow_directory}/${img_name}.cow" ]]; then - msg ":: Found '/cowspace/${cow_directory}/${img_name}.cow' but non-persistent requested, removing." - rm -f "/cowspace/${cow_directory}/${img_name}.cow" + if [[ -f "/run/archiso/cowspace/${cow_directory}/${img_name}.cow" ]]; then + msg ":: Found '/run/archiso/cowspace/${cow_directory}/${img_name}.cow' but non-persistent requested, removing." + rm -f "/run/archiso/cowspace/${cow_directory}/${img_name}.cow" fi - msg ":: Creating '/cowspace/${cow_directory}/${img_name}.cow' as non-persistent." - dd of="/cowspace/${cow_directory}/${img_name}.cow" count=0 seek=${ro_dev_size} &> /dev/null + msg ":: Creating '/run/archiso/cowspace/${cow_directory}/${img_name}.cow' as non-persistent." + dd of="/run/archiso/cowspace/${cow_directory}/${img_name}.cow" count=0 seek=${ro_dev_size} &> /dev/null fi _next_loop_dev - rw_dev=$(_make_loop_dev "/cowspace/${cow_directory}/${img_name}.cow") + rw_dev=$(_make_loop_dev "/run/archiso/cowspace/${cow_directory}/${img_name}.cow") echo "0 ${ro_dev_size} snapshot ${ro_dev} ${rw_dev} ${cow_persistent} 8" | dmsetup create ${dm_snap_name} @@ -77,11 +77,11 @@ _mnt_sfs() { if [[ "${copytoram}" == "y" ]]; then msg -n ":: Copying squashfs image to RAM..." - if ! cp "${img}" "/copytoram/${img_fullname}" ; then - echo "ERROR: while copy '${img}' to '/copytoram/${img_fullname}'" + if ! cp "${img}" "/run/archiso/copytoram/${img_fullname}" ; then + echo "ERROR: while copy '${img}' to '/run/archiso/copytoram/${img_fullname}'" launch_interactive_shell fi - img="/copytoram/${img_fullname}" + img="/run/archiso/copytoram/${img_fullname}" msg "done." fi _next_loop_dev @@ -100,6 +100,8 @@ _mnt_dev() { local fstype fserror + mkdir -p "${mnt}" + msg ":: Mounting '${dev}' to '${mnt}'" while ! poll_device "${dev}" 30; do @@ -132,7 +134,7 @@ _mnt_dev() { _verify_checksum() { local _status - cd "/bootmnt/${archisobasedir}" + cd "/run/archiso/bootmnt/${archisobasedir}" md5sum -c checksum.md5 > /checksum.log 2>&1 _status=$? cd "${OLDPWD}" @@ -150,9 +152,9 @@ run_hook() { [[ -z "${archisodevice}" ]] && archisodevice="/dev/disk/by-label/${archisolabel}" if [[ -z "${aitab}" ]]; then - aitab="/bootmnt/${archisobasedir}/aitab" + aitab="/run/archiso/bootmnt/${archisobasedir}/aitab" else - aitab="/bootmnt/${aitab}" + aitab="/run/archiso/bootmnt/${aitab}" fi if [[ -n "${cow_label}" ]]; then @@ -179,9 +181,9 @@ archiso_mount_handler() { _init_loop_dev if [[ "${archisodevice}" -ef "${cow_device}" ]]; then - _mnt_dev "${archisodevice}" "/bootmnt" + _mnt_dev "${archisodevice}" "/run/archiso/bootmnt" else - _mnt_dev "${archisodevice}" "/bootmnt" "-r" + _mnt_dev "${archisodevice}" "/run/archiso/bootmnt" "-r" fi if [[ ! -f "${aitab}" ]]; then @@ -192,7 +194,7 @@ archiso_mount_handler() { fi if [[ "${checksum}" == "y" ]]; then - if [[ -f "/bootmnt/${archisobasedir}/checksum.md5" ]]; then + if [[ -f "/run/archiso/bootmnt/${archisobasedir}/checksum.md5" ]]; then msg -n ":: Self-test requested, please wait..." if _verify_checksum; then msg "done. Checksum is OK, continue booting." @@ -208,17 +210,19 @@ archiso_mount_handler() { fi if [[ "${copytoram}" == "y" ]]; then - msg ":: Mounting /copytoram (tmpfs) filesystem, size=${copytoram_size}" - mount -t tmpfs -o "size=${copytoram_size}",mode=0755 copytoram /copytoram + msg ":: Mounting /run/archiso/copytoram (tmpfs) filesystem, size=${copytoram_size}" + mkdir -p /run/archiso/copytoram + mount -t tmpfs -o "size=${copytoram_size}",mode=0755 copytoram /run/archiso/copytoram fi if [[ -n "${cow_device}" ]]; then - _mnt_dev "${cow_device}" "/cowspace" + _mnt_dev "${cow_device}" "/run/archiso/cowspace" else - msg ":: Mounting /cowspace (tmpfs) filesystem, size=${cowspace_size}..." - mount -t tmpfs -o "size=${cowspace_size}",mode=0755 cowspace /cowspace + msg ":: Mounting /run/archiso/cowspace (tmpfs) filesystem, size=${cowspace_size}..." + mkdir -p /run/archiso/cowspace + mount -t tmpfs -o "size=${cowspace_size}",mode=0755 cowspace /run/archiso/cowspace fi - mkdir -p "/cowspace/${cow_directory}" + mkdir -p "/run/archiso/cowspace/${cow_directory}" local aitab_img aitab_mnt aitab_arch aitab_sfs_comp aitab_fs_type aitab_fs_size while read aitab_img aitab_mnt aitab_arch aitab_sfs_comp aitab_fs_type aitab_fs_size; do @@ -226,21 +230,21 @@ archiso_mount_handler() { [[ "${aitab_arch}" != "any" && "${aitab_arch}" != "${arch}" ]] && continue if [[ "${aitab_fs_type}" != "none" ]]; then if [[ "${aitab_sfs_comp}" != "none" ]]; then - _mnt_sfs "/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.fs.sfs" "/sfs/${aitab_img}" - _mnt_fs "/sfs/${aitab_img}/${aitab_img}.fs" "${newroot}${aitab_mnt}" + _mnt_sfs "/run/archiso/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.fs.sfs" "/run/archiso/sfs/${aitab_img}" + _mnt_fs "/run/archiso/sfs/${aitab_img}/${aitab_img}.fs" "${newroot}${aitab_mnt}" else - _mnt_fs "/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.fs" "${newroot}${aitab_mnt}" + _mnt_fs "/run/archiso/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.fs" "${newroot}${aitab_mnt}" fi else - _mnt_sfs "/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.sfs" "${newroot}${aitab_mnt}" + _mnt_sfs "/run/archiso/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.sfs" "${newroot}${aitab_mnt}" fi done < "${aitab}" if [[ "${copytoram}" == "y" ]]; then - umount /bootmnt + umount /run/archiso/bootmnt else mkdir -p "${newroot}/bootmnt" - mount --bind /bootmnt "${newroot}/bootmnt" + mount --bind /run/archiso/bootmnt "${newroot}/bootmnt" fi } diff --git a/archiso/hooks/archiso_loop_mnt b/archiso/hooks/archiso_loop_mnt index 13f8743..18419e3 100644 --- a/archiso/hooks/archiso_loop_mnt +++ b/archiso/hooks/archiso_loop_mnt @@ -20,9 +20,10 @@ archiso_loop_mount_handler () { msg "::: Setup a loop device from ${img_loop} located at device ${img_dev}" FSTYPE=$(blkid -o value -s TYPE -p ${img_dev} 2> /dev/null) if [ -n "${FSTYPE}" ]; then - if mount -r -t "${FSTYPE}" ${img_dev} /img_dev > /dev/null 2>&1; then + mkdir -p /run/archiso/img_dev + if mount -r -t "${FSTYPE}" ${img_dev} /run/archiso/img_dev > /dev/null 2>&1; then _dev_loop=$(losetup -f) - losetup ${_dev_loop} /img_dev/${img_loop} + losetup ${_dev_loop} /run/archiso/img_dev/${img_loop} fi fi diff --git a/archiso/install/archiso b/archiso/install/archiso index 89642f0..d32c8ab 100644 --- a/archiso/install/archiso +++ b/archiso/install/archiso @@ -9,10 +9,6 @@ build () BINARIES="" FILES="" - add_dir /cowspace - add_dir /copytoram - add_dir /bootmnt - add_binary /lib/udev/cdrom_id add_binary /sbin/blockdev add_binary /sbin/dmsetup diff --git a/archiso/install/archiso_loop_mnt b/archiso/install/archiso_loop_mnt index 2c8d6f2..886cbb8 100644 --- a/archiso/install/archiso_loop_mnt +++ b/archiso/install/archiso_loop_mnt @@ -6,7 +6,7 @@ build () BINARIES="" FILES="" - add_dir /img_dev + SCRIPT="archiso_loop_mnt" } -- cgit v1.2.3-70-g09d2