[archiso] Rework checksum function
This commit is contained in:
parent
4890ce0b67
commit
b3e1d31343
@ -93,8 +93,8 @@ _mnt_dev() {
|
|||||||
|
|
||||||
_verify_checksum() {
|
_verify_checksum() {
|
||||||
local _status
|
local _status
|
||||||
cd "/run/archiso/bootmnt/${archisobasedir}"
|
cd "/run/archiso/bootmnt/${archisobasedir}/${arch}"
|
||||||
md5sum -c checksum.${arch}.md5 > /tmp/checksum.${arch}.log 2>&1
|
md5sum -c airootfs.md5 > /tmp/checksum.log 2>&1
|
||||||
_status=$?
|
_status=$?
|
||||||
cd "${OLDPWD}"
|
cd "${OLDPWD}"
|
||||||
return ${_status}
|
return ${_status}
|
||||||
@ -142,17 +142,17 @@ archiso_mount_handler() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${checksum}" == "y" ]]; then
|
if [[ "${checksum}" == "y" ]]; then
|
||||||
if [[ -f "/run/archiso/bootmnt/${archisobasedir}/checksum.${arch}.md5" ]]; then
|
if [[ -f "/run/archiso/bootmnt/${archisobasedir}/${arch}/airootfs.md5" ]]; then
|
||||||
msg -n ":: Self-test requested, please wait..."
|
msg -n ":: Self-test requested, please wait..."
|
||||||
if _verify_checksum; then
|
if _verify_checksum; then
|
||||||
msg "done. Checksum is OK, continue booting."
|
msg "done. Checksum is OK, continue booting."
|
||||||
else
|
else
|
||||||
echo "ERROR: one or more files are corrupted"
|
echo "ERROR: one or more files are corrupted"
|
||||||
echo "see /tmp/checksum.${arch}.log for details"
|
echo "see /tmp/checksum.log for details"
|
||||||
launch_interactive_shell
|
launch_interactive_shell
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "ERROR: checksum=y option specified but checksum.${arch}.md5 not found"
|
echo "ERROR: checksum=y option specified but ${archisobasedir}/${arch}/airootfs.md5 not found"
|
||||||
launch_interactive_shell
|
launch_interactive_shell
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -37,7 +37,7 @@ archiso_pxe_http_mount_handler () {
|
|||||||
_curl_get "${archiso_http_srv}${archisobasedir}/${arch}/airootfs.sfs" "/${arch}"
|
_curl_get "${archiso_http_srv}${archisobasedir}/${arch}/airootfs.sfs" "/${arch}"
|
||||||
|
|
||||||
if [[ "${checksum}" == "y" ]]; then
|
if [[ "${checksum}" == "y" ]]; then
|
||||||
_curl_get "${archiso_http_srv}${archisobasedir}/checksum.${arch}.md5" "/"
|
_curl_get "${archiso_http_srv}${archisobasedir}/${arch}/airootfs.md5" "/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "/run/archiso/bootmnt"
|
mkdir -p "/run/archiso/bootmnt"
|
||||||
|
@ -100,8 +100,6 @@ _usage ()
|
|||||||
echo " run command specified by -r"
|
echo " run command specified by -r"
|
||||||
echo " prepare"
|
echo " prepare"
|
||||||
echo " build all images"
|
echo " build all images"
|
||||||
echo " checksum"
|
|
||||||
echo " make a checksum.md5 for self-test"
|
|
||||||
echo " pkglist"
|
echo " pkglist"
|
||||||
echo " make a pkglist.txt of packages installed on airootfs"
|
echo " make a pkglist.txt of packages installed on airootfs"
|
||||||
echo " iso <image name>"
|
echo " iso <image name>"
|
||||||
@ -110,7 +108,7 @@ _usage ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Shows configuration according to command mode.
|
# Shows configuration according to command mode.
|
||||||
# $1: init | install | run | prepare | checksum | iso
|
# $1: init | install | run | prepare | iso
|
||||||
_show_config () {
|
_show_config () {
|
||||||
local _mode="$1"
|
local _mode="$1"
|
||||||
echo
|
echo
|
||||||
@ -132,8 +130,6 @@ _show_config () {
|
|||||||
;;
|
;;
|
||||||
prepare)
|
prepare)
|
||||||
;;
|
;;
|
||||||
checksum)
|
|
||||||
;;
|
|
||||||
pkglist)
|
pkglist)
|
||||||
;;
|
;;
|
||||||
iso)
|
iso)
|
||||||
@ -228,20 +224,12 @@ _mkairootfs () {
|
|||||||
rm ${work_dir}/airootfs.img
|
rm ${work_dir}/airootfs.img
|
||||||
}
|
}
|
||||||
|
|
||||||
command_checksum () {
|
_mkchecksum () {
|
||||||
_show_config checksum
|
_msg_info "Creating checksum file for self-test..."
|
||||||
|
cd "${work_dir}/iso/${install_dir}/${arch}"
|
||||||
local _chk_arch
|
md5sum airootfs.sfs > airootfs.md5
|
||||||
|
|
||||||
for _chk_arch in i686 x86_64; do
|
|
||||||
_msg_info "Creating checksum file for self-test (${_chk_arch})..."
|
|
||||||
cd "${work_dir}/iso/${install_dir}"
|
|
||||||
if [[ -d "${_chk_arch}" ]]; then
|
|
||||||
find ${_chk_arch} -type f -print0 | xargs -0 md5sum > checksum.${_chk_arch}.md5
|
|
||||||
fi
|
|
||||||
cd ${OLDPWD}
|
cd ${OLDPWD}
|
||||||
_msg_info "Done!"
|
_msg_info "Done!"
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
command_pkglist () {
|
command_pkglist () {
|
||||||
@ -305,6 +293,7 @@ command_prepare () {
|
|||||||
|
|
||||||
_cleanup
|
_cleanup
|
||||||
_mkairootfs
|
_mkairootfs
|
||||||
|
_mkchecksum
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install packages on airootfs.
|
# Install packages on airootfs.
|
||||||
@ -383,9 +372,6 @@ case "${command_name}" in
|
|||||||
prepare)
|
prepare)
|
||||||
command_prepare
|
command_prepare
|
||||||
;;
|
;;
|
||||||
checksum)
|
|
||||||
command_checksum
|
|
||||||
;;
|
|
||||||
pkglist)
|
pkglist)
|
||||||
command_pkglist
|
command_pkglist
|
||||||
;;
|
;;
|
||||||
|
@ -67,7 +67,6 @@ make_prepare() {
|
|||||||
|
|
||||||
# Build ISO
|
# Build ISO
|
||||||
make_iso() {
|
make_iso() {
|
||||||
mkarchiso -v -w "${work_dir}" -D "${install_dir}" checksum
|
|
||||||
mkarchiso -v -w "${work_dir}" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-${arch}.iso"
|
mkarchiso -v -w "${work_dir}" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-${arch}.iso"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +193,6 @@ make_prepare() {
|
|||||||
|
|
||||||
# Build ISO
|
# Build ISO
|
||||||
make_iso() {
|
make_iso() {
|
||||||
mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" checksum
|
|
||||||
mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-dual.iso"
|
mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-dual.iso"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user