diff options
author | P. J. McDermott <pjm@nac.net> | 2012-10-04 15:23:47 (EDT) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2012-10-04 15:23:47 (EDT) |
commit | df34a071ee38b519bdbdfdfb00bc9141720e4986 (patch) | |
tree | 4eee9501afeb6431f78cc062404a60a512fe176f /src | |
parent | dfc573030ede1f8d245049abc2766d2d2afdfdfa (diff) |
Implement ob-installdocs.
Diffstat (limited to 'src')
-rw-r--r-- | src/ob-installdocs.sh | 28 |
1 files changed, 28 insertions, 0 deletions
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 "${@}" |