4242
4343umask 0022
4444
45+ # Message common function
46+ # msg_common [type] [-n] [string]
47+ msg_common (){
48+ local _msg_opts=(" -a" " build.sh" ) _type=" ${1} "
49+ shift 1
50+ [[ " ${1} " = " -n" ]] && _msg_opts+=(" -o" " -n" ) && shift 1
51+ [[ " ${msgdebug} " = true ]] && _msg_opts+=(" -x" )
52+ [[ " ${nocolor} " = true ]] && _msg_opts+=(" -n" )
53+ _msg_opts+=(" ${_type} " " ${@ } " )
54+ " ${tools_dir} /msg.sh" " ${_msg_opts[@]} "
55+ }
56+
4557# Show an INFO message
4658# ${1}: message string
4759msg_info () {
48- local _msg_opts=" -a build.sh"
49- if [[ " ${1} " = " -n" ]]; then
50- _msg_opts=" ${_msg_opts} -o -n"
51- shift 1
52- fi
53- [[ " ${msgdebug} " = true ]] && _msg_opts=" ${_msg_opts} -x"
54- [[ " ${nocolor} " = true ]] && _msg_opts=" ${_msg_opts} -n"
55- " ${tools_dir} /msg.sh" ${_msg_opts} info " ${1} "
60+ msg_common info " ${@ } "
5661}
5762
5863# Show an Warning message
5964# ${1}: message string
6065msg_warn () {
61- local _msg_opts=" -a build.sh"
62- if [[ " ${1} " = " -n" ]]; then
63- _msg_opts=" ${_msg_opts} -o -n"
64- shift 1
65- fi
66- [[ " ${msgdebug} " = true ]] && _msg_opts=" ${_msg_opts} -x"
67- [[ " ${nocolor} " = true ]] && _msg_opts=" ${_msg_opts} -n"
68- " ${tools_dir} /msg.sh" ${_msg_opts} warn " ${1} "
66+ msg_common warn " ${@ } "
6967}
7068
7169# Show an debug message
7270# ${1}: message string
7371msg_debug () {
7472 if [[ " ${debug} " = true ]]; then
75- local _msg_opts=" -a build.sh"
76- if [[ " ${1} " = " -n" ]]; then
77- _msg_opts=" ${_msg_opts} -o -n"
78- shift 1
79- fi
80- [[ " ${msgdebug} " = true ]] && _msg_opts=" ${_msg_opts} -x"
81- [[ " ${nocolor} " = true ]] && _msg_opts=" ${_msg_opts} -n"
82- " ${tools_dir} /msg.sh" ${_msg_opts} debug " ${1} "
73+ msg_common debug " ${@ } "
8374 fi
8475}
8576
8677# Show an ERROR message then exit with status
8778# ${1}: message string
8879# ${2}: exit code number (with 0 does not exit)
8980msg_error () {
90- local _msg_opts=" -a build.sh"
91- if [[ " ${1} " = " -n" ]]; then
92- _msg_opts=" ${_msg_opts} -o -n"
93- shift 1
94- fi
95- [[ " ${msgdebug} " = true ]] && _msg_opts=" ${_msg_opts} -x"
96- [[ " ${nocolor} " = true ]] && _msg_opts=" ${_msg_opts} -n"
97- " ${tools_dir} /msg.sh" ${_msg_opts} error " ${1} "
81+ msg_common error " ${@ } "
9882 if [[ -n " ${2:- } " ]]; then
99- exit ${2}
83+ exit " ${2} "
10084 fi
10185}
10286
@@ -534,8 +518,8 @@ prepare_build() {
534518 logging=" ${out_dir} /${iso_filename% .iso} .log"
535519 fi
536520 mkdir -p " $( dirname " ${logging} " ) " ; touch " ${logging} "
537- msg_warn " Re-run sudo ${0} ${DEFAULT_ARGUMENT} ${ARGUMENT[*]} --nolog 2>&1 | tee ${logging} "
538- sudo ${0} ${DEFAULT_ARGUMENT} " ${ARGUMENT[@]} " --nolog 2>&1 | tee " ${logging} "
521+ msg_warn " Re-run sudo ${0} ${DEFAULT_ARGUMENT} ${ARGUMENT[*]} --nodepend -- nolog 2>&1 | tee ${logging} "
522+ sudo ${0} ${DEFAULT_ARGUMENT} " ${ARGUMENT[@]} " --nolog --nodepend 2>&1 | tee " ${logging} "
539523 exit " ${?} "
540524 else
541525 unset DEFAULT_ARGUMENT ARGUMENT
@@ -635,6 +619,7 @@ make_pkgbuild() {
635619 done
636620
637621 # -- ビルドスクリプトの実行 --#
622+ # copy buold script
638623 cp -rf --preserve=mode " ${script_path} /system/pkgbuild.sh" " ${airootfs_dir} /root/pkgbuild.sh"
639624
640625 # Run build script
@@ -888,20 +873,22 @@ make_efi() {
888873
889874 # edk2-shell based UEFI shell
890875 local _efi_shell_arch
891- for _efi_shell_arch in $( find " ${airootfs_dir} /usr/share/edk2-shell" -mindepth 1 -maxdepth 1 -type d -print0 | xargs -0 -I{} basename {}) ; do
892- if [[ -f " ${airootfs_dir} /usr/share/edk2-shell/${_efi_shell_arch} /Shell_Full.efi" ]]; then
893- cp " ${airootfs_dir} /usr/share/edk2-shell/${_efi_shell_arch} /Shell_Full.efi" " ${isofs_dir} /EFI/shell_${_efi_shell_arch} .efi"
894- elif [[ -f " ${airootfs_dir} /usr/share/edk2-shell/${_efi_shell_arch} /Shell.efi" ]]; then
895- cp " ${airootfs_dir} /usr/share/edk2-shell/${_efi_shell_arch} /Shell.efi" " ${isofs_dir} /EFI/shell_${_efi_shell_arch} .efi"
896- else
897- continue
898- fi
899- cat - > " ${isofs_dir} /loader/entries/uefi-shell-${_efi_shell_arch} .conf" << EOF
876+ if [[ -d " ${airootfs_dir} /usr/share/edk2-shell" ]]; then
877+ for _efi_shell_arch in $( find " ${airootfs_dir} /usr/share/edk2-shell" -mindepth 1 -maxdepth 1 -type d -print0 | xargs -0 -I{} basename {}) ; do
878+ if [[ -f " ${airootfs_dir} /usr/share/edk2-shell/${_efi_shell_arch} /Shell_Full.efi" ]]; then
879+ cp " ${airootfs_dir} /usr/share/edk2-shell/${_efi_shell_arch} /Shell_Full.efi" " ${isofs_dir} /EFI/shell_${_efi_shell_arch} .efi"
880+ elif [[ -f " ${airootfs_dir} /usr/share/edk2-shell/${_efi_shell_arch} /Shell.efi" ]]; then
881+ cp " ${airootfs_dir} /usr/share/edk2-shell/${_efi_shell_arch} /Shell.efi" " ${isofs_dir} /EFI/shell_${_efi_shell_arch} .efi"
882+ else
883+ continue
884+ fi
885+ cat - > " ${isofs_dir} /loader/entries/uefi-shell-${_efi_shell_arch} .conf" << EOF
900886title UEFI Shell ${_efi_shell_arch}
901887efi /EFI/shell_${_efi_shell_arch} .efi
902888
903889EOF
904- done
890+ done
891+ fi
905892}
906893
907894# Prepare efiboot.img::/EFI for "El Torito" EFI boot mode
@@ -937,7 +924,8 @@ make_efiboot() {
937924
938925 mkdir -p " ${build_dir} /efiboot/loader/entries"
939926 sed " s|%ARCH%|${arch} |g;" " ${script_path} /efiboot/${_use_config_name} /loader.conf" > " ${build_dir} /efiboot/loader/loader.conf"
940- cp " ${isofs_dir} /loader/entries/uefi-shell" * " ${build_dir} /efiboot/loader/entries/"
927+
928+ find " ${isofs_dir} /loader/entries/" -maxdepth 1 -mindepth 1 -name " uefi-shell*" -type f -printf " %p\0" | xargs -0 -I{} cp {} " ${build_dir} /efiboot/loader/entries/"
941929
942930 local _efi_config _efi_config_list=($( ls " ${script_path} /efiboot/${_use_config_name} /archiso-cd" * " .conf" ) )
943931
@@ -954,7 +942,7 @@ make_efiboot() {
954942 " ${_efi_config} " > " ${build_dir} /efiboot/loader/entries/$( basename " ${_efi_config} " | sed " s|cd|${arch} |g" ) "
955943 done
956944
957- cp " ${isofs_dir} /EFI/shell " * " .efi" " ${build_dir} /efiboot/EFI/"
945+ find " ${isofs_dir} /EFI" -maxdepth 1 -mindepth 1 -name " shell* .efi" -printf " %p\0 " | xargs -0 -I{} cp {} " ${build_dir} /efiboot/EFI/"
958946 umount -d " ${build_dir} /efiboot"
959947}
960948
0 commit comments