diff options
-rw-r--r-- | locale/en_US/opkbuild.sh | 2 | ||||
-rw-r--r-- | src/ob-installdocs.sh | 56 |
2 files changed, 34 insertions, 24 deletions
diff --git a/locale/en_US/opkbuild.sh b/locale/en_US/opkbuild.sh index c1c3ebd..6263ce0 100644 --- a/locale/en_US/opkbuild.sh +++ b/locale/en_US/opkbuild.sh @@ -101,7 +101,9 @@ msg_opkbuild_cant_copy_config_file='Can'\''t copy configuration file' # ob-installdocs msg_opkbuild_cant_get_doc_pkg='Can'\''t find package to provide documentation files' msg_opkbuild_cant_make_doc_dir='Can'\''t make documentation directory' +msg_opkbuild_docs_already_installed='Package documentation already installed into package "%s"' msg_opkbuild_installing_docs='Installing package documentation into package "%s"...' msg_opkbuild_cant_cp_doc_file='Can'\''t copy documentation file "%s"' +msg_opkbuild_docs_already_linked='Link to documentation already made in package "%s"' msg_opkbuild_linking_docs='Making link to documentation in package "%s"...' msg_opkbuild_cant_ln_doc_dir='Can'\''t make link to documentation directory' diff --git a/src/ob-installdocs.sh b/src/ob-installdocs.sh index 4cc522c..1e596e3 100644 --- a/src/ob-installdocs.sh +++ b/src/ob-installdocs.sh @@ -44,32 +44,40 @@ main() "${pkg}" "${OPK_BINARY_VERSION}")" data_doc_dir="${pkg}.data/${doc_dir%/}" if [ "${pkg}" = "${doc_pkg}" ]; then - 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 | 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')" + if [ -d "${data_doc_dir}" ]; then + ob_info "$(ob_get_msg 'docs_already_installed')" "${pkg}" + else + 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 | 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 - 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 + done + fi else - ob_info "$(ob_get_msg 'linking_docs')" "${pkg}" - mkdir -p "${data_doc_dir%/*}" || \ - ob_error "$(ob_get_msg 'cant_make_doc_dir')" - ln -s "${doc_pkg_doc_dir}" "${data_doc_dir}" || \ - ob_error "$(ob_get_msg 'cant_ln_doc_dir')" + if [ -L "${data_doc_dir}" ]; then + ob_info "$(ob_get_msg 'docs_already_linked')" "${pkg}" + else + ob_info "$(ob_get_msg 'linking_docs')" "${pkg}" + mkdir -p "${data_doc_dir%/*}" || \ + ob_error "$(ob_get_msg 'cant_make_doc_dir')" + ln -s "${doc_pkg_doc_dir}" "${data_doc_dir}" || \ + ob_error "$(ob_get_msg 'cant_ln_doc_dir')" + fi fi done } |