summaryrefslogtreecommitdiffstats
path: root/src/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/build.sh36
1 files changed, 25 insertions, 11 deletions
diff --git a/src/cmd/build.sh b/src/cmd/build.sh
index 3a3da4f..a3e903b 100644
--- a/src/cmd/build.sh
+++ b/src/cmd/build.sh
@@ -211,8 +211,8 @@ cmd_build_main()
local build_plat=
local host_arch=
local host_plat=
- local first_arg=
- local arg=
+ local opts=
+ local opt=
local source=
local version=
local dist=
@@ -242,23 +242,37 @@ cmd_build_main()
build_plat="$(cat -- "${root}/etc/proteanos_plat")"
host_arch="${build_arch}"
host_plat="${build_plat}"
+ opts=''
while getopts "${opkbuild_optstring}" opt 2>/dev/null; do
case "${opt}" in
a) host_arch="${OPTARG}";;
p) host_plat="${OPTARG}";;
+ *)
+ opts="${opts}${opt} "
+ eval "opt_${opt}_set=\"\${OPTARG:+set}\""
+ eval "opt_${opt}=\"\${OPTARG:-}\""
+ ;;
+ ?)
+ print_cmd_usage 'build' >&2
+ [ "x${dev}" != 'x' ] && block_umount "${root}"
+ return 1
+ ;;
esac
done
+ shift $((${OPTIND} - 1))
- first_arg=true
- _cmd_build_pkg_dir=''
- for arg in "${@}"; do
- if ${first_arg}; then
- set --
- first_arg=false
- else
- set -- "${@}" "${_cmd_build_pkg_dir}"
+ if [ ${#} -ne 1 ]; then
+ print_cmd_usage 'build' >&2
+ [ "x${dev}" != 'x' ] && block_umount "${root}"
+ return 1
+ fi
+ _cmd_build_pkg_dir="${1}"
+ set -- -a "${host_arch}" -p "${host_plat}"
+ for opt in ${opts}; do
+ set -- "${@}" "-${opt}"
+ if eval "[ x\"\${opt_${opt}_set}\" = x'set' ]"; then
+ eval "set -- \"\${@}\" \"\${opt_${opt}}\""
fi
- _cmd_build_pkg_dir="${arg}"
done
if ! profile_detect "${root}"; then