mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-05 21:37:15 +02:00
main/augeas: Strongswan lens
This commit is contained in:
parent
2ac5e08d0a
commit
38d3834831
146
main/augeas/0001-new-lens-Strongswan.patch
Normal file
146
main/augeas/0001-new-lens-Strongswan.patch
Normal file
@ -0,0 +1,146 @@
|
||||
From f098555c34789313dfc0c8b587883c3d33b4fe03 Mon Sep 17 00:00:00 2001
|
||||
From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
|
||||
Date: Sun, 4 Feb 2018 23:35:46 +0200
|
||||
Subject: [PATCH] new lens: Strongswan
|
||||
|
||||
---
|
||||
lenses/strongswan.aug | 41 +++++++++++++++++++++++++
|
||||
lenses/tests/test_strongswan.aug | 65 ++++++++++++++++++++++++++++++++++++++++
|
||||
tests/Makefile.am | 1 +
|
||||
3 files changed, 107 insertions(+)
|
||||
create mode 100644 lenses/strongswan.aug
|
||||
create mode 100644 lenses/tests/test_strongswan.aug
|
||||
|
||||
diff --git a/lenses/strongswan.aug b/lenses/strongswan.aug
|
||||
new file mode 100644
|
||||
index 00000000..69d112bd
|
||||
--- /dev/null
|
||||
+++ b/lenses/strongswan.aug
|
||||
@@ -0,0 +1,41 @@
|
||||
+(*
|
||||
+Module: Strongswan
|
||||
+ Lens for parsing strongSwan configuration files
|
||||
+
|
||||
+Authors:
|
||||
+ Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
|
||||
+
|
||||
+About: Reference
|
||||
+ strongswan.conf(5)
|
||||
+
|
||||
+About: License
|
||||
+ This file is licensed under the LGPL v2+
|
||||
+*)
|
||||
+
|
||||
+module Strongswan =
|
||||
+
|
||||
+autoload xfm
|
||||
+
|
||||
+let ws = del /[\n\t ]*(#[\t ]*\n[\n\t ]*)*/
|
||||
+
|
||||
+let rec conf =
|
||||
+ let name (sep:string) =
|
||||
+ key (/[^\/.\{\}#\n\t ]+/ - /include/) . Util.del_ws_spc .
|
||||
+ Util.del_str sep
|
||||
+ in let val = store /[^\n\t ].*/ . Util.del_str "\n" . ws ""
|
||||
+ in let sval = Util.del_ws_spc . val
|
||||
+in (
|
||||
+ [ Util.del_str "#" . label "#comment" . Util.del_opt_ws " " . val ] |
|
||||
+ [ key "include" . sval ] |
|
||||
+ [ name "=" . sval ] |
|
||||
+ [ name "{" . ws "\n" . conf . Util.del_str "}" . ws "\n" ]
|
||||
+)*
|
||||
+
|
||||
+let lns = ws "" . conf
|
||||
+
|
||||
+let xfm = transform lns (
|
||||
+ incl "/etc/strongswan.d/*.conf" .
|
||||
+ incl "/etc/strongswan.d/**/*.conf" .
|
||||
+ incl "/etc/swanctl/conf.d/*.conf" .
|
||||
+ incl "/etc/swanctl/swanctl.conf"
|
||||
+)
|
||||
diff --git a/lenses/tests/test_strongswan.aug b/lenses/tests/test_strongswan.aug
|
||||
new file mode 100644
|
||||
index 00000000..55fe9052
|
||||
--- /dev/null
|
||||
+++ b/lenses/tests/test_strongswan.aug
|
||||
@@ -0,0 +1,65 @@
|
||||
+(*
|
||||
+ Some of the configuration snippets have been copied from the strongSwan
|
||||
+ source tree.
|
||||
+*)
|
||||
+
|
||||
+module Test_Strongswan =
|
||||
+
|
||||
+(* conf/strongswan.conf *)
|
||||
+let default = "
|
||||
+# strongswan.conf - strongSwan configuration file
|
||||
+#
|
||||
+# Refer to the strongswan.conf(5) manpage for details
|
||||
+#
|
||||
+# Configuration changes should be made in the included files
|
||||
+
|
||||
+charon {
|
||||
+ load_modular = yes
|
||||
+ plugins {
|
||||
+ include strongswan.d/charon/*.conf
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+include strongswan.d/*.conf
|
||||
+"
|
||||
+
|
||||
+test Strongswan.lns get default =
|
||||
+ { "#comment" = "strongswan.conf - strongSwan configuration file" }
|
||||
+ { "#comment" = "Refer to the strongswan.conf(5) manpage for details" }
|
||||
+ { "#comment" = "Configuration changes should be made in the included files" }
|
||||
+ { "charon"
|
||||
+ { "load_modular" = "yes" }
|
||||
+ { "plugins" { "include" = "strongswan.d/charon/*.conf" } }
|
||||
+ }
|
||||
+ { "include" = "strongswan.d/*.conf" }
|
||||
+
|
||||
+(* conf/strongswan.conf.5.head.in *)
|
||||
+let man_example = "
|
||||
+ a = b
|
||||
+ section-one {
|
||||
+ somevalue = asdf
|
||||
+ subsection {
|
||||
+ othervalue = xxx
|
||||
+ }
|
||||
+ # yei, a comment
|
||||
+ yetanother = zz
|
||||
+ }
|
||||
+ section-two {
|
||||
+ x = 12
|
||||
+ }
|
||||
+"
|
||||
+
|
||||
+test Strongswan.lns get man_example =
|
||||
+ { "a" = "b" }
|
||||
+ { "section-one"
|
||||
+ { "somevalue" = "asdf" }
|
||||
+ { "subsection" { "othervalue" = "xxx" } }
|
||||
+ { "#comment" = "yei, a comment" }
|
||||
+ { "yetanother" = "zz" }
|
||||
+ }
|
||||
+ { "section-two" { "x" = "12" } }
|
||||
+
|
||||
+test Strongswan.lns get "foo { bar = baz\n } quux {}\t#quuux\n" =
|
||||
+ { "foo" { "bar" = "baz" } }
|
||||
+ { "quux" }
|
||||
+ { "#comment" = "quuux" }
|
||||
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
||||
index 8e035e91..11827fb0 100644
|
||||
--- a/tests/Makefile.am
|
||||
+++ b/tests/Makefile.am
|
||||
@@ -205,6 +205,7 @@ lens_tests = \
|
||||
lens-sshd.sh \
|
||||
lens-sssd.sh \
|
||||
lens-star.sh \
|
||||
+ lens-strongswan.sh \
|
||||
lens-stunnel.sh \
|
||||
lens-subversion.sh \
|
||||
lens-sysconfig.sh \
|
||||
--
|
||||
2.16.1
|
||||
|
@ -1,14 +1,15 @@
|
||||
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
|
||||
pkgname=augeas
|
||||
pkgver=1.10.1
|
||||
pkgrel=0
|
||||
pkgrel=1
|
||||
pkgdesc="A configuration editing tool"
|
||||
url="http://augeas.net"
|
||||
arch="all"
|
||||
license="LGPL-2.0-or-later"
|
||||
makedepends="readline-dev libxml2-dev"
|
||||
makedepends="autoconf automake libxml2-dev readline-dev"
|
||||
subpackages="$pkgname-static $pkgname-dev $pkgname-doc $pkgname-tests::noarch $pkgname-libs"
|
||||
source="http://download.augeas.net/augeas-$pkgver.tar.gz
|
||||
0001-new-lens-Strongswan.patch
|
||||
fix-test.patch
|
||||
acf.aug"
|
||||
builddir="$srcdir/$pkgname-$pkgver"
|
||||
@ -72,5 +73,6 @@ static() {
|
||||
}
|
||||
|
||||
sha512sums="382e8ef6a5bd3d12d7d2e0d2987f39c04ff7df3f07cd68aa732bf266b89d5d59a85be63921a7ff70f9219dbc6bb8547f80528242caa9417e08a008d1721cb1d2 augeas-1.10.1.tar.gz
|
||||
c4544af27ff60b9198bfba9b753e22caba1a1eba1a7c2c18aaac06242e2fce3a653be6ff3c88c26b27c0331d89f65aa1581c2a859c0c1c47d5a01c0b942c1a79 0001-new-lens-Strongswan.patch
|
||||
9768878b2f8710436ef1eba7868c22b5eff1d2d549434bf76aced72ebdb4af4f769ea638dedf42ac9b617aaa53d1a767ed6b18868dd0bb3cf72cb3889f6d933a fix-test.patch
|
||||
74d728abdf4d3eebdeb3823c1d2588c214fd52734c8855fe3ddbfb6465d31c88d093df356e42effdd3dbdff1a62c52894c7aa840bd6ea8df4995c4f3aa53e919 acf.aug"
|
||||
|
Loading…
Reference in New Issue
Block a user