summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2019-03-18 00:21:04 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2019-03-18 00:21:04 (EDT)
commitcddee020eb30a4aa8a72c0378103b810c8c1d8c7 (patch)
treeaa731c32d0a39dbbd3024bb29053b041bcb50160
parent3ff76e13ec3c85c73ec20187329fce8beef6bfc2 (diff)
ob-installdocs: Declare local variables and wrap long lines
-rw-r--r--src/ob-installdocs.sh48
1 files changed, 33 insertions, 15 deletions
diff --git a/src/ob-installdocs.sh b/src/ob-installdocs.sh
index 9ea5b42..f07bfb8 100644
--- a/src/ob-installdocs.sh
+++ b/src/ob-installdocs.sh
@@ -21,29 +21,33 @@ set -eu
install_docs()
{
- srcs="${1}"
- dest="${2}"
- data_doc_dir="${3}"
+ local srcs="${1}"
+ local dest="${2}"
+ local data_doc_dir="${3}"
+ shift 3
+ local src=
for src in ${srcs}; do
if [ -f "${src}" ]; then
- if ! mkdir -p -- "$(dirname -- "${data_doc_dir}/./${dest}")"
- then
+ if ! mkdir -p -- "$(dirname -- \
+ "${data_doc_dir}/./${dest}")"; then
ob_error "$(ob_get_msg 'cant_make_doc_dir')"
return 1
fi
if ! cp -R -- "${src}" "${data_doc_dir}/${dest}"; then
- ob_error "$(ob_get_msg 'cant_cp_doc_file')" "${src}"
+ ob_error "$(ob_get_msg 'cant_cp_doc_file')" \
+ "${src}"
return 1
fi
elif [ -d "${src}" ]; then
- if ! mkdir -p -- "$(dirname -- "${data_doc_dir}/./${dest}")"
- then
+ if ! mkdir -p -- "$(dirname -- \
+ "${data_doc_dir}/./${dest}")"; then
ob_error "$(ob_get_msg 'cant_make_doc_dir')"
return 1
fi
if ! cp -R -- "${src}/." "${data_doc_dir}/${dest}"; then
- ob_error "$(ob_get_msg 'cant_cp_doc_file')" "${src}"
+ ob_error "$(ob_get_msg 'cant_cp_doc_file')" \
+ "${src}"
return 1
fi
fi
@@ -54,6 +58,14 @@ install_docs()
main()
{
+ local doc_pkg=
+ local doc_pkg_doc_dir=
+ local pkg=
+ local doc_dir=
+ local data_doc_dir=
+ local srcs=
+ local dest=
+
if ! ob_set_text_domain 'opkbuild'; then
printf '%s: Error: Failed to load locale messages\n' \
"${0##*/}" >&2
@@ -75,11 +87,14 @@ main()
data_doc_dir="${pkg}.data/${doc_dir%/}"
if [ x"${pkg}" = x"${doc_pkg}" ]; then
if [ -d "${data_doc_dir}" ]; then
- ob_info "$(ob_get_msg 'docs_already_installed')" "${pkg}"
+ ob_info "$(ob_get_msg \
+ 'docs_already_installed')" "${pkg}"
else
- ob_info "$(ob_get_msg 'installing_docs')" "${pkg}"
+ ob_info "$(ob_get_msg 'installing_docs')" \
+ "${pkg}"
if ! mkdir -p -- "${data_doc_dir}"; then
- ob_error "$(ob_get_msg 'cant_make_doc_dir')"
+ ob_error "$(ob_get_msg \
+ 'cant_make_doc_dir')"
return 1
fi
while read srcs dest; do
@@ -91,17 +106,20 @@ main()
fi
else
if [ -L "${data_doc_dir}" ]; then
- ob_info "$(ob_get_msg 'docs_already_linked')" "${pkg}"
+ ob_info "$(ob_get_msg 'docs_already_linked')" \
+ "${pkg}"
else
ob_info "$(ob_get_msg 'linking_docs')" "${pkg}"
if ! mkdir -p -- "$(dirname -- \
"${data_doc_dir}")"; then
- ob_error "$(ob_get_msg 'cant_make_doc_dir')"
+ ob_error "$(ob_get_msg \
+ 'cant_make_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')"
+ ob_error "$(ob_get_msg \
+ 'cant_ln_doc_dir')"
return 1
fi
fi