diff options
-rw-r--r-- | locale/en_US.sh | 2 | ||||
-rw-r--r-- | src/cmd/build.sh | 56 |
2 files changed, 33 insertions, 25 deletions
diff --git a/locale/en_US.sh b/locale/en_US.sh index 60772c2..59bf104 100644 --- a/locale/en_US.sh +++ b/locale/en_US.sh @@ -100,7 +100,7 @@ msg_prokit_cmd_opkg_usage='<root> [<option> ...] <sub-command> '\ # src/cmd/build.sh msg_prokit_cmd_build_summary='build a package' -msg_prokit_cmd_build_usage='<root> [<option> ...] <pkg-dir>' +msg_prokit_cmd_build_usage='<root> [-l] [<option> ...] <pkg-dir>' msg_prokit_cmd_build_not_a_dir='Not a directory: %s' # src/cmd/installer-pc.sh diff --git a/src/cmd/build.sh b/src/cmd/build.sh index a3e903b..dd89848 100644 --- a/src/cmd/build.sh +++ b/src/cmd/build.sh @@ -211,12 +211,12 @@ cmd_build_main() local build_plat= local host_arch= local host_plat= + local log= local opts= local opt= local source= local version= local dist= - local log= local es= if [ ${#} -lt 2 ]; then @@ -242,11 +242,13 @@ cmd_build_main() build_plat="$(cat -- "${root}/etc/proteanos_plat")" host_arch="${build_arch}" host_plat="${build_plat}" + log=true opts='' - while getopts "${opkbuild_optstring}" opt 2>/dev/null; do + while getopts "l${opkbuild_optstring}" opt 2>/dev/null; do case "${opt}" in a) host_arch="${OPTARG}";; p) host_plat="${OPTARG}";; + l) log=false;; *) opts="${opts}${opt} " eval "opt_${opt}_set=\"\${OPTARG:+set}\"" @@ -297,31 +299,37 @@ cmd_build_main() return 2 fi - read -r source version dist <<-EOF - $(package_get_name_version_dist) - EOF - log="${_cmd_build_pkg_dir}/../$(: \ - )${source}_${version}_${host_arch}_${host_plat}.log" - es=0 - { + if ${log}; then + read -r source version dist <<-EOF + $(package_get_name_version_dist) + EOF + log="${_cmd_build_pkg_dir}/../$(: \ + )${source}_${version}_${host_arch}_${host_plat}.log" { { - set +e - _cmd_build_build \ - "${build_arch}" "${build_plat}" \ - "${host_arch}" "${host_plat}" \ - "${dist}" "${@}" 2>&1 - printf '%d' ${?} 1>&3 - } | sed "/^Filter: /!{ - s|$(session_dir)|<<SESSION_DIR>>|; - s|$(session_id)|<<SESSION_ID>>|; - };" | tee "${log}" 1>&2 - } 3>&1 | { - read es - exit ${es} - } - } 2>&1 || es=${?} + { + set +e + _cmd_build_build \ + "${build_arch}" "${build_plat}"\ + "${host_arch}" "${host_plat}" \ + "${dist}" "${@}" 2>&1 + printf '%d' ${?} 1>&3 + } | sed "/^Filter: /!{ + s|$(session_dir)|<<SESSION_DIR>>|; + s|$(session_id)|<<SESSION_ID>>|; + };" | tee "${log}" 1>&2 + } 3>&1 | { + read es + exit ${es} + } + } 2>&1 || es=${?} + else + _cmd_build_build \ + "${build_arch}" "${build_plat}" \ + "${host_arch}" "${host_plat}" \ + "${dist}" "${@}" + fi session_end |