forked from altcloud/mkimage-profiles
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.
This commit is contained in:
parent
33f79ccf8a
commit
9d77c2d4b3
11
features.in/docs/README
Normal file
11
features.in/docs/README
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
Эта фича добавляет в образ распакованную документацию дистрибутива,
|
||||||
|
а именно вводную страничку (входит в пакет branding-*-indexhtml)
|
||||||
|
и/или специфичное для данного продукта руководство из пакета docs-*
|
||||||
|
(вариант задаётся отдельно выставлением переменной DOCS).
|
||||||
|
|
||||||
|
Обратите внимание, что для indexhtml создаётся переброска с учётом
|
||||||
|
языка (при наличии index-LL.html), поэтому ожидается задействование
|
||||||
|
фичи l10n с соответствующим указанием языка по умолчанию.
|
||||||
|
|
||||||
|
NB: предполагается применение при формировании ISO-образов,
|
||||||
|
другие случаи наверняка потребуют доработки.
|
18
features.in/docs/config.mk
Normal file
18
features.in/docs/config.mk
Normal file
@ -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; @:
|
8
features.in/docs/lib/30-docs.mk
Normal file
8
features.in/docs/lib/30-docs.mk
Normal file
@ -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)
|
46
features.in/docs/scripts.d/50-docs-indexhtml
Executable file
46
features.in/docs/scripts.d/50-docs-indexhtml
Executable file
@ -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
|
||||||
|
<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)
|
Loading…
Reference in New Issue
Block a user