diff --git a/features.in/docs/README b/features.in/docs/README new file mode 100644 index 00000000..c8bc5d4f --- /dev/null +++ b/features.in/docs/README @@ -0,0 +1,11 @@ +Эта фича добавляет в образ распакованную документацию дистрибутива, +а именно вводную страничку (входит в пакет branding-*-indexhtml) +и/или специфичное для данного продукта руководство из пакета docs-* +(вариант задаётся отдельно выставлением переменной DOCS). + +Обратите внимание, что для indexhtml создаётся переброска с учётом +языка (при наличии index-LL.html), поэтому ожидается задействование +фичи l10n с соответствующим указанием языка по умолчанию. + +NB: предполагается применение при формировании ISO-образов, +другие случаи наверняка потребуют доработки. diff --git a/features.in/docs/config.mk b/features.in/docs/config.mk new file mode 100644 index 00000000..00513386 --- /dev/null +++ b/features.in/docs/config.mk @@ -0,0 +1,18 @@ +# copy the packaged docs to image root +# packaged documentation sources: +# 1) branding-*-indexhtml +# 2) docs-* (should be installed elsewhere) + ++docs: use/docs; @: + +use/docs: + @$(call add_feature) + +use/docs/indexhtml: use/docs use/branding + @$(call add,THE_BRANDING,indexhtml) + +use/docs/manual: use/docs + @$(call xport,DOCS) + @$(call add,THE_PACKAGES,docs-$(DOCS)) + +use/docs/full: use/docs/indexhtml use/docs/manual; @: diff --git a/features.in/docs/lib/30-docs.mk b/features.in/docs/lib/30-docs.mk new file mode 100644 index 00000000..d3d7f971 --- /dev/null +++ b/features.in/docs/lib/30-docs.mk @@ -0,0 +1,8 @@ +# step 4: build the distribution image + +ifneq (,$(DOCS)) +DOT_BASE += docs-$(DOCS) +CHROOT_PACKAGES += docs-$(DOCS) +endif + +CHROOT_PACKAGES_REGEXP += $(call branding,indexhtml) diff --git a/features.in/docs/scripts.d/50-docs-indexhtml b/features.in/docs/scripts.d/50-docs-indexhtml new file mode 100755 index 00000000..22551ff0 --- /dev/null +++ b/features.in/docs/scripts.d/50-docs-indexhtml @@ -0,0 +1,46 @@ +#!/bin/sh -e + +# trailing slash is important here +dest="docs/" + +mkdir -p "$WORKDIR/$dest" +cd $WORKDIR + +nonfatal() { echo "** $*" >&2; exit 0; } + +indexdir="/usr/share/doc/indexhtml" +indexfile="$indexdir/index.html" + +[ -s "$indexfile" ] || nonfatal "$indexfile not found" + +[ -n "$GLOBAL_LOCALE" ] || + echo "** warning: GLOBAL_LOCALE empty, maybe use/l10n" >&2 + +LANG="$GLOBAL_LOCALE" indexhtml-update + +# http://unix.stackexchange.com/questions/94185/convert-soft-to-hardlinks +cp -aH "$indexdir" "$dest" + +mkredir() { + cat >"${1}index.html" <<-EOF + + + + Redirecting... + + +

Redirecting...

+ + + EOF +} + +mkredir "" "$dest" # /index.html -> docs/indexhtml/index.html +mkredir "$dest" "" # docs//index.html -> indexhtml/index.html + +docdir="/usr/share/doc/documentation" +[ -d "$docdir" ] || nonfatal "$docdir not found" + +cp -aH "$docdir" "$dest" + +### no need to replace symlinks with hardlinks by now? (-aH)