From bc67933af14c28eb385b537a6afa3aa6e458af59 Mon Sep 17 00:00:00 2001 From: nl6720 Date: Sat, 24 Oct 2020 15:53:57 +0300 Subject: Support EROFS EROFS, like Squashfs, is a read-only file system. It can be used to store airootfs in an image file. Its advantage is the support for POSIX ACLs. EROFS downside is that currently it only supports LZ4 compression (LZMA support is not yet fully implemented). A difference from Squashfs is that, EROFS stores change time (ctime) not modification time (mtime). The reverse is true for Squashfs. Implements https://gitlab.archlinux.org/archlinux/archiso/-/issues/59 --- archiso/mkarchiso | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'archiso/mkarchiso') diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 021bcfa..0d7c698 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -200,13 +200,30 @@ _mkairootfs_squashfs() { install -d -m 0755 -- "${isofs_dir}/${install_dir}/${arch}" _msg_info "Creating SquashFS image, this may take some time..." _run_mksquashfs "${airootfs_dir}" +} + +# Makes an EROFS file system from a source directory. +_mkairootfs_erofs() { + local fsuuid + [[ -e "${airootfs_dir}" ]] || _msg_error "The path '${airootfs_dir}' does not exist" 1 + + install -d -m 0755 -- "${isofs_dir}/${install_dir}/${arch}" + local image_path="${isofs_dir}/${install_dir}/${arch}/airootfs.erofs" + # Generate reproducible file system UUID from SOURCE_DATE_EPOCH + fsuuid="$(uuidgen --sha1 --namespace 93a870ff-8565-4cf3-a67b-f47299271a96 --name "${SOURCE_DATE_EPOCH}")" + _msg_info "Creating EROFS image, this may take some time..." + mkfs.erofs -U "${fsuuid}" "${airootfs_image_tool_options[@]}" -- "${image_path}" "${airootfs_dir}" _msg_info "Done!" } _mkchecksum() { _msg_info "Creating checksum file for self-test..." cd -- "${isofs_dir}/${install_dir}/${arch}" - sha512sum airootfs.sfs > airootfs.sha512 + if [[ -e "${isofs_dir}/${install_dir}/${arch}/airootfs.sfs" ]]; then + sha512sum airootfs.sfs > airootfs.sha512 + elif [[ -e "${isofs_dir}/${install_dir}/${arch}/airootfs.erofs" ]]; then + sha512sum airootfs.erofs > airootfs.sha512 + fi cd -- "${OLDPWD}" _msg_info "Done!" } @@ -214,7 +231,11 @@ _mkchecksum() { _mksignature() { _msg_info "Signing SquashFS image..." cd -- "${isofs_dir}/${install_dir}/${arch}" - gpg --detach-sign --default-key "${gpg_key}" airootfs.sfs + if [[ -e "${isofs_dir}/${install_dir}/${arch}/airootfs.sfs" ]]; then + gpg --detach-sign --default-key "${gpg_key}" airootfs.sfs + elif [[ -e "${isofs_dir}/${install_dir}/${arch}/airootfs.erofs" ]]; then + gpg --detach-sign --default-key "${gpg_key}" airootfs.erofs + fi cd -- "${OLDPWD}" _msg_info "Done!" } @@ -634,6 +655,13 @@ _validate_requirements_airootfs_image_type_ext4+squashfs() { _validate_requirements_airootfs_image_type_squashfs } +_validate_requirements_airootfs_image_type_erofs() { + if ! command -v mkfs.erofs; then + (( validation_error=validation_error+1 )) + _msg_error "Validating '${airootfs_image_type}': mkfs.erofs is not available on this host. Install 'erofs-utils'!" 0 + fi +} + # SYSLINUX El Torito _add_xorrisofs_options_bios.syslinux.eltorito() { xorrisofs_options+=( -- cgit v1.2.3-54-g00ecf