@@ -151,6 +151,7 @@ _usage () {
151151 echo " --pacman-debug Enable pacman debug mode"
152152 echo " --normwork No remove working dir"
153153 echo " --nopkgbuild Ignore PKGBUILD (Use only for debugging)"
154+ echo " --tar-type <comp_type> Set compression type (gzip, lzma, lzo, xz, zstd)"
154155 echo " --tar-opts <option> Set tar command argument (Use with --tarball)"
155156 echo
156157 echo " Many packages are installed from AUR, so specifying --noaur can cause problems."
@@ -445,10 +446,18 @@ prepare_build() {
445446 # gitversion
446447 [[ " ${gitversion} " = true ]] && iso_version=" ${iso_version} -${gitrev} "
447448
448- # Generate iso file name.
449+ # Generate tar file name
450+ tar_ext=" "
451+ case " ${tar_comp} " in
452+ " gzip" ) tar_ext=" gz" ;;
453+ " zstd" ) tar_ext=" zst" ;;
454+ " xz" | " lzo" | " lzma" ) tar_ext=" ${tar_comp} " ;;
455+ esac
456+
457+ # Generate iso file name
449458 local _channel_name=" ${channel_name% .add} -${locale_version} "
450459 iso_filename=" ${iso_name} -${_channel_name} -${iso_version} -${arch} .iso"
451- tar_filename=" ${iso_filename% .iso} .tar.xz "
460+ tar_filename=" ${iso_filename% .iso} .tar.${tar_ext} "
452461 [[ " ${nochname} " = true ]] && iso_filename=" ${iso_name} -${iso_version} -${arch} .iso"
453462 msg_debug " Iso filename is ${iso_filename} "
454463
@@ -901,24 +910,27 @@ make_efiboot() {
901910# Compress tarball
902911make_tarball () {
903912 # backup airootfs.img for tarball
913+ msg_debug " Tarball filename is ${tar_filename} "
904914 msg_info " Copying airootfs.img ..."
905915 cp " ${airootfs_dir} .img" " ${airootfs_dir} .img.org"
906916
907917 # Run script
908918 mount_airootfs
909919 [[ -f " ${airootfs_dir} /root/optimize_for_tarball.sh" ]] && _chroot_run " bash /root/optimize_for_tarball.sh -u ${username} "
910-
911920 _cleanup_common
912921 _chroot_run " mkinitcpio -P"
913-
914922 remove " ${airootfs_dir} /root/optimize_for_tarball.sh"
915923
924+ # make
925+ tar_comp_opt+=(" --${tar_comp} " )
916926 mkdir -p " ${out_dir} "
917927 msg_info " Creating tarball..."
918928 cd -- " ${airootfs_dir} "
919- tar -c -v -p -f " ${out_dir} /${tar_filename} " " ${taropt[@]} " ./*
929+ msg_debug " Run tar -c -v -p -f \" ${out_dir} /${tar_filename} \" ${tar_comp_opt[*]} ./*"
930+ tar -c -v -p -f " ${out_dir} /${tar_filename} " " ${tar_comp_opt[@]} " ./*
920931 cd -- " ${OLDPWD} "
921932
933+ # checksum
922934 _mkchecksum " ${out_dir} /${tar_filename} "
923935 msg_info " Done! | $( ls -sh " ${out_dir} /${tar_filename} " ) "
924936
@@ -1033,7 +1045,7 @@ make_iso() {
10331045# Parse options
10341046ARGUMENT=(" ${DEFAULT_ARGUMENT[@]} " " ${@ } " )
10351047OPTS=(" a:" " b" " c:" " d" " e" " g:" " h" " j" " k:" " l:" " o:" " p:" " r" " t:" " u:" " w:" " x" )
1036- OPTL=(" arch:" " boot-splash" " comp-type:" " debug" " cleaning" " cleanup" " gpgkey:" " help" " lang:" " japanese" " kernel:" " out:" " password:" " comp-opts:" " user:" " work:" " bash-debug" " nocolor" " noconfirm" " nodepend" " gitversion" " msgdebug" " noloopmod" " tarball" " noiso" " noaur" " nochkver" " channellist" " config:" " noefi" " nodebug" " nosigcheck" " normwork" " log" " logpath:" " nolog" " nopkgbuild" " pacman-debug" " confirm" " tar-opts:" )
1048+ OPTL=(" arch:" " boot-splash" " comp-type:" " debug" " cleaning" " cleanup" " gpgkey:" " help" " lang:" " japanese" " kernel:" " out:" " password:" " comp-opts:" " user:" " work:" " bash-debug" " nocolor" " noconfirm" " nodepend" " gitversion" " msgdebug" " noloopmod" " tarball" " noiso" " noaur" " nochkver" " channellist" " config:" " noefi" " nodebug" " nosigcheck" " normwork" " log" " logpath:" " nolog" " nopkgbuild" " pacman-debug" " confirm" " tar-type: " " tar- opts:" )
10371049if ! OPT=$( getopt -o " $( printf " %s," " ${OPTS[@]} " ) " -l " $( printf " %s," " ${OPTL[@]} " ) " -- " ${ARGUMENT[@]} " ) ; then
10381050# if ! readarray OPT < <(getopt -o "$(printf "%s," "${OPTS[@]}")" -l "$(printf "%s," "${OPTL[@]}")" -- "${ARGUMENT[@]}"); then
10391051 exit 1
@@ -1215,8 +1227,15 @@ while true; do
12151227 nopkgbuild=true
12161228 shift 1
12171229 ;;
1230+ --tar-type)
1231+ case " ${2} " in
1232+ " gzip" | " lzma" | " lzo" | " lz4" | " xz" | " zstd" ) tar_comp=" ${2} " ;;
1233+ * ) msg_error " Invaild compressors '${2} '" ' 1' ;;
1234+ esac
1235+ shift 2
1236+ ;;
12181237 --tar-opts)
1219- taropt =(${2} )
1238+ tar_comp_opt =(${2} )
12201239 shift 2
12211240 ;;
12221241 --)
0 commit comments