OSDN Git Service

[fix] : Fixed SC2155 SC2207 (make_efi)
authorhayao <hayao@fascode.net>
Fri, 18 Jun 2021 14:20:22 +0000 (23:20 +0900)
committerhayao <hayao@fascode.net>
Fri, 18 Jun 2021 14:20:22 +0000 (23:20 +0900)
build.sh

index 1abff6d..554c532 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -814,25 +814,19 @@ make_isolinux() {
 
 # Prepare /EFI
 make_efi() {
-    install -d -m 0755 -- "${isofs_dir}/EFI/boot"
+    local _bootfile _use_config_name="nosplash" _efi_config_list=() _efi_config
+    [[ "${boot_splash}" = true ]] && _use_config_name="splash"
+    _bootfile="$(basename "$(ls "${airootfs_dir}/usr/lib/systemd/boot/efi/systemd-boot"*".efi" )")"
 
-    local _bootfile="$(basename "$(ls "${airootfs_dir}/usr/lib/systemd/boot/efi/systemd-boot"*".efi" )")"
+    install -d -m 0755 -- "${isofs_dir}/EFI/boot"
     install -m 0644 -- "${airootfs_dir}/usr/lib/systemd/boot/efi/${_bootfile}" "${isofs_dir}/EFI/boot/${_bootfile#systemd-}"
 
-    local _use_config_name="nosplash"
-    if [[ "${boot_splash}" = true ]]; then
-        _use_config_name="splash"
-    fi
-
     install -d -m 0755 -- "${isofs_dir}/loader/entries"
     sed "s|%ARCH%|${arch}|g;" "${script_path}/efiboot/${_use_config_name}/loader.conf" > "${isofs_dir}/loader/loader.conf"
 
-    local _efi_config_list=() _efi_config
-    _efi_config_list+=($(ls "${script_path}/efiboot/${_use_config_name}/archiso-usb"*".conf" | grep -v "rescue"))
+    readarray -t _efi_config_list < <(ls "${script_path}/efiboot/${_use_config_name}/archiso-usb"*".conf" | grep -v "rescue")
 
-    if [[ "${norescue_entry}" = false ]]; then
-        _efi_config_list+=($(ls "${script_path}/efiboot/${_use_config_name}/archiso-usb"*".conf" | grep -v "rescue"))
-    fi
+    [[ "${norescue_entry}" = false ]] && readarray -t -O "${#_efi_config_list}" _efi_config_list < <(ls "${script_path}/efiboot/${_use_config_name}/archiso-usb"*".conf" | grep -v "rescue")
 
     for _efi_config in "${_efi_config_list[@]}"; do
         sed "s|%ARCHISO_LABEL%|${iso_label}|g;