diff options
author | P. J. McDermott <pjm@nac.net> | 2012-10-24 00:16:12 (EDT) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2012-10-24 00:16:12 (EDT) |
commit | 9c492336b959a607c9e2dc09e7b16ce2e03fc60e (patch) | |
tree | 5eb4919406e511f6b37b6c1659cd867ee5b3dda4 /src | |
parent | c20bbe68307a79c5a08ece9cb7b752ff1555c73d (diff) |
Look both ways before installing documentation.
Diffstat (limited to 'src')
-rw-r--r-- | src/ob-installdocs.sh | 56 |
1 files changed, 32 insertions, 24 deletions
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 } |