diff options
-rw-r--r-- | src/ob-installdocs.sh | 50 |
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 "${@}" |