[archiso] Add checksum= boot param
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
This commit is contained in:
parent
12e9d32435
commit
90cfe3ce2c
5 changed files with 50 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -112,6 +112,8 @@ _usage ()
|
|||
echo " includes all specified packages"
|
||||
echo " prepare <dir>"
|
||||
echo " build all images"
|
||||
echo " checksum <dir>"
|
||||
echo " make a checksum.md5 for self-test"
|
||||
echo " iso <dir> <image name>"
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue