#!/bin/sh -efu # DESCRIPTION # # 1. Copy documentation to disk # 2. Create index.html files in disk's root dir and docs dir # REQUIRES # # Installed packages: # - branding-altlinux-kdesktop-indexhtml # - docs-kdesktop (optional) # INFO # NAME="05-copydocs" disk_docs_dir="docs" verbose() { if [ -n "$GLOBAL_VERBOSE" ]; then echo "HOOK: $NAME: $@" fi } verbose "started" # copy indexhtml file (branding-altlinux-kdesktop-indexhtml package) indexhtml_file=/usr/share/doc/indexhtml/index.html if [ -f "$indexhtml_file" ]; then verbose "indexhtml file found" LANG=en_US /usr/sbin/indexhtml-update mkdir -p "$WORKDIR/$disk_docs_dir/alt-docs" cp -r `dirname "$indexhtml_file"` "$WORKDIR/$disk_docs_dir/" else verbose "$indexhtml_file file not found" verbose "nothing to do. finished" exit 0 fi # create index.html file (root dir) verbose "create index.html (root dir)" cat > "$WORKDIR/index.html" << EOF redirect

redirect

"$WORKDIR/$disk_docs_dir/index.html" # copy docs (docs-kdesktop package) copy_docs() { documentation_dir=/usr/share/doc/documentation if [ -d "$documentation_dir" ]; then verbose "documentation dir found" cp -r "$documentation_dir/" "$WORKDIR/$disk_docs_dir/" else verbose "$documentation_dir not found" fi } copy_docs # replace symlinks with hardlinks verbose "replace symlinks with hardlinks" find "$WORKDIR/$disk_docs_dir/" -type l |while read link; do target="$(readlink -f -- "$link")" rm -f -- "$link" cp -al -- "$target" "$link" done verbose "finished"