index : archiso32 | |
Archlinux32 iso tools | gitolite user |
summaryrefslogtreecommitdiff |
author | fdupoux <fdupoux@users.sourceforge.net> | 2020-10-30 21:20:05 +0000 |
---|---|---|
committer | fdupoux <fdupoux@users.sourceforge.net> | 2020-10-30 21:33:08 +0000 |
commit | 9f16862acd7e7be02da72f63a03b4c0e256dabff (patch) | |
tree | fe25dfbce755201756573c41cc55402913c878ab /archiso/mkarchiso | |
parent | e369ade17d219cff62016de4fcd81d7f9a77d640 (diff) |
-rwxr-xr-x | archiso/mkarchiso | 53 |
diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 5bb042c..13cee6a 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -17,8 +17,6 @@ quiet="y" work_dir="work" out_dir="out" img_name="${app_name}.iso" -sfs_mode="sfs" -sfs_comp="xz" gpg_key="" override_gpg_key="" @@ -38,6 +36,8 @@ arch="$(uname -m)" pacman_conf="/etc/pacman.conf" override_pacman_conf="" bootmodes=() +airootfs_image_type="squashfs" +airootfs_image_tool_options=('-comp' 'xz') # Show an INFO message @@ -108,17 +108,11 @@ usage: ${app_name} [options] <profile_dir> Default: '${iso_label}' -P <publisher> Set the ISO publisher Default: '${iso_publisher}' - -c <comp_type> Set SquashFS compression type (gzip, lzma, lzo, xz, zstd) - Default: '${sfs_comp}' -g <gpg_key> Set the GPG key to be used for signing the sqashfs image -h This message -o <out_dir> Set the output directory Default: '${out_dir}' -p PACKAGE(S) Package(s) to install, can be used multiple times - -s <sfs_mode> Set SquashFS image mode (img or sfs) - img: prepare airootfs.sfs for dm-snapshot usage - sfs: prepare airootfs.sfs for overlayfs usage - Default: '${sfs_mode}' -v Enable verbose output -w <work_dir> Set the working directory Default: '${work_dir}' @@ -201,6 +195,23 @@ _cleanup() { _msg_info "Done!" } +_mkairootfs_create_image() { + if (( $# < 1 )); then + _msg_error "Function '${FUNCNAME[0]}' requires at least one argument" 1 + fi + + image_path="${isofs_dir}/${install_dir}/${arch}/airootfs.sfs" + if [[ "${airootfs_image_type}" =~ .*squashfs ]] ; then + if [[ "${quiet}" == "y" ]]; then + mksquashfs "$@" "${image_path}" -noappend "${airootfs_image_tool_options[@]}" -no-progress > /dev/null + else + mksquashfs "$@" "${image_path}" -noappend "${airootfs_image_tool_options[@]}" + fi + else + _msg_error "Unsupported image type: '${airootfs_image_type}'" 1 + fi +} + # Makes a ext4 filesystem inside a SquashFS from a source directory. _mkairootfs_img() { if [[ ! -e "${airootfs_dir}" ]]; then @@ -223,13 +234,7 @@ _mkairootfs_img() { _umount_airootfs install -d -m 0755 -- "${isofs_dir}/${install_dir}/${arch}" _msg_info "Creating SquashFS image, this may take some time..." - if [[ "${quiet}" = "y" ]]; then - mksquashfs "${airootfs_dir}.img" "${isofs_dir}/${install_dir}/${arch}/airootfs.sfs" -noappend \ - -comp "${sfs_comp}" -no-progress > /dev/null - else - mksquashfs "${airootfs_dir}.img" "${isofs_dir}/${install_dir}/${arch}/airootfs.sfs" -noappend \ - -comp "${sfs_comp}" - fi + _mkairootfs_create_image "${airootfs_dir}.img" _msg_info "Done!" rm -- "${airootfs_dir}.img" } @@ -242,13 +247,7 @@ _mkairootfs_sfs() { install -d -m 0755 -- "${isofs_dir}/${install_dir}/${arch}" _msg_info "Creating SquashFS image, this may take some time..." - if [[ "${quiet}" = "y" ]]; then - mksquashfs "${airootfs_dir}" "${isofs_dir}/${install_dir}/${arch}/airootfs.sfs" -noappend \ - -comp "${sfs_comp}" -no-progress > /dev/null - else - mksquashfs "${airootfs_dir}" "${isofs_dir}/${install_dir}/${arch}/airootfs.sfs" -noappend \ - -comp "${sfs_comp}" - fi + _mkairootfs_create_image "${airootfs_dir}" _msg_info "Done!" } @@ -573,10 +572,12 @@ _make_boot_uefi-x64.systemd-boot.eltorito() { # Build airootfs filesystem image _make_prepare() { - if [[ "${sfs_mode}" == "sfs" ]]; then + if [[ "${airootfs_image_type}" == "squashfs" ]]; then # prepare airootfs.sfs for overlayfs usage (default) _run_once _mkairootfs_sfs - else + elif [[ "${airootfs_image_type}" == "ext4+squashfs" ]]; then # prepare airootfs.sfs for dm-snapshot usage _run_once _mkairootfs_img + else + _msg_error "Unsupported image type: '${airootfs_image_type}'" 1 fi _mkchecksum if [[ "${gpg_key}" ]]; then @@ -806,7 +807,7 @@ _build_profile() { _run_once _make_iso } -while getopts 'p:r:C:L:P:A:D:w:o:s:c:g:vh?' arg; do +while getopts 'p:r:C:L:P:A:D:w:o:g:vh?' arg; do case "${arg}" in p) read -r -a opt_pkg_list <<< "${OPTARG}" @@ -820,8 +821,6 @@ while getopts 'p:r:C:L:P:A:D:w:o:s:c:g:vh?' arg; do D) override_install_dir="${OPTARG}" ;; w) work_dir="$(realpath -- "${OPTARG}")" ;; o) out_dir="$(realpath -- "${OPTARG}")" ;; - s) sfs_mode="${OPTARG}" ;; - c) sfs_comp="${OPTARG}" ;; g) override_gpg_key="${OPTARG}" ;; v) quiet="n" ;; h|?) _usage 0 ;; |