From df34a071ee38b519bdbdfdfb00bc9141720e4986 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 04 Oct 2012 15:23:47 -0400 Subject: Implement ob-installdocs. --- (limited to 'src') 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 "${@}" -- cgit v0.9.1