conf: Generate and install config sippets for option descriptions

The strongswan.d directory is also created relative to the configured
location of strongswan.conf.
laforge/swu
Tobias Brunner 9 years ago
parent e90b37b9c3
commit 1b98f85821
  1. 3
      conf/.gitignore
  2. 67
      conf/Makefile.am
  3. 3
      conf/default.opt
  4. 2
      conf/options/charon.opt
  5. 30
      conf/plugins/test.opt
  6. 3
      conf/strongswan.conf
  7. 1
      configure.ac

3
conf/.gitignore vendored

@ -0,0 +1,3 @@
default.conf
*/*.conf
*/*.tmp

@ -1,6 +1,63 @@
EXTRA_DIST = strongswan.conf
# make this relative to the location of strongswan.conf
strongswanconfdir = `dirname $(strongswan_conf)`
strongswanddir = $(strongswanconfdir)/strongswan.d
charonconfdir = $(strongswanddir)/charon
install-exec-local :
test -e "$(DESTDIR)${sysconfdir}" || $(INSTALL) -d "$(DESTDIR)$(sysconfdir)"
test -e "$(DESTDIR)$(sysconfdir)/strongswan.conf" || $(INSTALL) -m 640 $(srcdir)/strongswan.conf $(DESTDIR)$(sysconfdir)/strongswan.conf || true
test -e "$(DESTDIR)${sysconfdir}/strongswan.d" || $(INSTALL) -d "$(DESTDIR)$(sysconfdir)/strongswan.d"
options = \
options/charon.opt
plugins = \
plugins/test.opt
alloptions = $(options) $(plugins)
confsnippets = $(alloptions:opt=conf)
# we only install snippets for enabled plugins
plugins_install_tmp = $(charon_plugins:%=plugins/%.tmp)
plugins_install_src = $(charon_plugins:%=plugins/%.conf)
strongswand_DATA = $(options:opt=conf)
charonconf_DATA = $(plugins_install_src)
BUILT_SOURCES = default.conf $(confsnippets)
EXTRA_DIST = format-options.py strongswan.conf default.opt \
default.conf $(alloptions) $(confsnippets)
.opt.conf:
$(AM_V_GEN) \
case "$<" in \
*plugins/*) \
sed \
-e "s:\@PLUGIN_NAME\@:`basename $< .opt`:" \
$(srcdir)/default.opt | cat - $< | \
$(PYTHON) $(srcdir)/format-options.py -f conf -r charon.plugins > $(srcdir)/$@ \
;; \
*) \
$(PYTHON) $(srcdir)/format-options.py -f conf -r charon.plugins $< > $(srcdir)/$@ \
;; \
esac
# we need another implicit rule to generate files from the generic template only
# if the rules above did not catch it. this requires an intermediate step that
# generates a copy of the generic config template.
$(plugins_install_tmp):
@cp $(srcdir)/default.conf $(srcdir)/$@
.tmp.conf:
$(AM_V_GEN) \
sed \
-e "s:\@PLUGIN_NAME\@:`basename $< .tmp`:" \
$(srcdir)/$< > $(srcdir)/$@
maintainer-clean-local:
cd $(srcdir) && \
rm -f $(confsnippets) default.conf plugins/*.conf plugins/*.tmp
install-exec-local:
test -e "$(DESTDIR)${strongswanconfdir}" || $(INSTALL) -d "$(DESTDIR)$(strongswanconfdir)"
test -e "$(DESTDIR)$(strongswanconfdir)/strongswan.conf" || $(INSTALL) -m 640 $(srcdir)/strongswan.conf $(DESTDIR)$(strongswanconfdir)/strongswan.conf || true
install-data-hook:
chmod 0640 $(DESTDIR)$(strongswanddir)/*.conf
chmod 0640 $(DESTDIR)$(charonconfdir)/*.conf

@ -0,0 +1,3 @@
charon.plugins.@PLUGIN_NAME@.load := yes
Whether to load the plugin. Can also be an integer to increase the priority
of this plugin.

@ -0,0 +1,2 @@
charon.threads = 16
Number of threads

@ -0,0 +1,30 @@
charon.plugins.test.opt
This is a normal option without default
charon.plugins.test.noncomment := set this
This will not be commented out
charon.plugins.test.def = default
Option with default
charon.plugins.test.sectionnocomment.opt = val
The section this is in has no description
charon.plugins.test.sub {}
This section has comments
charon.plugins.test.sub.opt = option in sub
Section option
charon.plugins.test.<commented> { # }
Commented example section
charon.plugins.test.<commented>.val = value
This is commented anyway
charon.plugins.test.<commented>.assign := value
This is commented too because of the commented section
charon.plugins.test.sub = value
Sections can also be options with values
Longer description with **bold** and _italic_.

@ -5,8 +5,9 @@
# Configuration changes should be made in the included files
charon {
load_modular = yes
plugins {
include strongswan.d/charon/*.conf
}
}

@ -302,6 +302,7 @@ AC_PROG_EGREP
AC_PROG_AWK
AC_PROG_LEX
AC_PROG_YACC
AM_PATH_PYTHON(,,[:])
AC_PATH_PROG([PERL], [perl], [], [$PATH:/bin:/usr/bin:/usr/local/bin])
AC_PATH_PROG([GPERF], [gperf], [], [$PATH:/bin:/usr/bin:/usr/local/bin])

Loading…
Cancel
Save