Skip to content

Commit 2c23bc1

Browse files
committed
[fix] : Minor shell fix
1 parent dc77373 commit 2c23bc1

File tree

1 file changed

+10
-27
lines changed

1 file changed

+10
-27
lines changed

build.sh

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -447,12 +447,8 @@ prepare_build() {
447447
[[ "${gitversion}" = true ]] && iso_version="${iso_version}-${gitrev}"
448448

449449
# Generate iso file name.
450-
local _channel_name="${channel_name%.add}-${locale_version}"
451-
if [[ "${nochname}" = true ]]; then
452-
iso_filename="${iso_name}-${iso_version}-${arch}.iso"
453-
else
454-
iso_filename="${iso_name}-${_channel_name}-${iso_version}-${arch}.iso"
455-
fi
450+
local _channel_name="${channel_name%.add}-${locale_version}" iso_filename="${iso_name}-${_channel_name}-${iso_version}-${arch}.iso"
451+
[[ "${nochname}" = true ]] && iso_filename="${iso_name}-${iso_version}-${arch}.iso"
456452
msg_debug "Iso filename is ${iso_filename}"
457453

458454
# check bool
@@ -468,7 +464,7 @@ prepare_build() {
468464
# Run with tee
469465
if [[ ! "${logging}" = false ]]; then
470466
[[ "${customized_logpath}" = false ]] && logging="${out_dir}/${iso_filename%.iso}.log"
471-
mkdir -p "$(dirname "${logging}")"; touch "${logging}"
467+
mkdir -p "$(dirname "${logging}")" && touch "${logging}"
472468
msg_warn "Re-run sudo ${0} ${ARGUMENT[*]} --nodepend --nolog --nocolor 2>&1 | tee ${logging}"
473469
sudo "${0}" "${ARGUMENT[@]}" --nolog --nocolor --nodepend 2>&1 | tee "${logging}"
474470
exit "${?}"
@@ -507,13 +503,9 @@ make_pacman_conf() {
507503
msg_debug "Use ${build_pacman_conf}"
508504
sed -r "s|^#?\\s*CacheDir.+|CacheDir = ${cache_dir}|g" "${build_pacman_conf}" > "${build_dir}/pacman.conf"
509505

510-
if [[ "${nosigcheck}" = true ]]; then
511-
sed -ir "s|^s*SigLevel.+|SigLevel = Never|g" "${build_pacman_conf}"
512-
fi
506+
[[ "${nosigcheck}" = true ]] && sed -ir "s|^s*SigLevel.+|SigLevel = Never|g" "${build_pacman_conf}"
513507

514-
if [[ -n "$(find "${cache_dir}" -maxdepth 1 -name '*.pkg.tar.*' 2> /dev/null)" ]]; then
515-
msg_info "Use cached package files in ${cache_dir}"
516-
fi
508+
[[ -n "$(find "${cache_dir}" -maxdepth 1 -name '*.pkg.tar.*' 2> /dev/null)" ]] && msg_info "Use cached package files in ${cache_dir}"
517509

518510
# Share any architecture packages
519511
#while read -r _pkg; do
@@ -699,9 +691,7 @@ make_setup_mkinitcpio() {
699691

700692
_chroot_run "mkinitcpio -c /etc/mkinitcpio-archiso.conf -k /boot/${kernel_filename} -g /boot/archiso.img"
701693

702-
if [[ "${gpg_key}" ]]; then
703-
exec 17<&-
704-
fi
694+
[[ "${gpg_key}" ]] && exec 17<&-
705695

706696
return 0
707697
}
@@ -743,7 +733,6 @@ make_boot_extra() {
743733

744734
# Prepare /${install_dir}/boot/syslinux
745735
make_syslinux() {
746-
_uname_r="$(file -b ${airootfs_dir}/boot/${kernel_filename} | awk 'f{print;f=0} /version/{f=1}' RS=' ')"
747736
mkdir -p "${isofs_dir}/syslinux"
748737

749738
# 一時ディレクトリに設定ファイルをコピー
@@ -893,12 +882,8 @@ make_efiboot() {
893882
local _bootfile="$(basename "$(ls "${airootfs_dir}/usr/lib/systemd/boot/efi/systemd-boot"*".efi" )")"
894883
cp "${airootfs_dir}/usr/lib/systemd/boot/efi/${_bootfile}" "${build_dir}/efiboot/EFI/boot/${_bootfile#systemd-}"
895884

896-
local _use_config_name
897-
if [[ "${boot_splash}" = true ]]; then
898-
_use_config_name="splash"
899-
else
900-
_use_config_name="nosplash"
901-
fi
885+
local _use_config_name="nosplash"
886+
[[ "${boot_splash}" = true ]] && _use_config_name="splash"
902887

903888
mkdir -p "${build_dir}/efiboot/loader/entries"
904889
sed "s|%ARCH%|${arch}|g;" "${script_path}/efiboot/${_use_config_name}/loader.conf" > "${build_dir}/efiboot/loader/loader.conf"
@@ -1008,9 +993,7 @@ make_alteriso_info(){
1008993
if [[ "${include_info}" = true ]]; then
1009994
local _info_file="${isofs_dir}/alteriso-info" _version="${iso_version}"
1010995
remove "${_info_file}"; touch "${_info_file}"
1011-
if [[ -d "${script_path}/.git" ]] && [[ "${gitversion}" = false ]]; then
1012-
_version="${iso_version}-${gitrev}"
1013-
fi
996+
[[ -d "${script_path}/.git" ]] && [[ "${gitversion}" = false ]] && _version="${iso_version}-${gitrev}"
1014997
"${tools_dir}/alteriso-info.sh" -a "${arch}" -b "${boot_splash}" -c "${channel_name%.add}" -d "${iso_publisher}" -k "${kernel}" -o "${os_name}" -p "${password}" -u "${username}" -v "${_version}" > "${_info_file}"
1015998
fi
1016999

@@ -1034,7 +1017,7 @@ make_iso() {
10341017
local _iso_efi_boot_args=()
10351018
# If exists, add an EFI "El Torito" boot image (FAT filesystem) to ISO-9660 image.
10361019
if [[ -f "${build_dir}/efiboot.img" ]]; then
1037-
_iso_efi_boot_args=(-append_partition 2 C12A7328-F81F-11D2-BA4B-00A0C93EC93B ${build_dir}/efiboot.img -appended_part_as_gpt -eltorito-alt-boot -e --interval:appended_partition_2:all:: -no-emul-boot -isohybrid-gpt-basdat)
1020+
_iso_efi_boot_args=(-append_partition 2 C12A7328-F81F-11D2-BA4B-00A0C93EC93B "${build_dir}/efiboot.img" -appended_part_as_gpt -eltorito-alt-boot -e --interval:appended_partition_2:all:: -no-emul-boot -isohybrid-gpt-basdat)
10381021
fi
10391022

10401023
mkdir -p -- "${out_dir}"

0 commit comments

Comments
 (0)