summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2013-09-20 16:28:36 (EDT)
committer P. J. McDermott <pjm@nac.net>2013-09-20 16:28:36 (EDT)
commitff87c2ab10383ab031fc67855567881e61bcbb1b (patch)
tree923c0395030db195335e7b0df2ed3a3e6e45c6df /src
parent8882022f5358f9123a41f2412e520a42bb3881af (diff)
ob-installdocs: Support patterns in *.pkg/docs.
Diffstat (limited to 'src')
-rw-r--r--src/ob-installdocs.sh50
1 files changed, 32 insertions, 18 deletions
diff --git a/src/ob-installdocs.sh b/src/ob-installdocs.sh
index 512976a..3732949 100644
--- a/src/ob-installdocs.sh
+++ b/src/ob-installdocs.sh
@@ -50,24 +50,13 @@ main()
ob_info "$(ob_get_msg 'installing_docs')" "${pkg}"
mkdir -p "${data_doc_dir}" || \
ob_error "$(ob_get_msg 'cant_make_doc_dir')"
- ob_get_doc_files "${OPK_HOST_ARCH}" "${OPK_HOST_PLAT}" | \
- while read src dest; do
- if [ -f "${src}" ]; then
- if [ "${dest%/*}" != "${dest}" ]; then
- mkdir -p "${data_doc_dir}/${dest%/*}" || \
- ob_error "$(ob_get_msg 'cant_make_doc_dir')"
- fi
- cp -R "${src}" "${data_doc_dir}/${dest}" || \
- ob_error "$(ob_get_msg 'cant_cp_doc_file')" "${src}"
- elif [ -d "${src}" ]; then
- if [ "${dest%/*}" != "${dest}" ]; then
- mkdir -p "${data_doc_dir}/${dest%/*}" || \
- ob_error "$(ob_get_msg 'cant_make_doc_dir')"
- fi
- cp -R "${src}/." "${data_doc_dir}/${dest}" || \
- ob_error "$(ob_get_msg 'cant_cp_doc_file')" "${src}"
- fi
- done
+ while read srcs dest; do
+ install_docs "${srcs}" "${dest}" \
+ "${data_doc_dir}"
+ done <<-EOF
+ $(ob_get_doc_files "${OPK_HOST_ARCH}" \
+ "${OPK_HOST_PLAT}")
+ EOF
fi
else
if [ -L "${data_doc_dir}" ]; then
@@ -83,4 +72,29 @@ main()
done
}
+install_docs()
+{
+ srcs="${1}"
+ dest="${2}"
+ data_doc_dir="${3}"
+
+ for src in ${srcs}; do
+ if [ -f "${src}" ]; then
+ if [ "${dest%/*}" != "${dest}" ]; then
+ mkdir -p "${data_doc_dir}/${dest%/*}" || \
+ ob_error "$(ob_get_msg 'cant_make_doc_dir')"
+ fi
+ cp -R "${src}" "${data_doc_dir}/${dest}" || \
+ ob_error "$(ob_get_msg 'cant_cp_doc_file')" "${src}"
+ elif [ -d "${src}" ]; then
+ if [ "${dest%/*}" != "${dest}" ]; then
+ mkdir -p "${data_doc_dir}/${dest%/*}" || \
+ ob_error "$(ob_get_msg 'cant_make_doc_dir')"
+ fi
+ cp -R "${src}/." "${data_doc_dir}/${dest}" || \
+ ob_error "$(ob_get_msg 'cant_cp_doc_file')" "${src}"
+ fi
+ done
+}
+
main "${@}"