summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/opkbuild.sh51
1 files changed, 31 insertions, 20 deletions
diff --git a/src/opkbuild.sh b/src/opkbuild.sh
index 3efea52..eec6a50 100644
--- a/src/opkbuild.sh
+++ b/src/opkbuild.sh
@@ -66,19 +66,28 @@ version()
get_options()
{
+ local opt=
+
+ # Set default option values.
+ opt_build='full'
+ opt_check_build_deps=true
+ opt_uid0_cmd='fakeroot'
+ opt_arch_dep=false
+ opt_plat_dep=false
+
# Parse and handle command-line options.
# Remember to update the optstring file when changing this.
while getopts 'bBPSFT:a:p:DdCcr:hV' opt; do
case "${opt}" in
b)
- case "${opt_build}" in ''|'binary');; *)
+ case "${opt_build}" in 'full'|'binary');; *)
ob_error "$(ob_get_msg 'bsf_mutex')"
return 1
esac
opt_build='binary'
;;
B)
- case "${opt_build}" in ''|'binary');; *)
+ case "${opt_build}" in 'full'|'binary');; *)
ob_error "$(ob_get_msg 'bsf_mutex')"
return 1
esac
@@ -86,7 +95,7 @@ get_options()
opt_arch_dep=true
;;
P)
- case "${opt_build}" in ''|'binary');; *)
+ case "${opt_build}" in 'full'|'binary');; *)
ob_error "$(ob_get_msg 'bsf_mutex')"
return 1
esac
@@ -94,7 +103,7 @@ get_options()
opt_plat_dep=true
;;
S)
- case "${opt_build}" in ''|'source');; *)
+ case "${opt_build}" in 'full'|'source');; *)
ob_error "$(ob_get_msg 'bsf_mutex')"
return 1
esac
@@ -146,13 +155,6 @@ get_options()
esac
done
- # Set default option values.
- [ -z "${opt_build}" ] && opt_build='full'
- [ -z "${opt_check_build_deps}" ] && opt_check_build_deps='true'
- [ -z "${opt_uid0_cmd}" ] && opt_uid0_cmd='fakeroot'
- [ "x${opt_arch_dep}" = 'x' ] && opt_arch_dep=false
- [ "x${opt_plat_dep}" = 'x' ] && opt_plat_dep=false
-
# Set cleaning behavior.
if [ -n "${opt_target}" ]; then
[ -z "${opt_clean}" ] && opt_clean='false'
@@ -165,13 +167,15 @@ get_options()
test_uid0_cmd()
{
+ local test_uid=
+
# Verify that the UID 0 command works.
if ! test_uid=$("${opt_uid0_cmd}" -- id -u); then
ob_error "$(ob_get_msg 'uid0_cmd_not_found')" "${opt_uid0_cmd}"
return 1
fi
- if [ ${test_uid} -ne 0 ]; then
+ if [ x"${test_uid}" != x'0' ]; then
ob_error "$(ob_get_msg 'uid0_cmd_bad_uid')" "${opt_uid0_cmd}"
return 1
fi
@@ -198,12 +202,12 @@ setup_arch_plat()
OPK_HOST_PLAT="${OPK_BUILD_PLAT}"
fi
- IFS='-' read OPK_BUILD_ARCH_CPU OPK_BUILD_ARCH_KERNEL OPK_BUILD_ARCH_LIBS \
- <<-EOF
+ IFS='-' read OPK_BUILD_ARCH_CPU OPK_BUILD_ARCH_KERNEL \
+ OPK_BUILD_ARCH_LIBS <<-EOF
${OPK_BUILD_ARCH}
EOF
- IFS='-' read OPK_HOST_ARCH_CPU OPK_HOST_ARCH_KERNEL OPK_HOST_ARCH_LIBS \
- <<-EOF
+ IFS='-' read OPK_HOST_ARCH_CPU OPK_HOST_ARCH_KERNEL \
+ OPK_HOST_ARCH_LIBS <<-EOF
${OPK_HOST_ARCH}
EOF
@@ -228,7 +232,8 @@ setup_package()
OPK_SOURCE="$(ob_get_source_parameter 'Source')"
OPK_SOURCE_VERSION="$(ob_get_source_parameter 'Version')"
- ob_parse_version -u 'OPK_SOURCE_VERSION_UPSTREAM' "${OPK_SOURCE_VERSION}"
+ ob_parse_version -u 'OPK_SOURCE_VERSION_UPSTREAM' \
+ "${OPK_SOURCE_VERSION}"
OPK_BINARY_VERSION="$(ob_get_source_parameter 'Version')"
return 0
@@ -236,12 +241,17 @@ setup_package()
build_source()
{
+ local src=
+ local ver=
+ local src_pkg_data_base=
+ local file=
+
ob_info "$(ob_get_msg 'build_source')"
src="$(ob_get_source_parameter 'Source')"
ver="$(ob_get_source_parameter 'Version')"
- src_pkg_data_base="src-${src}.data$(ob_get_system_path 'package-source' \
- "${src}" "${ver}")"
+ src_pkg_data_base="src-${src}.data$(ob_get_system_path \
+ 'package-source' "${src}" "${ver}")"
if ! "${opt_uid0_cmd}" -- mkdir -p -- "${src_pkg_data_base}"; then
ob_error "$(ob_get_msg 'cant_make_src_pkg_dir')"
@@ -255,7 +265,8 @@ build_source()
../*)
if ! "${opt_uid0_cmd}" -- cp -Rp -- "${file}" \
"${src_pkg_data_base}"; then
- ob_error "$(ob_get_msg 'cant_install_src_pkg_file')"
+ ob_error "$(ob_get_msg \
+ 'cant_install_src_pkg_file')"
return 1
fi
;;