summaryrefslogtreecommitdiff
path: root/archiso/hooks/archiso
diff options
context:
space:
mode:
Diffstat (limited to 'archiso/hooks/archiso')
-rw-r--r--archiso/hooks/archiso36
1 files changed, 32 insertions, 4 deletions
diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso
index 7e2997a..c973ffc 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
}
@@ -76,11 +77,22 @@ _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%"
[[ -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"
@@ -133,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