From ff87c2ab10383ab031fc67855567881e61bcbb1b Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Fri, 20 Sep 2013 16:28:36 -0400 Subject: ob-installdocs: Support patterns in *.pkg/docs. --- 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 "${@}" -- cgit v0.9.1