Merge branch 'master' into 'dma-type'
# Conflicts: # scripts/run-shellcheck.sh
This commit is contained in:
commit
bf90e55137
111 changed files with 4576 additions and 12 deletions
|
@ -1,14 +1,29 @@
|
|||
stages:
|
||||
- test
|
||||
- doc
|
||||
|
||||
image: code.ungleich.ch:5050/ungleich-public/cdist/cdist-ci:latest
|
||||
image: code.ungleich.ch:5050/ungleich-public/cdist-contrib/ci-container:latest
|
||||
|
||||
shellcheck:
|
||||
stage: test
|
||||
script:
|
||||
- ./scripts/run-shellcheck.sh
|
||||
- make lint
|
||||
|
||||
manpages:
|
||||
stage: test
|
||||
script:
|
||||
- ./scripts/run-manpage-checks.sh
|
||||
- make check-manpages
|
||||
|
||||
docs:
|
||||
stage: doc
|
||||
only:
|
||||
- master
|
||||
before_script:
|
||||
- eval $(ssh-agent -s)
|
||||
- echo "$CD_SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
|
||||
- mkdir -p ~/.ssh
|
||||
- echo "$CD_SSH_SERVER_HOSTKEYS" > ~/.ssh/known_hosts
|
||||
- chmod 644 ~/.ssh/known_hosts
|
||||
script:
|
||||
- make html
|
||||
- sftp fnux@staticwebhosting.ungleich.ch:public_html/cdist-contrib <<< "put -r docs/dist/html/*"
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
# cdist-contrib changes
|
||||
|
||||
* 2020-04-28: New type: __find_exec (Ander Punnar)
|
70
Makefile
Normal file
70
Makefile
Normal file
|
@ -0,0 +1,70 @@
|
|||
.PHONY: help
|
||||
help:
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
@echo "man build only man user documentation"
|
||||
@echo "html build only html user documentation"
|
||||
@echo "docs build both man and html user documentation"
|
||||
@echo "check-manpages check for manpage in types"
|
||||
@echo "lint run shellcheck on types"
|
||||
@echo "check run both type manpage checks and linting"
|
||||
@echo "clean clean"
|
||||
|
||||
DOCS_SRC_DIR=./docs/src
|
||||
TYPEDIR=./type
|
||||
|
||||
SPHINXM=make -C $(DOCS_SRC_DIR) man
|
||||
SPHINXH=make -C $(DOCS_SRC_DIR) html
|
||||
SPHINXC=make -C $(DOCS_SRC_DIR) clean
|
||||
|
||||
################################################################################
|
||||
# Manpages
|
||||
#
|
||||
MAN7DSTDIR=$(DOCS_SRC_DIR)/man7
|
||||
|
||||
# Use shell / ls to get complete list - $(TYPEDIR)/*/man.rst does not work
|
||||
# Using ls does not work if no file with given pattern exist, so use wildcard
|
||||
MANTYPESRC=$(wildcard $(TYPEDIR)/*/man.rst)
|
||||
MANTYPEPREFIX=$(subst $(TYPEDIR)/,$(MAN7DSTDIR)/cdist-type,$(MANTYPESRC))
|
||||
MANTYPES=$(subst /man.rst,.rst,$(MANTYPEPREFIX))
|
||||
|
||||
# Link manpage: do not create man.html but correct named file
|
||||
$(MAN7DSTDIR)/cdist-type%.rst: $(TYPEDIR)/%/man.rst
|
||||
mkdir -p $(MAN7DSTDIR)
|
||||
ln -sf "../../../$^" $@
|
||||
|
||||
DOCSINDEX=$(MAN7DSTDIR)/index.rst
|
||||
DOCSINDEXH=$(DOCS_SRC_DIR)/index.rst.sh
|
||||
|
||||
$(DOCSINDEX): $(DOCSINDEXH)
|
||||
$(DOCSINDEXH)
|
||||
|
||||
# Manpages: .cdist Types
|
||||
DOT_CDIST_PATH=${HOME}/.cdist
|
||||
DOTMAN7DSTDIR=$(MAN7DSTDIR)
|
||||
DOTTYPEDIR=$(DOT_CDIST_PATH)/type
|
||||
|
||||
# Link manpage: do not create man.html but correct named file
|
||||
$(DOTMAN7DSTDIR)/cdist-type%.rst: $(DOTTYPEDIR)/%/man.rst
|
||||
ln -sf "$^" $@
|
||||
|
||||
man: $(MANTYPES) $(DOCSINDEX)
|
||||
$(SPHINXM)
|
||||
|
||||
html: $(MANTYPES) $(DOCSINDEX)
|
||||
$(SPHINXH)
|
||||
|
||||
docs: man html
|
||||
|
||||
check-manpages:
|
||||
./scripts/run-manpage-checks.sh
|
||||
|
||||
lint:
|
||||
./scripts/run-shellcheck.sh
|
||||
|
||||
check: check-manpages lint
|
||||
|
||||
clean:
|
||||
$(SPHINXC)
|
||||
rm -f docs/src/index.rst
|
||||
rm -rf docs/src/man7/
|
||||
rm -rf docs/src/__pycache__/
|
18
README.md
18
README.md
|
@ -5,8 +5,9 @@ tool with community-maitained types which are either too specific to fit/be
|
|||
maintained in cdist itself or were not accepted in code cdist but could still
|
||||
be useful.
|
||||
|
||||
This project does not have releases and is continously updated: see
|
||||
`CHANGELOG.md` for details.
|
||||
This project does not have releases and is continously updated: see git history
|
||||
for change log. You will find HTML documentation at
|
||||
[contrib.cdi.st](https://contrib.cdi.st).
|
||||
|
||||
## Using cdist-contrib
|
||||
|
||||
|
@ -32,14 +33,11 @@ And you would run [cdist][cdist] from the same directory as follows:
|
|||
|
||||
## Participating in the [cdist][cdist] community
|
||||
|
||||
Join us on [#cdist:ungleich.ch][cdistmatrix] on matrix or on
|
||||
[#cdist over mattermost][cdistmattermost].
|
||||
|
||||
Join us on [#cdist:ungleich.ch][cdistmatrix] on matrix!
|
||||
|
||||
[cdist]: https://www.cdi.st/
|
||||
[cdistconfig]: https://www.cdi.st/manual/latest/cdist-configuration.html
|
||||
[cdistmatrix]: https://matrix.to/#/#cdist:ungleich.ch
|
||||
[cdistmattermost]: https://chat.ungleich.ch/ungleich/channels/cdist
|
||||
|
||||
## Contributing
|
||||
|
||||
|
@ -53,3 +51,11 @@ Every type in cdist-contrib must:
|
|||
|
||||
* Have a `man.rst` documentation page.
|
||||
* Pass [shellcheck](http://shellcheck.net/) without errors.
|
||||
|
||||
## Other resources
|
||||
|
||||
Some people/organizations are known to keep some cdist types that might be of
|
||||
interest to others:
|
||||
|
||||
* [cdist-evilham](https://git.sr.ht/~evilham/cdist-evilham): Evilham's cdist-types
|
||||
* [cdist-recycledcloud](https://code.recycled.cloud/e-Durable/cdist-recycledcloud): e-Durable SA / Recycled Cloud public types
|
||||
|
|
235
docs/src/Makefile
Normal file
235
docs/src/Makefile
Normal file
|
@ -0,0 +1,235 @@
|
|||
# Makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS ?=
|
||||
SPHINXBUILD ?= sphinx-build
|
||||
PAPER ?=
|
||||
BUILDDIR ?= ../dist
|
||||
# for cache, etc.
|
||||
_BUILDDIR = _build
|
||||
|
||||
# User-friendly check for sphinx-build
|
||||
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
|
||||
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don\'t have Sphinx installed, grab it from http://sphinx-doc.org/)
|
||||
endif
|
||||
|
||||
# Internal variables.
|
||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||
PAPEROPT_letter = -D latex_paper_size=letter
|
||||
ALLSPHINXOPTS = -d $(_BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
# the i18n builder cannot share the environment and doctrees with the others
|
||||
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
@echo " html to make standalone HTML files"
|
||||
@echo " dirhtml to make HTML files named index.html in directories"
|
||||
@echo " singlehtml to make a single large HTML file"
|
||||
@echo " pickle to make pickle files"
|
||||
@echo " json to make JSON files"
|
||||
@echo " htmlhelp to make HTML files and a HTML help project"
|
||||
@echo " qthelp to make HTML files and a qthelp project"
|
||||
@echo " applehelp to make an Apple Help Book"
|
||||
@echo " devhelp to make HTML files and a Devhelp project"
|
||||
@echo " epub to make an epub"
|
||||
@echo " epub3 to make an epub3"
|
||||
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
||||
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
||||
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
|
||||
@echo " text to make text files"
|
||||
@echo " man to make manual pages"
|
||||
@echo " texinfo to make Texinfo files"
|
||||
@echo " info to make Texinfo files and run them through makeinfo"
|
||||
@echo " gettext to make PO message catalogs"
|
||||
@echo " changes to make an overview of all changed/added/deprecated items"
|
||||
@echo " xml to make Docutils-native XML files"
|
||||
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
|
||||
@echo " linkcheck to check all external links for integrity"
|
||||
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
||||
@echo " coverage to run coverage check of the documentation (if enabled)"
|
||||
@echo " dummy to check syntax errors of document sources"
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf $(BUILDDIR)/*
|
||||
rm -rf $(_BUILDDIR)/*
|
||||
|
||||
.PHONY: html
|
||||
html:
|
||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
||||
|
||||
.PHONY: dirhtml
|
||||
dirhtml:
|
||||
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
||||
|
||||
.PHONY: singlehtml
|
||||
singlehtml:
|
||||
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
||||
|
||||
.PHONY: pickle
|
||||
pickle:
|
||||
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
||||
@echo
|
||||
@echo "Build finished; now you can process the pickle files."
|
||||
|
||||
.PHONY: json
|
||||
json:
|
||||
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
||||
@echo
|
||||
@echo "Build finished; now you can process the JSON files."
|
||||
|
||||
.PHONY: htmlhelp
|
||||
htmlhelp:
|
||||
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
||||
".hhp project file in $(BUILDDIR)/htmlhelp."
|
||||
|
||||
.PHONY: qthelp
|
||||
qthelp:
|
||||
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
||||
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
||||
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/cdist-docs.qhcp"
|
||||
@echo "To view the help file:"
|
||||
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/cdist-docs.qhc"
|
||||
|
||||
.PHONY: applehelp
|
||||
applehelp:
|
||||
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
|
||||
@echo
|
||||
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
|
||||
@echo "N.B. You won't be able to view it unless you put it in" \
|
||||
"~/Library/Documentation/Help or install it in your application" \
|
||||
"bundle."
|
||||
|
||||
.PHONY: devhelp
|
||||
devhelp:
|
||||
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
||||
@echo
|
||||
@echo "Build finished."
|
||||
@echo "To view the help file:"
|
||||
@echo "# mkdir -p $$HOME/.local/share/devhelp/cdist-docs"
|
||||
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/cdist-docs"
|
||||
@echo "# devhelp"
|
||||
|
||||
.PHONY: epub
|
||||
epub:
|
||||
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
||||
@echo
|
||||
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
||||
|
||||
.PHONY: epub3
|
||||
epub3:
|
||||
$(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3
|
||||
@echo
|
||||
@echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3."
|
||||
|
||||
.PHONY: latex
|
||||
latex:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo
|
||||
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
||||
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
||||
"(use \`make latexpdf' here to do that automatically)."
|
||||
|
||||
.PHONY: latexpdf
|
||||
latexpdf:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo "Running LaTeX files through pdflatex..."
|
||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||
|
||||
.PHONY: latexpdfja
|
||||
latexpdfja:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo "Running LaTeX files through platex and dvipdfmx..."
|
||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
|
||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||
|
||||
.PHONY: text
|
||||
text:
|
||||
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
||||
@echo
|
||||
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
||||
|
||||
.PHONY: man
|
||||
man:
|
||||
$(SPHINXBUILD) -b cman $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
||||
mkdir -p $(BUILDDIR)/man/man7
|
||||
mv -f $(BUILDDIR)/man/*.7 $(BUILDDIR)/man/man7/
|
||||
@echo
|
||||
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
||||
|
||||
.PHONY: texinfo
|
||||
texinfo:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo
|
||||
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
||||
@echo "Run \`make' in that directory to run these through makeinfo" \
|
||||
"(use \`make info' here to do that automatically)."
|
||||
|
||||
.PHONY: info
|
||||
info:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo "Running Texinfo files through makeinfo..."
|
||||
make -C $(BUILDDIR)/texinfo info
|
||||
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
||||
|
||||
.PHONY: gettext
|
||||
gettext:
|
||||
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
||||
@echo
|
||||
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
||||
|
||||
.PHONY: changes
|
||||
changes:
|
||||
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
||||
@echo
|
||||
@echo "The overview file is in $(BUILDDIR)/changes."
|
||||
|
||||
.PHONY: linkcheck
|
||||
linkcheck:
|
||||
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
||||
@echo
|
||||
@echo "Link check complete; look for any errors in the above output " \
|
||||
"or in $(BUILDDIR)/linkcheck/output.txt."
|
||||
|
||||
.PHONY: doctest
|
||||
doctest:
|
||||
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
||||
@echo "Testing of doctests in the sources finished, look at the " \
|
||||
"results in $(BUILDDIR)/doctest/output.txt."
|
||||
|
||||
.PHONY: coverage
|
||||
coverage:
|
||||
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
|
||||
@echo "Testing of coverage in the sources finished, look at the " \
|
||||
"results in $(BUILDDIR)/coverage/python.txt."
|
||||
|
||||
.PHONY: xml
|
||||
xml:
|
||||
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
|
||||
@echo
|
||||
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
|
||||
|
||||
.PHONY: pseudoxml
|
||||
pseudoxml:
|
||||
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
|
||||
@echo
|
||||
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
|
||||
|
||||
.PHONY: dummy
|
||||
dummy:
|
||||
$(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy
|
||||
@echo
|
||||
@echo "Build finished. Dummy builder generates no files."
|
101
docs/src/conf.py
Normal file
101
docs/src/conf.py
Normal file
|
@ -0,0 +1,101 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import os
|
||||
import sphinx_rtd_theme
|
||||
|
||||
from datetime import date
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
# sys.path.insert(0, os.path.abspath('.'))
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(
|
||||
os.path.dirname(os.path.realpath(__file__)), "..", "..")))
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
# needs_sphinx = '1.0'
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
'docs.src.manpage',
|
||||
'sphinx.ext.extlinks',
|
||||
]
|
||||
|
||||
# The suffix(es) of source filenames.
|
||||
# You can specify multiple suffix as a list of string:
|
||||
source_suffix = ['.rst']
|
||||
|
||||
# The encoding of source files.
|
||||
# source_encoding = 'utf-8-sig'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = 'cdist-contrib'
|
||||
copyright = 'cdist-contrib contributors'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
|
||||
version = str(date.today())
|
||||
release = os.popen('git rev-parse HEAD').read()
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#
|
||||
# This is also used if you do content translation via gettext catalogs.
|
||||
# Usually you set "language" from the command line for these cases.
|
||||
language = None
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
||||
todo_include_todos = False
|
||||
|
||||
# -- Options for HTML output ----------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
html_theme = 'sphinx_rtd_theme'
|
||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'cdistcontribdoc'
|
||||
|
||||
# -- Options for manual page output ---------------------------------------
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
root_mandir = os.path.dirname(os.path.realpath(__file__))
|
||||
mandirs = []
|
||||
for mansubdir in ('man7',):
|
||||
mandirs.append((os.path.join(root_mandir, mansubdir), mansubdir[-1]))
|
||||
man_pages = []
|
||||
for mandir, section in mandirs:
|
||||
for root, dirs, files in os.walk(mandir):
|
||||
for fname in files:
|
||||
froot, fext = os.path.splitext(fname)
|
||||
if fext == '.rst':
|
||||
man_page = (os.path.join('man' + str(section), froot),
|
||||
froot, '', [], section)
|
||||
man_pages.append(man_page)
|
||||
|
||||
# man_pages = [
|
||||
# ('cdist-type', 'cdist-type', 'cdist-type documentation',
|
||||
# [author], 1),
|
||||
# ('man7/cdist-type__file', 'cdist-type__file',
|
||||
# '', [], 1),
|
||||
# ('cdist-type__directory', 'cdist-type__directory',
|
||||
# 'cdist-type__directory documentation', [author], 1),
|
||||
# ]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
# man_show_urls = False
|
40
docs/src/index.rst.sh
Executable file
40
docs/src/index.rst.sh
Executable file
|
@ -0,0 +1,40 @@
|
|||
#!/bin/sh
|
||||
|
||||
__cdist_pwd="$(pwd -P)"
|
||||
__cdist_mydir="${0%/*}";
|
||||
__cdist_abs_mydir="$(cd "$__cdist_mydir" && pwd -P)"
|
||||
__cdist_myname=${0##*/};
|
||||
__cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname"
|
||||
|
||||
filename="${__cdist_myname%.sh}"
|
||||
dest="$__cdist_abs_mydir/$filename"
|
||||
|
||||
if ! command -v pandoc > /dev/null; then
|
||||
echo "Pandoc is required to generate HTML index from README." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$__cdist_abs_mydir"
|
||||
|
||||
exec > "$dest"
|
||||
|
||||
pandoc -f markdown -t rst ../../README.md
|
||||
|
||||
cat << EOF
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
EOF
|
||||
|
||||
# If there is no such file then ls prints error to stderr,
|
||||
# so redirect stderr to /dev/null.
|
||||
for type in $(ls man7/cdist-type__*.rst 2>/dev/null | LC_ALL=C sort); do
|
||||
no_dir="${type#man7/}";
|
||||
no_type="${no_dir#cdist-type}";
|
||||
name="${no_type%.rst}";
|
||||
manref="${no_dir%.rst}"
|
||||
man="${manref}(7)"
|
||||
|
||||
echo " $name" "<man7/${manref}>"
|
||||
done
|
87
docs/src/manpage.py
Normal file
87
docs/src/manpage.py
Normal file
|
@ -0,0 +1,87 @@
|
|||
import sphinx.builders.manpage
|
||||
import sphinx.writers.manpage
|
||||
from docutils.frontend import OptionParser
|
||||
from sphinx.util.console import bold, darkgreen
|
||||
from six import string_types
|
||||
from docutils.io import FileOutput
|
||||
from os import path
|
||||
from sphinx.util.nodes import inline_all_toctrees
|
||||
from sphinx import addnodes
|
||||
from sphinx.util import logging
|
||||
|
||||
"""
|
||||
Extension based on sphinx builtin manpage.
|
||||
It does not write its own .SH NAME based on config,
|
||||
but leaves everything to actual reStructuredText file content.
|
||||
"""
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ManualPageTranslator(sphinx.writers.manpage.ManualPageTranslator):
|
||||
|
||||
def header(self):
|
||||
tmpl = (".TH \"%(title_upper)s\" \"%(manual_section)s\""
|
||||
" \"%(date)s\" \"%(version)s\" \"%(manual_group)s\"\n")
|
||||
return tmpl % self._docinfo
|
||||
|
||||
|
||||
class ManualPageWriter(sphinx.writers.manpage.ManualPageWriter):
|
||||
|
||||
def __init__(self, builder):
|
||||
super().__init__(builder)
|
||||
self.translator_class = (
|
||||
self.builder.get_translator_class() or ManualPageTranslator)
|
||||
|
||||
|
||||
class ManualPageBuilder(sphinx.builders.manpage.ManualPageBuilder):
|
||||
|
||||
name = 'cman'
|
||||
default_translator_class = ManualPageTranslator
|
||||
|
||||
def write(self, *ignored):
|
||||
docwriter = ManualPageWriter(self)
|
||||
docsettings = OptionParser(
|
||||
defaults=self.env.settings,
|
||||
components=(docwriter,),
|
||||
read_config_files=True).get_default_values()
|
||||
|
||||
logger.info(bold('writing... '), nonl=True)
|
||||
|
||||
for info in self.config.man_pages:
|
||||
docname, name, description, authors, section = info
|
||||
if isinstance(authors, string_types):
|
||||
if authors:
|
||||
authors = [authors]
|
||||
else:
|
||||
authors = []
|
||||
|
||||
targetname = '%s.%s' % (name, section)
|
||||
logger.info(darkgreen(targetname) + ' { ', nonl=True)
|
||||
destination = FileOutput(
|
||||
destination_path=path.join(self.outdir, targetname),
|
||||
encoding='utf-8')
|
||||
|
||||
tree = self.env.get_doctree(docname)
|
||||
docnames = set()
|
||||
largetree = inline_all_toctrees(self, docnames, docname, tree,
|
||||
darkgreen, [docname])
|
||||
logger.info('} ', nonl=True)
|
||||
self.env.resolve_references(largetree, docname, self)
|
||||
# remove pending_xref nodes
|
||||
for pendingnode in largetree.traverse(addnodes.pending_xref):
|
||||
pendingnode.replace_self(pendingnode.children)
|
||||
|
||||
largetree.settings = docsettings
|
||||
largetree.settings.title = name
|
||||
largetree.settings.subtitle = description
|
||||
largetree.settings.authors = authors
|
||||
largetree.settings.section = section
|
||||
|
||||
docwriter.write(largetree, destination)
|
||||
logger.info("")
|
||||
|
||||
|
||||
def setup(app):
|
||||
app.add_builder(ManualPageBuilder)
|
7
scripts/ci-container/Dockerfile
Normal file
7
scripts/ci-container/Dockerfile
Normal file
|
@ -0,0 +1,7 @@
|
|||
# This image is used in the cdist-contrib CI for linting and generating the
|
||||
# documentation.
|
||||
FROM fedora:latest
|
||||
MAINTAINER Timothée Floure <fnux@ungleich.ch>
|
||||
|
||||
RUN dnf install -y git findutils make python3-sphinx python3-sphinx_rtd_theme \
|
||||
ShellCheck openssh-clients pandoc
|
36
type/__borg_repo/gencode-remote
Normal file
36
type/__borg_repo/gencode-remote
Normal file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/sh
|
||||
|
||||
passphrase=
|
||||
appendonly=
|
||||
|
||||
case "$(cat "${__object:?}/parameter/encryption")" in
|
||||
none)
|
||||
enc=none
|
||||
;;
|
||||
repokey)
|
||||
enc=repokey
|
||||
if [ -f "${__object:?}/parameter/passphrase" ];
|
||||
then
|
||||
passphrase="$(cat "${__object:?}/parameter/passphrase")"
|
||||
else
|
||||
echo "__borg_repo cannot use repokey encryption with no passphrase. Aborting." >&2;
|
||||
exit 1;
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "$enc is not a known encryption mode for __borg_repo. Aborting." >&2
|
||||
exit 1;
|
||||
esac
|
||||
|
||||
if [ -f "${__object:?}/parameter/append-only" ];
|
||||
then
|
||||
appendonly='--append-only'
|
||||
fi
|
||||
|
||||
cat <<- EOF
|
||||
if ! borg check --repository-only 1>&2 2>/dev/null "/${__object_id:?}";
|
||||
then
|
||||
BORG_NEW_PASSPHRASE=$passphrase borg init -e ${enc:?} $appendonly /${__object_id:?}
|
||||
fi
|
||||
EOF
|
||||
|
43
type/__borg_repo/man.rst
Normal file
43
type/__borg_repo/man.rst
Normal file
|
@ -0,0 +1,43 @@
|
|||
cdist-type__borg_repo(7)
|
||||
========================
|
||||
|
||||
NAME
|
||||
----
|
||||
cdist-type__borg_repo - Configure a borg repository on host
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
Initializes a borg repository at the location specified in the
|
||||
`${__object_id}`. Nothing is done if the repository already exists.
|
||||
|
||||
Currently, only `none` and `repokey` are supported as encryption modes;
|
||||
`repokey` requires the `passphrase` argument to be given. The default is
|
||||
`none`.
|
||||
|
||||
REQUIRED PARAMETERS
|
||||
-------------------
|
||||
encryption
|
||||
The encryption to use.
|
||||
|
||||
OPTIONAL PARAMETERS
|
||||
-------------------
|
||||
passphrase
|
||||
The passphrase to encrypt the keyfile with.
|
||||
|
||||
BOOLEAN PARAMETERS
|
||||
------------------
|
||||
append-only
|
||||
If the repository is append-only
|
||||
|
||||
AUTHORS
|
||||
-------
|
||||
Joachim Desroches <joachim.desroches@epfl.ch>
|
||||
|
||||
COPYING
|
||||
-------
|
||||
Copyright \(C) 2020 Joachim Desroches. You can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
14
type/__borg_repo/manifest
Normal file
14
type/__borg_repo/manifest
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
os="$(cat "${__global:?}"/explorer/os)"
|
||||
|
||||
case "$os" in
|
||||
"alpine")
|
||||
borg_package=borgbackup
|
||||
;;
|
||||
*)
|
||||
echo "__borg_repo is not yet implemented for os $os. Aborting." >&2;
|
||||
exit 1;
|
||||
esac
|
||||
|
||||
__package "$borg_package"
|
1
type/__borg_repo/parameter/boolean
Normal file
1
type/__borg_repo/parameter/boolean
Normal file
|
@ -0,0 +1 @@
|
|||
append-only
|
1
type/__borg_repo/parameter/default/encryption
Normal file
1
type/__borg_repo/parameter/default/encryption
Normal file
|
@ -0,0 +1 @@
|
|||
none
|
1
type/__borg_repo/parameter/optional
Normal file
1
type/__borg_repo/parameter/optional
Normal file
|
@ -0,0 +1 @@
|
|||
passphrase
|
1
type/__borg_repo/parameter/required
Normal file
1
type/__borg_repo/parameter/required
Normal file
|
@ -0,0 +1 @@
|
|||
encryption
|
90
type/__matrix_element/files/config.json.sh
Executable file
90
type/__matrix_element/files/config.json.sh
Executable file
|
@ -0,0 +1,90 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Upstream configuration guide/documentation:
|
||||
# https://github.com/vector-im/riot-web/blob/develop/docs/config.md
|
||||
|
||||
generate_embedded_pages () {
|
||||
if [ "$EMBED_HOMEPAGE" != "" ]; then
|
||||
cat << EOF
|
||||
"embeddedPages": {
|
||||
"homeUrl": "home.html"
|
||||
},
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
generate_jitsi_config () {
|
||||
if [ "$JITSI_DOMAIN" != "" ]; then
|
||||
cat << EOF
|
||||
"jitsi": {
|
||||
"preferredDomain": "$JITSI_DOMAIN"
|
||||
},
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
generate_branding () {
|
||||
echo '"branding": {'
|
||||
|
||||
if [ "$BRANDING_AUTH_HEADER_LOGO_URL" != "" ]; then
|
||||
cat << EOF
|
||||
"authHeaderLogoUrl": "$BRANDING_AUTH_HEADER_LOGO_URL",
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ "$BRANDING_AUTH_FOOTER_LINKS" != "" ]; then
|
||||
cat << EOF
|
||||
"authFooterLinks": "$BRANDING_AUTH_FOOTER_LINKS",
|
||||
EOF
|
||||
fi
|
||||
|
||||
cat << EOF
|
||||
"welcomeBackgroundUrl": "themes/element/img/backgrounds/lake.jpg"
|
||||
EOF
|
||||
echo '},'
|
||||
}
|
||||
|
||||
cat << EOF
|
||||
{
|
||||
"default_server_config": {
|
||||
"m.homeserver": {
|
||||
"base_url": "$DEFAULT_SERVER_URL",
|
||||
"server_name": "$DEFAULT_SERVER_NAME"
|
||||
},
|
||||
"m.identity_server": {
|
||||
"base_url": "https://vector.im"
|
||||
}
|
||||
},
|
||||
"brand": "$BRAND",
|
||||
$(generate_branding)
|
||||
"defaultCountryCode": "$DEFAULT_COUNTRY_CODE",
|
||||
"integrations_ui_url": "https://scalar.vector.im/",
|
||||
"integrations_rest_url": "https://scalar.vector.im/api",
|
||||
"integrations_widgets_urls": [
|
||||
"https://scalar.vector.im/_matrix/integrations/v1",
|
||||
"https://scalar.vector.im/api",
|
||||
"https://scalar-staging.vector.im/_matrix/integrations/v1",
|
||||
"https://scalar-staging.vector.im/api",
|
||||
"https://scalar-staging.riot.im/scalar/api"
|
||||
],
|
||||
"bug_report_endpoint_url": "https://riot.im/bugreports/submit",
|
||||
"roomDirectory": {
|
||||
"servers": [
|
||||
$ROOM_DIRECTORY_SERVERS
|
||||
]
|
||||
},
|
||||
"disable_custom_urls": "$DISABLE_CUSTOM_URLS",
|
||||
$(generate_embedded_pages)
|
||||
$(generate_jitsi_config)
|
||||
"terms_and_conditions_links": [
|
||||
{
|
||||
"url": "$PRIVACY_POLICY_URL",
|
||||
"text": "Privacy Policy"
|
||||
},
|
||||
{
|
||||
"url": "$COOKIE_POLICY_URL",
|
||||
"text": "Cookie Policy"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF
|
69
type/__matrix_element/gencode-remote
Executable file
69
type/__matrix_element/gencode-remote
Executable file
|
@ -0,0 +1,69 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# 2019 Timothée Floure (timothee.floure@ungleich.ch)
|
||||
#
|
||||
# This file is part of cdist.
|
||||
#
|
||||
# cdist is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# cdist is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
VERSION=$(cat "$__object/parameter/version")
|
||||
INSTALL_DIR=$(cat "$__object/parameter/install_dir")
|
||||
OWNER=$(cat "$__object/parameter/owner")
|
||||
|
||||
src="riot-v$VERSION"
|
||||
archive="$src.tar.gz"
|
||||
url="https://github.com/vector-im/riot-web/releases/download/v$VERSION/$archive"
|
||||
|
||||
# tar and curl are installed by the __matrix-riot manifest. mktemp is usually
|
||||
# provided by coreutils and assumed installed.
|
||||
cat << EOF
|
||||
set -e
|
||||
|
||||
# Ensure that coreutils is installed.
|
||||
if [ ! -x \$(which mktemp) ]; then
|
||||
echo "mktemp is not available on the remote host." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create temporary working directory.
|
||||
tmpdir=\$(mktemp -d)
|
||||
custom_files_dir="\$tmpdir/custom_files"
|
||||
cd \$tmpdir
|
||||
|
||||
# Download and extract sources.
|
||||
curl -L '$url' > $archive
|
||||
tar xf $archive
|
||||
|
||||
# Backup files deployed by __matrix_element.
|
||||
mkdir -p \$custom_files_dir
|
||||
for file in $INSTALL_DIR/cdist/*; do
|
||||
cp "\$file" "\$custom_files_dir"
|
||||
done
|
||||
|
||||
# Deploy sources and restore configuration.
|
||||
rm -r '$INSTALL_DIR'
|
||||
mv '$src' '$INSTALL_DIR'
|
||||
|
||||
for file in \$custom_files_dir/*; do
|
||||
cp "\$file" '$INSTALL_DIR'
|
||||
done
|
||||
|
||||
# Chown deployed files to requested owner.
|
||||
chown -R '$OWNER' '$INSTALL_DIR'
|
||||
|
||||
# Remove temporary working directory.
|
||||
cd /
|
||||
rm -r \$tmpdir
|
||||
EOF
|
87
type/__matrix_element/man.rst
Normal file
87
type/__matrix_element/man.rst
Normal file
|
@ -0,0 +1,87 @@
|
|||
cdist-type__matrix_element(7)
|
||||
=============================
|
||||
|
||||
NAME
|
||||
----
|
||||
cdist-type__matrix_element - Install and configure Element, a web Matrix client.
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
This type install and configure the Element web client.
|
||||
|
||||
|
||||
REQUIRED PARAMETERS
|
||||
-------------------
|
||||
install_dir
|
||||
Root directory of Element's static files.
|
||||
|
||||
version
|
||||
Release of Element to install.
|
||||
|
||||
OPTIONAL PARAMETERS
|
||||
-------------------
|
||||
default_server_name
|
||||
Name of matrix homeserver to connect to, defaults to 'matrix.org'.
|
||||
|
||||
default_server_url
|
||||
URL of matrix homeserver to connect to, defaults to 'https://matrix-client.matrix.org'.
|
||||
|
||||
owner
|
||||
Owner of the deployed files, passed to `chown`. Defaults to 'root'.
|
||||
|
||||
brand
|
||||
Web UI branding, defaults to 'Element'.
|
||||
|
||||
default_country_code
|
||||
ISO 3166 alpha2 country code to use when showing country selectors, such as
|
||||
phone number inputs. Defaults to GB.
|
||||
|
||||
privacy_policy_url
|
||||
Defaults to 'https://element.io/privacy'.
|
||||
|
||||
cookie_policy_url
|
||||
Defaults to 'https://matrix.org/docs/guides/element_im_cookie_policy'.
|
||||
|
||||
jitsi_domain
|
||||
Domain name of preferred Jitsi instance (default is jitsi.element.im). This is
|
||||
used whenever a user clicks on the voice/video call buttons.
|
||||
|
||||
homepage
|
||||
Path to custom homepage, displayed once logged in.
|
||||
|
||||
welcomepage
|
||||
Path to custom welcome (= login) page.
|
||||
|
||||
custom_asset
|
||||
Serve a file a the top-level directory (e.g. /my-custom-logo.svg). Can be specified multiple times.
|
||||
|
||||
BOOLEAN PARAMETERS
|
||||
-------------------
|
||||
disable_custom_urls
|
||||
Disallow the user to change the default homeserver when signing up or logging in.
|
||||
|
||||
EXAMPLES
|
||||
--------
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
__matrix_element my-element --install_dir /var/www/element-web --version 1.5.6
|
||||
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
- `cdist-type__matrix_synapse(7) <cdist-type__matrix_synapse.html>`_
|
||||
|
||||
|
||||
AUTHORS
|
||||
-------
|
||||
Timothée Floure <timothee.floure@ungleich.ch>
|
||||
|
||||
|
||||
COPYING
|
||||
-------
|
||||
Copyright \(C) 2019 Timothée Floure. You can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
106
type/__matrix_element/manifest
Executable file
106
type/__matrix_element/manifest
Executable file
|
@ -0,0 +1,106 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# 2019 Timothée Floure (timothee.floure@ungleich.ch)
|
||||
#
|
||||
# This file is part of cdist.
|
||||
#
|
||||
# cdist is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# cdist is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Ignore "Declare and assign separately to avoid masking return values. [SC2155]"
|
||||
# => not relevant for the type arguments.
|
||||
# shellcheck disable=SC2155
|
||||
|
||||
INSTALL_DIR=$(cat "$__object/parameter/install_dir")
|
||||
|
||||
export DEFAULT_SERVER_NAME=$(cat "$__object/parameter/default_server_name")
|
||||
export DEFAULT_SERVER_URL=$(cat "$__object/parameter/default_server_url")
|
||||
export BRAND=$(cat "$__object/parameter/brand")
|
||||
export DEFAULT_COUNTRY_CODE=$(cat "$__object/parameter/default_country_code")
|
||||
export ROOM_DIRECTORY_SERVERS=$(cat "$__object/parameter/room_directory_servers")
|
||||
export PRIVACY_POLICY_URL=$(cat "$__object/parameter/privacy_policy_url")
|
||||
export COOKIE_POLICY_URL=$(cat "$__object/parameter/cookie_policy_url")
|
||||
|
||||
if [ -f "$__object/parameter/jitsi_domain" ]; then
|
||||
export JITSI_DOMAIN=$(cat "$__object/parameter/jitsi_domain")
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/branding_auth_header_logo_url" ]; then
|
||||
export BRANDING_AUTH_HEADER_LOGO_URL=$(cat "$__object/parameter/branding_auth_header_logo_url")
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/branding_auth_footer_links" ]; then
|
||||
export BRANDING_AUTH_FOOTER_LINKS=$(cat "$__object/parameter/branding_auth_footer_links")
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/homepage" ]; then
|
||||
export EMBED_HOMEPAGE=1
|
||||
homepage=$(cat "$__object/parameter/homepage")
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/welcomepage" ]; then
|
||||
export EMBED_WELCOMEPAGE=1
|
||||
welcomepage=$(cat "$__object/parameter/welcomepage")
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/custom_asset" ]; then
|
||||
"$__object/parameter/custom_asset" | while IFS= read -r file; do
|
||||
require="__directory/$INSTALL_DIR/cdist" __file "$INSTALL_DIR/cdist/$(basename "$file")" \
|
||||
--source "$file" \
|
||||
--mode 0664 \
|
||||
--state present
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/disable_custom_urls" ]; then
|
||||
export DISABLE_CUSTOM_URLS='true'
|
||||
else
|
||||
export DISABLE_CUSTOM_URLS='false'
|
||||
fi
|
||||
|
||||
# Owner of the uploaded files.
|
||||
owner=$(cat "$__object/parameter/owner")
|
||||
|
||||
# Ensure that curl and tar are installed, as they will be required by the
|
||||
# gencode-remote script.
|
||||
__package curl --state present
|
||||
__package tar --state present
|
||||
|
||||
# Generate and deploy configuration file.
|
||||
mkdir -p "$__object/files"
|
||||
"$__type/files/config.json.sh" > "$__object/files/config.json"
|
||||
|
||||
# Install the config.json configuration file. The application's sources are
|
||||
# downloaded and deployed by gencode-remote.
|
||||
__directory "$INSTALL_DIR/cdist" \
|
||||
--owner "$owner" --mode 0755 --parents \
|
||||
--state present
|
||||
|
||||
require="__directory/$INSTALL_DIR/cdist" __file "$INSTALL_DIR/cdist/config.json" \
|
||||
--source "$__object/files/config.json" \
|
||||
--mode 0664 \
|
||||
--state present
|
||||
|
||||
if [ $EMBED_HOMEPAGE ]; then
|
||||
require="__directory/$INSTALL_DIR/cdist" __file "$INSTALL_DIR/cdist/home.html" \
|
||||
--source "$homepage" \
|
||||
--mode 0664 \
|
||||
--state present
|
||||
fi
|
||||
|
||||
if [ $EMBED_WELCOMEPAGE ]; then
|
||||
require="__directory/$INSTALL_DIR/cdist" __file "$INSTALL_DIR/cdist/welcome.html" \
|
||||
--source "$welcomepage" \
|
||||
--mode 0664 \
|
||||
--state present
|
||||
fi
|
1
type/__matrix_element/parameter/boolean
Normal file
1
type/__matrix_element/parameter/boolean
Normal file
|
@ -0,0 +1 @@
|
|||
disable_custom_urls
|
1
type/__matrix_element/parameter/default/brand
Normal file
1
type/__matrix_element/parameter/default/brand
Normal file
|
@ -0,0 +1 @@
|
|||
Element
|
|
@ -0,0 +1 @@
|
|||
https://matrix.org/docs/guides/riot_im_cookie_policy
|
|
@ -0,0 +1 @@
|
|||
GB
|
|
@ -0,0 +1 @@
|
|||
matrix.org
|
|
@ -0,0 +1 @@
|
|||
https://matrix-client.matrix.org
|
1
type/__matrix_element/parameter/default/owner
Normal file
1
type/__matrix_element/parameter/default/owner
Normal file
|
@ -0,0 +1 @@
|
|||
root
|
|
@ -0,0 +1 @@
|
|||
https://element.io/privacy
|
|
@ -0,0 +1 @@
|
|||
"matrix.org"
|
13
type/__matrix_element/parameter/optional
Normal file
13
type/__matrix_element/parameter/optional
Normal file
|
@ -0,0 +1,13 @@
|
|||
default_server_url
|
||||
default_server_name
|
||||
brand
|
||||
default_country_code
|
||||
privacy_policy_url
|
||||
cookie_policy_url
|
||||
room_directory_servers
|
||||
owner
|
||||
homepage
|
||||
welcomepage
|
||||
jitsi_domain
|
||||
branding_auth_header_logo_url
|
||||
branding_auth_footer_links
|
1
type/__matrix_element/parameter/optional_multiple
Normal file
1
type/__matrix_element/parameter/optional_multiple
Normal file
|
@ -0,0 +1 @@
|
|||
custom_asset
|
2
type/__matrix_element/parameter/required
Normal file
2
type/__matrix_element/parameter/required
Normal file
|
@ -0,0 +1,2 @@
|
|||
version
|
||||
install_dir
|
18
type/__matterbridge/files/matterbridge.service.sh
Executable file
18
type/__matterbridge/files/matterbridge.service.sh
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
|
||||
cat <<EOF
|
||||
[Unit]
|
||||
Description=IM bridging daemon
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
User=$USER
|
||||
Group=$GROUP
|
||||
Type=simple
|
||||
Restart=on-failure
|
||||
ExecStart=$BINARY_PATH -conf=/etc/matterbridge/matterbridge.toml
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
56
type/__matterbridge/man.rst
Normal file
56
type/__matterbridge/man.rst
Normal file
|
@ -0,0 +1,56 @@
|
|||
cdist-type__matterbridge(7)
|
||||
===========================
|
||||
|
||||
NAME
|
||||
----
|
||||
cdist-type__matterbridge - Install matterbridge from upstream binary
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
This singleton type install a matterbridge service from binary.
|
||||
|
||||
REQUIRED PARAMETERS
|
||||
-------------------
|
||||
version
|
||||
Release (git tag) to fetch from the project github's page.
|
||||
|
||||
config
|
||||
Matterbridge configuration (TOML).
|
||||
|
||||
OPTIONAL PARAMETERS
|
||||
-------------------
|
||||
None.
|
||||
|
||||
|
||||
BOOLEAN PARAMETERS
|
||||
------------------
|
||||
None.
|
||||
|
||||
|
||||
EXAMPLES
|
||||
--------
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
__matterbridge --version 1.16.3 --config - <<- EOF
|
||||
[...]
|
||||
EOF
|
||||
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
- `Matterbridge github repository <https://github.com/42wim/matterbridge>`_
|
||||
|
||||
|
||||
AUTHORS
|
||||
-------
|
||||
Timothée Floure <timothee.floure@ungleich.ch>
|
||||
|
||||
|
||||
COPYING
|
||||
-------
|
||||
Copyright \(C) 2020 Timothée Floure. You can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
98
type/__matterbridge/manifest
Executable file
98
type/__matterbridge/manifest
Executable file
|
@ -0,0 +1,98 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# 2020 Timothée Floure (timothee.floure@ungleich.ch)
|
||||
#
|
||||
# This file is part of cdist.
|
||||
#
|
||||
# cdist is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# cdist is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
os=$(cat "$__global/explorer/os")
|
||||
case "$os" in
|
||||
debian)
|
||||
# This type assume systemd for service installation.
|
||||
;;
|
||||
*)
|
||||
printf "Your operating system (%s) is currently not supported by this type (%s)\n" "$os" "${__type##*/}" >&2
|
||||
printf "Please contribute an implementation for it if you can.\n" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Required parameters.
|
||||
VERSION=$(cat "$__object/parameter/version")
|
||||
if [ -f "$__object/parameter/config" ]; then
|
||||
CONFIG="$(cat "$__object/parameter/config")"
|
||||
if [ "$CONFIG" = "-" ]; then
|
||||
CONFIG=$(cat "$__object/stdin")
|
||||
fi
|
||||
fi
|
||||
|
||||
# Hardcoded values used in templates.
|
||||
export BINARY_PATH=/usr/local/bin/matterbridge
|
||||
export CONFIG_PATH=/etc/matterbridge/matterbridge.toml
|
||||
export USER=matterbridge
|
||||
export GROUP=$USER
|
||||
|
||||
# Internal variables.
|
||||
artefact="matterbridge-$VERSION-linux-64bit"
|
||||
checksum_file="checksums.txt"
|
||||
release_download_url=https://github.com/42wim/matterbridge/releases/download
|
||||
binary_url="$release_download_url/v$VERSION/$artefact"
|
||||
checksum_file_url="$release_download_url/v$VERSION/$checksum_file"
|
||||
config_dir=$(dirname $CONFIG_PATH)
|
||||
systemd_unit_path='/etc/systemd/system/matterbridge.service'
|
||||
|
||||
# Check if curl is available.
|
||||
if ! command -v curl; then
|
||||
echo "curl is required for this type, but could not be found. Exiting." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Initialize working directory.
|
||||
mkdir -p "$__object/files"
|
||||
|
||||
# Download and check matterbridge binary.
|
||||
curl -L "$binary_url" -o "$__object/files/$artefact"
|
||||
curl -Ls "$checksum_file_url" | grep "$artefact" > "$__object/files/$checksum_file"
|
||||
if ! (cd "$__object/files"; sha256sum --check $checksum_file); then
|
||||
echo "Matterbridge binary checksum failed." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create service user.
|
||||
__user $USER --home "/var/lib/$USER"
|
||||
|
||||
# Deploy matterbridge binary.
|
||||
require="__user/$USER" __file "$BINARY_PATH" \
|
||||
--source "$__object/files/$artefact" \
|
||||
--owner "$USER" --mode 755
|
||||
|
||||
# Generate and deploy configuration file.
|
||||
"$__type/files/matterbridge.service.sh" > "$__object/files/matterbridge.service"
|
||||
|
||||
require="__user/$USER" __directory "$config_dir" \
|
||||
--owner "$USER" --mode 0755 --parents \
|
||||
|
||||
require="__directory/$config_dir" __file "$CONFIG_PATH" \
|
||||
--owner "$USER" \
|
||||
--mode 0640 \
|
||||
--source "$CONFIG"
|
||||
|
||||
__file "$systemd_unit_path" \
|
||||
--source "$__object/files/matterbridge.service"
|
||||
|
||||
# Deal with init system.
|
||||
require="__file/$systemd_unit_path" __start_on_boot matterbridge
|
||||
require="__file/$BINARY_PATH __file/$CONFIG_PATH __file/$systemd_unit_path" __service matterbridge --action restart
|
2
type/__matterbridge/parameter/required
Normal file
2
type/__matterbridge/parameter/required
Normal file
|
@ -0,0 +1,2 @@
|
|||
version
|
||||
config
|
0
type/__matterbridge/singleton
Normal file
0
type/__matterbridge/singleton
Normal file
8
type/__netbox/explorer/secretkey
Executable file
8
type/__netbox/explorer/secretkey
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
# Explorer will output the key if he exists.
|
||||
|
||||
secretkey="/opt/netbox/cdist/secretkey"
|
||||
if [ -f "$secretkey" ]; then
|
||||
cat "$secretkey"
|
||||
fi
|
5
type/__netbox/explorer/version
Executable file
5
type/__netbox/explorer/version
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
# output version if exist
|
||||
version_path="/opt/netbox/cdist/version"
|
||||
if [ -f "$version_path" ]; then cat "$version_path"; fi
|
319
type/__netbox/files/configuration.py.sh
Executable file
319
type/__netbox/files/configuration.py.sh
Executable file
|
@ -0,0 +1,319 @@
|
|||
#!/bin/sh
|
||||
|
||||
cat << EOF
|
||||
#########################
|
||||
# #
|
||||
# Required settings #
|
||||
# #
|
||||
#########################
|
||||
|
||||
# This is a list of valid fully-qualified domain names (FQDNs) for the NetBox server. NetBox will not permit write
|
||||
# access to the server via any other hostnames. The first FQDN in the list will be treated as the preferred name.
|
||||
#
|
||||
# Example: ALLOWED_HOSTS = ['netbox.example.com', 'netbox.internal.local']
|
||||
ALLOWED_HOSTS = [$ALLOWED_HOSTS ]
|
||||
|
||||
# PostgreSQL database configuration. See the Django documentation for a complete list of available parameters:
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#databases
|
||||
DATABASE = {
|
||||
'NAME': '$DATABASE_NAME', # Database name
|
||||
'USER': '$DATABASE_USER', # PostgreSQL username
|
||||
'PASSWORD': '$DATABASE_PASSWORD', # PostgreSQL password
|
||||
'HOST': '$DATABASE_HOST', # Database server
|
||||
'PORT': '$DATABASE_PORT', # Database port (leave blank for default)
|
||||
'CONN_MAX_AGE': 300, # Max database connection age
|
||||
}
|
||||
|
||||
# Redis database settings. Redis is used for caching and for queuing background tasks such as webhook events. A separate
|
||||
# configuration exists for each. Full connection details are required in both sections, and it is strongly recommended
|
||||
# to use two separate database IDs.
|
||||
REDIS = {
|
||||
'tasks': {
|
||||
'HOST': '$REDIS_HOST',
|
||||
'PORT': $REDIS_PORT,
|
||||
# Comment out \`HOST\` and \`PORT\` lines and uncomment the following if using Redis Sentinel
|
||||
# 'SENTINELS': [('mysentinel.redis.example.com', 6379)],
|
||||
# 'SENTINEL_SERVICE': 'netbox',
|
||||
'PASSWORD': '$REDIS_PASSWORD',
|
||||
'DATABASE': $((REDIS_DBID_OFFSET + 0)),
|
||||
'SSL': $REDIS_SSL,
|
||||
},
|
||||
'caching': {
|
||||
'HOST': '$REDIS_HOST',
|
||||
'PORT': $REDIS_PORT,
|
||||
# Comment out \`HOST\` and \`PORT\` lines and uncomment the following if using Redis Sentinel
|
||||
# 'SENTINELS': [('mysentinel.redis.example.com', 6379)],
|
||||
# 'SENTINEL_SERVICE': 'netbox',
|
||||
'PASSWORD': '$REDIS_PASSWORD',
|
||||
'DATABASE': $((REDIS_DBID_OFFSET + 1)),
|
||||
'SSL': $REDIS_SSL,
|
||||
}
|
||||
}
|
||||
RQ_DEFAULT_TIMEOUT = 300
|
||||
|
||||
# This key is used for secure generation of random numbers and strings. It must never be exposed outside of this file.
|
||||
# For optimal security, SECRET_KEY should be at least 50 characters in length and contain a mix of letters, numbers, and
|
||||
# symbols. NetBox will not run without this defined. For more information, see
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-SECRET_KEY
|
||||
SECRET_KEY = '$SECRET_KEY'
|
||||
|
||||
|
||||
#########################
|
||||
# #
|
||||
# Optional settings #
|
||||
# #
|
||||
#########################
|
||||
|
||||
# Specify one or more name and email address tuples representing NetBox administrators. These people will be notified of
|
||||
# application errors (assuming correct email settings are provided).
|
||||
ADMINS = [
|
||||
# ['John Doe', 'jdoe@example.com'],
|
||||
]
|
||||
|
||||
# URL schemes that are allowed within links in NetBox
|
||||
ALLOWED_URL_SCHEMES = (
|
||||
'file', 'ftp', 'ftps', 'http', 'https', 'irc', 'mailto', 'sftp', 'ssh', 'tel', 'telnet', 'tftp', 'vnc', 'xmpp',
|
||||
)
|
||||
|
||||
# Optionally display a persistent banner at the top and/or bottom of every page. HTML is allowed. To display the same
|
||||
# content in both banners, define BANNER_TOP and set BANNER_BOTTOM = BANNER_TOP.
|
||||
BANNER_TOP = ''
|
||||
BANNER_BOTTOM = ''
|
||||
|
||||
# Text to include on the login page above the login form. HTML is allowed.
|
||||
BANNER_LOGIN = ''
|
||||
|
||||
# Base URL path if accessing NetBox within a directory. For example, if installed at http://example.com/netbox/, set:
|
||||
# BASE_PATH = 'netbox/'
|
||||
BASE_PATH = '$BASEPATH'
|
||||
|
||||
# Cache timeout in seconds. Set to 0 to dissable caching. Defaults to 900 (15 minutes)
|
||||
CACHE_TIMEOUT = 900
|
||||
|
||||
# Maximum number of days to retain logged changes. Set to 0 to retain changes indefinitely. (Default: 90)
|
||||
CHANGELOG_RETENTION = 90
|
||||
|
||||
# API Cross-Origin Resource Sharing (CORS) settings. If CORS_ORIGIN_ALLOW_ALL is set to True, all origins will be
|
||||
# allowed. Otherwise, define a list of allowed origins using either CORS_ORIGIN_WHITELIST or
|
||||
# CORS_ORIGIN_REGEX_WHITELIST. For more information, see https://github.com/ottoyiu/django-cors-headers
|
||||
CORS_ORIGIN_ALLOW_ALL = False
|
||||
CORS_ORIGIN_WHITELIST = [
|
||||
# 'https://hostname.example.com',
|
||||
]
|
||||
CORS_ORIGIN_REGEX_WHITELIST = [
|
||||
# r'^(https?://)?(\w+\.)?example\.com$',
|
||||
]
|
||||
|
||||
# Set to True to enable server debugging. WARNING: Debugging introduces a substantial performance penalty and may reveal
|
||||
# sensitive information about your installation. Only enable debugging while performing testing. Never enable debugging
|
||||
# on a production system.
|
||||
DEBUG = False
|
||||
|
||||
# Email settings
|
||||
EMAIL = {
|
||||
'SERVER': '$SMTP_HOST',
|
||||
'PORT': $SMTP_PORT,
|
||||
'USERNAME': '$SMTP_USER',
|
||||
'PASSWORD': '$SMTP_PASSWORD',
|
||||
'USE_SSL': $SMTP_USE_SSL,
|
||||
'USE_TLS': $SMTP_USE_TLS,
|
||||
'TIMEOUT': 10, # seconds
|
||||
'FROM_EMAIL': '$SMTP_FROM_EMAIL',
|
||||
}
|
||||
|
||||
# Enforcement of unique IP space can be toggled on a per-VRF basis. To enforce unique IP space within the global table
|
||||
# (all prefixes and IP addresses not assigned to a VRF), set ENFORCE_GLOBAL_UNIQUE to True.
|
||||
ENFORCE_GLOBAL_UNIQUE = False
|
||||
|
||||
# Exempt certain models from the enforcement of view permissions. Models listed here will be viewable by all users and
|
||||
# by anonymous users. List models in the form \`<app>.<model>\`. Add '*' to this list to exempt all models.
|
||||
EXEMPT_VIEW_PERMISSIONS = [
|
||||
# 'dcim.site',
|
||||
# 'dcim.region',
|
||||
# 'ipam.prefix',
|
||||
]
|
||||
|
||||
EOF
|
||||
|
||||
if [ "$HTTP_PROXY" != "" ] || [ "$HTTPS_PROXY" != "" ]; then
|
||||
cat << EOF
|
||||
# HTTP proxies NetBox should use when sending outbound HTTP requests (e.g. for webhooks).
|
||||
HTTP_PROXIES = {
|
||||
EOF
|
||||
if [ "$HTTP_PROXY" != "" ]; then
|
||||
cat << EOF
|
||||
'http': '$HTTP_PROXY',
|
||||
EOF
|
||||
fi
|
||||
if [ "$HTTPS_PROXY" != "" ]; then
|
||||
cat << EOF
|
||||
'https': '$HTTPS_PROXY',
|
||||
EOF
|
||||
fi
|
||||
cat << EOF
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
|
||||
cat << EOF
|
||||
# IP addresses recognized as internal to the system. The debugging toolbar will be available only to clients accessing
|
||||
# NetBox from an internal IP.
|
||||
INTERNAL_IPS = ('127.0.0.1', '::1')
|
||||
|
||||
# Enable custom logging. Please see the Django documentation for detailed guidance on configuring custom logs:
|
||||
# https://docs.djangoproject.com/en/stable/topics/logging/
|
||||
LOGGING = {}
|
||||
|
||||
# Setting this to True will permit only authenticated users to access any part of NetBox. By default, anonymous users
|
||||
# are permitted to access most data in NetBox (excluding secrets) but not make any changes.
|
||||
LOGIN_REQUIRED = $LOGIN_REQUIRED
|
||||
|
||||
# The length of time (in seconds) for which a user will remain logged into the web UI before being prompted to
|
||||
# re-authenticate. (Default: 1209600 [14 days])
|
||||
LOGIN_TIMEOUT = None
|
||||
|
||||
# Setting this to True will display a "maintenance mode" banner at the top of every page.
|
||||
MAINTENANCE_MODE = False
|
||||
|
||||
# An API consumer can request an arbitrary number of objects =by appending the "limit" parameter to the URL (e.g.
|
||||
# "?limit=1000"). This setting defines the maximum limit. Setting it to 0 or None will allow an API consumer to request
|
||||
# all objects by specifying "?limit=0".
|
||||
MAX_PAGE_SIZE = 1000
|
||||
|
||||
EOF
|
||||
|
||||
if [ "$MEDIA_ROOT" != "" ]; then
|
||||
cat << EOF
|
||||
# The file path where uploaded media such as image attachments are stored. A trailing slash is not needed. Note that
|
||||
# the default value of this setting is derived from the installed location.
|
||||