dot

packages and services management
Log | Files | Refs | README

commit 2ce8688197df76e1d9ad3d4c4e6aa0f9100a52ed
parent d0d652b9f9aea032364ac6f2e9bf908b41c7f867
Author: Josuah Demangeon <mail@josuah.net>
Date:   Fri, 23 Nov 2018 00:06:23 +0100

s6/vtund:  support recursive syntax for config file

Diffstat:
Ms6/ngircd/x/setup | 4++--
As6/vtund/client/run | 7+++++++
As6/vtund/server/conf/default/compress | 1+
As6/vtund/server/conf/default/encrypt | 1+
As6/vtund/server/conf/default/proto | 1+
As6/vtund/server/conf/default/type | 1+
As6/vtund/server/conf/options/bindaddr/addr | 1+
As6/vtund/server/run | 4++++
As6/vtund/x/conf/options/persist | 1+
As6/vtund/x/conf/options/port | 1+
As6/vtund/x/conf/options/type | 1+
As6/vtund/x/print | 17+++++++++++++++++
As6/vtund/x/setup | 6++++++
As6/vtund/x/type | 1+
14 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/s6/ngircd/x/setup b/s6/ngircd/x/setup @@ -7,5 +7,5 @@ forbacktickx x { ls } importas dir x if { printf "\n[%s]\n" $dir } forbacktickx x { ls $dir } importas file x -if { printf "\t%-20s = " $file } -cat ${dir}/${file} +redirfd -r 0 ${dir}/${file} withstdinas -n x importas content x +printf "\t%-20s = %s\n" $file $content diff --git a/s6/vtund/client/run b/s6/vtund/client/run @@ -0,0 +1,7 @@ +#!/usr/bin/env execlineb +fdmove -c 2 1 s6-envdir env multisubstitute { + importas HOST HOST + importas SESSION SESSION +} + +vtund -n -f data/conf $SESSION $HOST diff --git a/s6/vtund/server/conf/default/compress b/s6/vtund/server/conf/default/compress @@ -0,0 +1 @@ +lzo:3 diff --git a/s6/vtund/server/conf/default/encrypt b/s6/vtund/server/conf/default/encrypt @@ -0,0 +1 @@ +yes diff --git a/s6/vtund/server/conf/default/proto b/s6/vtund/server/conf/default/proto @@ -0,0 +1 @@ +udp diff --git a/s6/vtund/server/conf/default/type b/s6/vtund/server/conf/default/type @@ -0,0 +1 @@ +tun diff --git a/s6/vtund/server/conf/options/bindaddr/addr b/s6/vtund/server/conf/options/bindaddr/addr @@ -0,0 +1 @@ +0.0.0.0 diff --git a/s6/vtund/server/run b/s6/vtund/server/run @@ -0,0 +1,4 @@ +#!/usr/bin/env execlineb +fdmove -c 2 1 + +vtund -ns -f data/conf diff --git a/s6/vtund/x/conf/options/persist b/s6/vtund/x/conf/options/persist @@ -0,0 +1 @@ +no diff --git a/s6/vtund/x/conf/options/port b/s6/vtund/x/conf/options/port @@ -0,0 +1 @@ +5000 diff --git a/s6/vtund/x/conf/options/type b/s6/vtund/x/conf/options/type @@ -0,0 +1 @@ +stand diff --git a/s6/vtund/x/print b/s6/vtund/x/print @@ -0,0 +1,17 @@ +#!/usr/bin/env execlineb +elgetpositionals + +backtick x { heredoc 0 $1 sed "s,[^/],,g; s,/,\t,g" } importas -d "\n" -n tab x + +forbacktickx x { ls $1 } importas path x + +ifelse { test -d ${1}/${path} } { + if { printf "%s%s {\n" $tab $path } + if { $0 ${1}/${path} } + if { printf "%s}\n" $tab } +} + +ifelse { test -f ${1}/${path} } { + redirfd -r 0 ${1}/${path} withstdinas -n x importas content x + printf "%s%s = %s;\n" $tab $path $content +} diff --git a/s6/vtund/x/setup b/s6/vtund/x/setup @@ -0,0 +1,6 @@ +#!/usr/bin/env execlineb + +if { mkdir -p data } +redirfd -w 1 data/conf cd conf + +../print . diff --git a/s6/vtund/x/type b/s6/vtund/x/type @@ -0,0 +1 @@ +longrun