[archiso] mkarchiso: Add -c switch to specify squashfs compression type.
This commit is contained in:
parent
c62a9d748b
commit
9131f83404
@ -16,6 +16,7 @@ iso_application="Arch Linux Live/Rescue CD"
|
|||||||
install_dir="arch"
|
install_dir="arch"
|
||||||
work_dir="work"
|
work_dir="work"
|
||||||
out_dir="out"
|
out_dir="out"
|
||||||
|
sfs_comp="xz"
|
||||||
|
|
||||||
# Show an INFO message
|
# Show an INFO message
|
||||||
# $1: message string
|
# $1: message string
|
||||||
@ -132,6 +133,8 @@ _usage ()
|
|||||||
echo " Default: '${work_dir}'"
|
echo " Default: '${work_dir}'"
|
||||||
echo " -o <out_dir> Set the output directory"
|
echo " -o <out_dir> Set the output directory"
|
||||||
echo " Default: '${out_dir}'"
|
echo " Default: '${out_dir}'"
|
||||||
|
echo " -c <comp_type> Set SquashFS compression type (gzip, lzma, lzo, xz)"
|
||||||
|
echo " Default: '${sfs_comp}'"
|
||||||
echo " -v Enable verbose output"
|
echo " -v Enable verbose output"
|
||||||
echo " -h This message"
|
echo " -h This message"
|
||||||
echo " commands:"
|
echo " commands:"
|
||||||
@ -242,10 +245,8 @@ _cleanup () {
|
|||||||
|
|
||||||
# Makes a SquashFS filesystem image of file/directory passes as argument with desired compression.
|
# Makes a SquashFS filesystem image of file/directory passes as argument with desired compression.
|
||||||
# $1: Source file/directory
|
# $1: Source file/directory
|
||||||
# $2: SquashFS compression type (gzip | lzo | xz)
|
|
||||||
_mksfs () {
|
_mksfs () {
|
||||||
local _src="${1}"
|
local _src="${1}"
|
||||||
local _sfs_comp="${2}"
|
|
||||||
|
|
||||||
if [[ ! -e "${work_dir}/${_src}" ]]; then
|
if [[ ! -e "${work_dir}/${_src}" ]]; then
|
||||||
_msg_error "The path '${work_dir}/${_src}' does not exist" 1
|
_msg_error "The path '${work_dir}/${_src}' does not exist" 1
|
||||||
@ -256,9 +257,9 @@ _mksfs () {
|
|||||||
_msg_info "Creating SquashFS image for '${work_dir}/${_src}', This may take some time..."
|
_msg_info "Creating SquashFS image for '${work_dir}/${_src}', This may take some time..."
|
||||||
local _seconds=${SECONDS}
|
local _seconds=${SECONDS}
|
||||||
if [[ "${quiet}" = "y" ]]; then
|
if [[ "${quiet}" = "y" ]]; then
|
||||||
mksquashfs "${work_dir}/${_src}" "${_sfs_img}" -noappend -comp "${_sfs_comp}" -no-progress &> /dev/null
|
mksquashfs "${work_dir}/${_src}" "${_sfs_img}" -noappend -comp "${sfs_comp}" -no-progress &> /dev/null
|
||||||
else
|
else
|
||||||
mksquashfs "${work_dir}/${_src}" "${_sfs_img}" -noappend -comp "${_sfs_comp}" -no-progress
|
mksquashfs "${work_dir}/${_src}" "${_sfs_img}" -noappend -comp "${sfs_comp}" -no-progress
|
||||||
fi
|
fi
|
||||||
_seconds=$((SECONDS - _seconds))
|
_seconds=$((SECONDS - _seconds))
|
||||||
printf "[mkarchiso] INFO: Image creation done in %02d:%02d minutes\n" $((_seconds / 60)) $((_seconds % 60))
|
printf "[mkarchiso] INFO: Image creation done in %02d:%02d minutes\n" $((_seconds / 60)) $((_seconds % 60))
|
||||||
@ -396,13 +397,13 @@ command_prepare () {
|
|||||||
if [[ ${_aitab_fs_type} != "none" ]]; then
|
if [[ ${_aitab_fs_type} != "none" ]]; then
|
||||||
if _is_directory_changed "${_src}" "${_dst}/${_aitab_img}.fs.sfs"; then
|
if _is_directory_changed "${_src}" "${_dst}/${_aitab_img}.fs.sfs"; then
|
||||||
_mkfs ${_aitab_img}
|
_mkfs ${_aitab_img}
|
||||||
_mksfs ${_aitab_img}.fs ${_aitab_sfs_comp}
|
_mksfs ${_aitab_img}.fs
|
||||||
mv "${_src}.fs.sfs" "${_dst}"
|
mv "${_src}.fs.sfs" "${_dst}"
|
||||||
rm "${_src}.fs"
|
rm "${_src}.fs"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if _is_directory_changed "${_src}" "${_dst}/${_aitab_img}.sfs"; then
|
if _is_directory_changed "${_src}" "${_dst}/${_aitab_img}.sfs"; then
|
||||||
_mksfs ${_aitab_img} ${_aitab_sfs_comp}
|
_mksfs ${_aitab_img}
|
||||||
mv "${work_dir}/${_aitab_img}.sfs" "${_dst}"
|
mv "${work_dir}/${_aitab_img}.sfs" "${_dst}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -450,7 +451,7 @@ if [[ ${EUID} -ne 0 ]]; then
|
|||||||
_msg_error "This script must be run as root." 1
|
_msg_error "This script must be run as root." 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while getopts 'p:r:C:L:P:A:D:w:o:vh' arg; do
|
while getopts 'p:r:C:L:P:A:D:w:o:c:vh' arg; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
p) pkg_list="${pkg_list} ${OPTARG}" ;;
|
p) pkg_list="${pkg_list} ${OPTARG}" ;;
|
||||||
r) run_cmd="${OPTARG}" ;;
|
r) run_cmd="${OPTARG}" ;;
|
||||||
@ -461,6 +462,7 @@ while getopts 'p:r:C:L:P:A:D:w:o:vh' arg; do
|
|||||||
D) install_dir="${OPTARG}" ;;
|
D) install_dir="${OPTARG}" ;;
|
||||||
w) work_dir="${OPTARG}" ;;
|
w) work_dir="${OPTARG}" ;;
|
||||||
o) out_dir="${OPTARG}" ;;
|
o) out_dir="${OPTARG}" ;;
|
||||||
|
c) sfs_comp="${OPTARG}" ;;
|
||||||
v) quiet="n" ;;
|
v) quiet="n" ;;
|
||||||
h|?) _usage 0 ;;
|
h|?) _usage 0 ;;
|
||||||
*)
|
*)
|
||||||
|
Loading…
Reference in New Issue
Block a user