Commit 9d77c2d4 authored by Michael Shigorin's avatar Michael Shigorin

docs: new feature

This one has been brewin' for quite a while but has been completed finally; some tweaks sure can come in later but it's working. Please note that it's rather needed for "proper" distros with specific branding and docs packages prepared for those; one should use l10n feature most likely too.
parent 33f79ccf
Эта фича добавляет в образ распакованную документацию дистрибутива,
а именно вводную страничку (входит в пакет branding-*-indexhtml)
и/или специфичное для данного продукта руководство из пакета docs-*
(вариант задаётся отдельно выставлением переменной DOCS).
Обратите внимание, что для indexhtml создаётся переброска с учётом
языка (при наличии index-LL.html), поэтому ожидается задействование
фичи l10n с соответствующим указанием языка по умолчанию.
NB: предполагается применение при формировании ISO-образов,
другие случаи наверняка потребуют доработки.
# 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; @:
# step 4: build the distribution image
ifneq (,$(DOCS))
DOT_BASE += docs-$(DOCS)
CHROOT_PACKAGES += docs-$(DOCS)
endif
CHROOT_PACKAGES_REGEXP += $(call branding,indexhtml)
#!/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
<html>
<head>
<meta http-equiv="refresh" content="0;url=${2}indexhtml/index.html">
<title>Redirecting...</title>
</head>
<body>
<h1>Redirecting...</h1>
</body>
</html>
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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment