From 57d2ea1f4b3445a2815f6c4e3f49f2ad7209c87e Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Tue, 9 Aug 2011 16:28:52 -0300 Subject: [archiso] Add dm_snap_prefix= boot param. Default value is "arch". This implies that all device mapper node for snapshot devices will be for example: arch_root-image. This helps AIF to hidden these devices from "Device Configuration". Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'archiso') diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index 7e2997a..66dbafd 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -29,6 +29,7 @@ _mnt_fs() { local mnt="${2}" local img_fullname="${img##*/}"; local img_name="${img_fullname%%.*}" + local dm_snap_name="${dm_snap_prefix}_${img_name}" local ro_dev ro_dev_size ro_dev_fs_type rw_dev mkdir -p "${mnt}" @@ -42,11 +43,11 @@ _mnt_fs() { _next_loop_dev rw_dev=$(_make_loop_dev "/cowspace/${img_name}.cow") - echo "0 ${ro_dev_size} snapshot ${ro_dev} ${rw_dev} N 8" | dmsetup create ${img_name} + echo "0 ${ro_dev_size} snapshot ${ro_dev} ${rw_dev} N 8" | dmsetup create ${dm_snap_name} - msg ":: Mounting '/dev/mapper/${img_name}' (${ro_dev_fs_type}) to '${mnt}'" - if ! mount -t "${ro_dev_fs_type}" "/dev/mapper/${img_name}" "${mnt}" ; then - echo "ERROR: while mounting '/dev/mapper/${img_name}' to '${mnt}'" + msg ":: Mounting '/dev/mapper/${dm_snap_name}' (${ro_dev_fs_type}) to '${mnt}'" + if ! mount -t "${ro_dev_fs_type}" "/dev/mapper/${dm_snap_name}" "${mnt}" ; then + echo "ERROR: while mounting '/dev/mapper/${dm_snap_name}' to '${mnt}'" launch_interactive_shell fi } @@ -81,6 +82,7 @@ run_hook() { [[ -z "${cowspace_size}" ]] && cowspace_size="75%" [[ -z "${copytoram_size}" ]] && copytoram_size="75%" [[ -z "${archisobasedir}" ]] && archisobasedir="arch" + [[ -z "${dm_snap_prefix}" ]] && dm_snap_prefix="arch" [[ -z "${archisodevice}" ]] && archisodevice="/dev/disk/by-label/${archisolabel}" if [[ -z "${aitab}" ]]; then aitab="/bootmnt/${archisobasedir}/aitab" -- cgit v1.2.2 From 90cfe3ce2ce35382595223bf8d264fee63e86df5 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Fri, 12 Aug 2011 00:10:44 -0300 Subject: [archiso] Add checksum= boot param Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso | 26 ++++++++++++++++++++++++++ archiso/mkarchiso | 17 +++++++++++++++++ 2 files changed, 43 insertions(+) (limited to 'archiso') diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index 66dbafd..c973ffc 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -77,6 +77,16 @@ _mnt_sfs() { fi } +_verify_checksum() { + local _status + cd "/bootmnt/${archisobasedir}" + md5sum -c checksum.md5 > /checksum.log 2>&1 + _status=$? + cd "${OLDPWD}" + return ${_status} +} + + run_hook() { [[ -z "${arch}" ]] && arch="$(uname -m)" [[ -z "${cowspace_size}" ]] && cowspace_size="75%" @@ -135,6 +145,22 @@ archiso_mount_handler() { launch_interactive_shell fi + if [[ "${checksum}" == "y" ]]; then + if [[ -f "/bootmnt/${archisobasedir}/checksum.md5" ]]; then + msg -n ":: Self-test requested, please wait..." + if _verify_checksum; then + msg "done. Checksum is OK, continue booting." + else + echo "ERROR: one or more files are corrupted" + echo "see /checksum.log for details" + launch_interactive_shell + fi + else + echo "ERROR: checksum=y option specified but checksum.md5 not found" + launch_interactive_shell + fi + fi + if [[ "${copytoram}" == "y" ]]; then msg -n ":: Mounting /copytoram (tmpfs) filesystem, size=${copytoram_size}..." mount -t tmpfs -o "size=${copytoram_size}",mode=0755 copytoram /copytoram diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 12d8936..6826441 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -112,6 +112,8 @@ _usage () echo " includes all specified packages" echo " prepare " echo " build all images" + echo " checksum " + echo " make a checksum.md5 for self-test" echo " iso " echo " build an iso image from the working dir" exit ${1} @@ -134,6 +136,8 @@ _show_config () { ;; prepare) ;; + checksum) + ;; iso) _msg_info " Image name: ${img_name}" _msg_info " Disk label: ${iso_label}" @@ -286,6 +290,16 @@ _mkfs () { _umount_fs "${work_dir}/mnt/${_src}" } +command_checksum () { + _show_config checksum + + _msg_info "Creating checksum file for self-test" + cd "${work_dir}/iso/${install_dir}" + find -type f ! -name checksum.md5 -print0 | xargs -0 md5sum > checksum.md5 + cd ${OLDPWD} + _msg_info "Done!" +} + # Create an ISO9660 filesystem from "iso" directory. command_iso () { if [[ ! -f "${work_dir}/iso/isolinux/isolinux.bin" ]]; then @@ -428,6 +442,9 @@ case "${command_name}" in prepare) command_prepare ;; + checksum) + command_checksum + ;; iso) if [[ $# -lt 3 ]]; then _msg_error "No image specified" 0 -- cgit v1.2.2 From c2aefad9b21e2d792f6dfac032824dc21b11ae85 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Sun, 14 Aug 2011 01:57:23 -0300 Subject: [archiso] Makefile trivial fix (if configs/ already on DESTDIR) Signed-off-by: Gerardo Exequiel Pozzi --- archiso/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'archiso') diff --git a/archiso/Makefile b/archiso/Makefile index 78dd534..60632e2 100644 --- a/archiso/Makefile +++ b/archiso/Makefile @@ -20,7 +20,7 @@ install-hooks: install-examples: # install examples install -d -m 755 $(DESTDIR)/usr/share/archiso/ - cp -r ../configs $(DESTDIR)/usr/share/archiso/configs + cp -r ../configs $(DESTDIR)/usr/share/archiso/ install-doc: install -d -m 755 $(DESTDIR)/usr/share/archiso/ -- cgit v1.2.2