diff options
-rw-r--r-- | locale/en_US/opkbuild.sh | 8 | ||||
-rw-r--r-- | src/ob-installdocs.sh | 28 |
2 files changed, 36 insertions, 0 deletions
diff --git a/locale/en_US/opkbuild.sh b/locale/en_US/opkbuild.sh index 81c236f..01be733 100644 --- a/locale/en_US/opkbuild.sh +++ b/locale/en_US/opkbuild.sh @@ -89,3 +89,11 @@ msg_opkbuild_cant_make_config_dest_dir='Can'\''t make directory "%s" for platfor msg_opkbuild_no_config_dir='No platform configuration files found' msg_opkbuild_copying_config_file='Copying configuration file "%s" to "%s"...' 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_installing_docs='Installing package documentation into package "%s"...' +msg_opkbuild_cant_cp_doc_file='Can'\''t copy documentation file "%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 c686029..663a29f 100644 --- a/src/ob-installdocs.sh +++ b/src/ob-installdocs.sh @@ -32,6 +32,34 @@ main() ob_init_package '..' ob_parse_package_metadata -c '.opkbuild.cache' + doc_pkg="$(ob_get_doc_package)" + if [ ${?} -ne 0 ]; then + ob_error "$(ob_get_msg 'cant_get_doc_pkg')" + fi + + for pkg in $(ob_get_binary_packages); do + doc_dir="${pkg}.data/usr/share/doc/${pkg}" + mkdir -p "${doc_dir}" || \ + ob_error "$(ob_get_msg 'cant_make_doc_dir')" + if [ "${pkg}" = "${doc_pkg}" ]; then + ob_info "$(ob_get_msg 'installing_docs')" "${pkg}" + ob_get_doc_files | while read src dest; do + if [ -f "${src}" ]; then + mkdir -p "${doc_dir}/${dest%/*}" || \ + ob_error "$(ob_get_msg 'cant_make_doc_dir')" + cp -R "${src}" "${doc_dir}/${dest}" || \ + ob_error "$(ob_get_msg 'cant_cp_doc_file')" "${src}" + elif [ -d "${src}" ]; then + cp -R "${src}/." "${doc_dir}/${dest}" || \ + ob_error "$(ob_get_msg 'cant_cp_doc_file')" "${src}" + fi + done + else + ob_info "$(ob_get_msg 'linking_docs')" "${pkg}" + ln -s "/usr/share/doc/${doc_pkg}" "${doc_dir}" || \ + ob_error "$(ob_get_msg 'cant_ln_doc_dir')" + fi + done } main "${@}" |