summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ob-applypatches.sh10
-rw-r--r--src/ob-checkbuilddeps.sh1
-rw-r--r--src/ob-installdocs.sh36
-rw-r--r--src/ob-unpacksource.sh38
4 files changed, 67 insertions, 18 deletions
diff --git a/src/ob-applypatches.sh b/src/ob-applypatches.sh
index 2650223..90ccc3d 100644
--- a/src/ob-applypatches.sh
+++ b/src/ob-applypatches.sh
@@ -38,8 +38,10 @@ apply_patches()
patch="${patch#../patches/}"
ob_info "$(ob_get_msg 'applying_patch')" "${patch}"
cd src
- patch -N -p 1 -u -i "../../patches/${patch}" || \
+ if ! patch -N -p 1 -u -i "../../patches/${patch}"; then
ob_error "$(ob_get_msg 'cant_apply_patch')" "${patch}"
+ return 1
+ fi
cd ..
applied='true'
done
@@ -47,6 +49,8 @@ apply_patches()
fi
${applied} || ob_info "$(ob_get_msg 'no_patches')"
+
+ return 0
}
main()
@@ -56,7 +60,9 @@ main()
ob_init_package '..' || exit 1
ob_parse_package_metadata -c '.opkbuild.cache' || exit 1
- apply_patches
+ apply_patches || return 1
+
+ return 0
}
main "${@}"
diff --git a/src/ob-checkbuilddeps.sh b/src/ob-checkbuilddeps.sh
index d49bf25..e002029 100644
--- a/src/ob-checkbuilddeps.sh
+++ b/src/ob-checkbuilddeps.sh
@@ -75,6 +75,7 @@ check_build_deps()
missing="${missing#, }"
if [ "x${missing}" != 'x' ]; then
ob_error "$(ob_get_msg 'missing_build_deps')" "${missing}"
+ return 1
fi
return 0
diff --git a/src/ob-installdocs.sh b/src/ob-installdocs.sh
index 484a01b..292925c 100644
--- a/src/ob-installdocs.sh
+++ b/src/ob-installdocs.sh
@@ -30,20 +30,30 @@ install_docs()
for src in ${srcs}; do
if [ -f "${src}" ]; then
if [ "${dest%/*}" != "${dest}" ]; then
- mkdir -p "${data_doc_dir}/${dest%/*}" || \
+ if ! mkdir -p "${data_doc_dir}/${dest%/*}"; then
ob_error "$(ob_get_msg 'cant_make_doc_dir')"
+ return 1
+ fi
fi
- cp -R "${src}" "${data_doc_dir}/${dest}" || \
+ if ! cp -R "${src}" "${data_doc_dir}/${dest}"; then
ob_error "$(ob_get_msg 'cant_cp_doc_file')" "${src}"
+ return 1
+ fi
elif [ -d "${src}" ]; then
if [ "${dest%/*}" != "${dest}" ]; then
- mkdir -p "${data_doc_dir}/${dest%/*}" || \
+ if ! mkdir -p "${data_doc_dir}/${dest%/*}"; then
ob_error "$(ob_get_msg 'cant_make_doc_dir')"
+ return 1
+ fi
fi
- cp -R "${src}/." "${data_doc_dir}/${dest}" || \
+ if ! cp -R "${src}/." "${data_doc_dir}/${dest}"; then
ob_error "$(ob_get_msg 'cant_cp_doc_file')" "${src}"
+ return 1
+ fi
fi
done
+
+ return 0
}
main()
@@ -55,6 +65,7 @@ main()
if ! doc_pkg="$(ob_get_doc_package)"; then
ob_error "$(ob_get_msg 'cant_get_doc_pkg')"
+ return 1
fi
doc_pkg_doc_dir="$(ob_get_system_path 'package-docs' \
"${doc_pkg}" "${OPK_BINARY_VERSION}")"
@@ -68,11 +79,13 @@ main()
ob_info "$(ob_get_msg 'docs_already_installed')" "${pkg}"
else
ob_info "$(ob_get_msg 'installing_docs')" "${pkg}"
- mkdir -p "${data_doc_dir}" || \
+ if ! mkdir -p "${data_doc_dir}"; then
ob_error "$(ob_get_msg 'cant_make_doc_dir')"
+ return 1
+ fi
while read srcs dest; do
install_docs "${srcs}" "${dest}" \
- "${data_doc_dir}"
+ "${data_doc_dir}" || return 1
done <<-EOF
$(ob_get_doc_files "${OPK_HOST_ARCH}" \
"${OPK_HOST_PLAT}")
@@ -83,13 +96,20 @@ main()
ob_info "$(ob_get_msg 'docs_already_linked')" "${pkg}"
else
ob_info "$(ob_get_msg 'linking_docs')" "${pkg}"
- mkdir -p "${data_doc_dir%/*}" || \
+ if ! mkdir -p "${data_doc_dir%/*}"; then
ob_error "$(ob_get_msg 'cant_make_doc_dir')"
- ln -s "${doc_pkg_doc_dir}" "${data_doc_dir}" || \
+ return 1
+ fi
+ if ! ln -s "${doc_pkg_doc_dir}" \
+ "${data_doc_dir}"; then
ob_error "$(ob_get_msg 'cant_ln_doc_dir')"
+ return 1
+ fi
fi
fi
done
+
+ return 0
}
main "${@}"
diff --git a/src/ob-unpacksource.sh b/src/ob-unpacksource.sh
index 76bb174..e90c6c0 100644
--- a/src/ob-unpacksource.sh
+++ b/src/ob-unpacksource.sh
@@ -29,7 +29,12 @@ upstream_ar_dir=
unpack_native()
{
ob_info "$(ob_get_msg 'unpacking_native')"
- cp -Rp '../src' 'src' || ob_error "$(ob_get_msg 'cant_unpack_native')"
+ if ! cp -Rp '../src' 'src'; then
+ ob_error "$(ob_get_msg 'cant_unpack_native')"
+ return 1
+ fi
+
+ return 0
}
get_upstream_archive()
@@ -43,6 +48,7 @@ get_upstream_archive()
;;
*' '*)
ob_error "$(ob_get_msg 'multiple_upstream_sources')"
+ return 1
;;
*)
return 0
@@ -72,8 +78,11 @@ get_upstream_compression()
*)
ob_error "$(ob_get_msg 'unsupported_archive_compression')" \
"${z_ext}"
+ return 1
;;
esac
+
+ return 0
}
get_upstream_dir()
@@ -87,28 +96,39 @@ get_upstream_dir()
case "${dir_count}" in
0)
ob_error "$(ob_get_msg 'no_upstream_dirs')"
+ return 1
;;
1)
;;
*)
ob_error "$(ob_get_msg 'multiple_top_upstream_dirs')"
+ return 1
esac
+
+ return 0
}
extract_upstream()
{
ob_info "$(ob_get_msg 'unpacking_upstream')"
- tar "-x${upstream_ar_z}f" "${upstream_ar}" || \
+ if ! tar "-x${upstream_ar_z}f" "${upstream_ar}"; then
ob_error "$(ob_get_msg 'cant_unpack_upstream')"
- mv "${upstream_ar_dir}" 'src' || \
+ return 1
+ fi
+ if ! mv "${upstream_ar_dir}" 'src'; then
ob_error "$(ob_get_msg 'cant_move_native')"
+ return 1
+ fi
+
+ return 0
}
unpack_upstream()
{
- get_upstream_compression
- get_upstream_dir
- extract_upstream
+ get_upstream_compression || return 1
+ get_upstream_dir || return 1
+ extract_upstream || return 1
+ return 0
}
main()
@@ -122,11 +142,13 @@ main()
ob_info "$(ob_get_msg 'already_unpacked')"
else
if [ -d '../src' ]; then
- unpack_native
+ unpack_native || return 1
elif get_upstream_archive; then
- unpack_upstream
+ unpack_upstream || return 1
fi
fi
+
+ return 0
}
main "${@}"