dot

packages and services management
Log | Files | Refs | README

commit fe82e417ae559f9a02798111ca5d542d9c7d7550
parent 887fd924458cd2b6bd97832fd739fb15d0edff62
Author: Josuah Demangeon <mail@josuah.net>
Date:   Tue, 11 Dec 2018 01:53:56 +0100

s6/tinydns: use a different scheme

Diffstat:
Mconf/dhparams | 4++--
Dconf/profile | 5-----
Mconf/s6 | 20+++++++++++++++++---
Dconf/service | 8--------
Mdot/profile | 8+++++++-
Dinit-script/OpenBSD | 10----------
Dinit-script/openbsd | 8--------
Dprofile | 13-------------
Ds6/tinydns/h-o.st/zone/h-o.st/alias/@ | 2--
Ds6/tinydns/h-o.st/zone/h-o.st/alias/g | 2--
Ds6/tinydns/h-o.st/zone/h-o.st/alias/git | 2--
Ds6/tinydns/h-o.st/zone/h-o.st/alias6/@ | 2--
Ds6/tinydns/h-o.st/zone/h-o.st/alias6/a.mx | 2--
Ds6/tinydns/h-o.st/zone/h-o.st/alias6/a.ns | 2--
Ds6/tinydns/h-o.st/zone/h-o.st/alias6/g | 2--
Ds6/tinydns/h-o.st/zone/h-o.st/alias6/git | 2--
Ds6/tinydns/h-o.st/zone/h-o.st/host/glaphyrae | 1-
Ds6/tinydns/h-o.st/zone/h-o.st/host6/glaphyrae | 1-
Ds6/tinydns/h-o.st/zone/h-o.st/ns/@ | 2--
Ds6/tinydns/h-o.st/zone/h-o.st/txt/@ | 1-
Ds6/tinydns/h-o.st/zone/himalaya-solaire.org/alias/@ | 2--
Ds6/tinydns/h-o.st/zone/himalaya-solaire.org/alias/www | 2--
Ds6/tinydns/h-o.st/zone/himalaya-solaire.org/ns/@ | 2--
Ds6/tinydns/h-o.st/zone/himalaya-solaire.org/txt/@ | 1-
Ds6/tinydns/h-o.st/zone/josuah.net/alias/@ | 2--
Ds6/tinydns/h-o.st/zone/josuah.net/alias/git | 2--
Ds6/tinydns/h-o.st/zone/josuah.net/alias/irc | 2--
Ds6/tinydns/h-o.st/zone/josuah.net/alias/mail | 2--
Ds6/tinydns/h-o.st/zone/josuah.net/alias/www | 2--
Ds6/tinydns/h-o.st/zone/josuah.net/alias6/@ | 2--
Ds6/tinydns/h-o.st/zone/josuah.net/alias6/git | 2--
Ds6/tinydns/h-o.st/zone/josuah.net/alias6/irc | 2--
Ds6/tinydns/h-o.st/zone/josuah.net/alias6/mail | 2--
Ds6/tinydns/h-o.st/zone/josuah.net/alias6/www | 2--
Ds6/tinydns/h-o.st/zone/josuah.net/ns/@ | 2--
Ds6/tinydns/h-o.st/zone/josuah.net/txt/@ | 1-
Ms6/tinydns/x/setup | 39+++++++++++++++++++++------------------
37 files changed, 47 insertions(+), 119 deletions(-)

diff --git a/conf/dhparams b/conf/dhparams @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/usr/bin/env execlineb -openssl dhparam -out /etc/ssl/dhparam.pem 4096 +if { openssl dhparam -out /etc/ssl/dhparam.pem 4096 } chmod 444 /etc/ssl/dhparam.pem diff --git a/conf/profile b/conf/profile @@ -1,5 +0,0 @@ -#!/bin/sh -e - -cd "$(dirname "$0")/.." -cp profile /etc -cp -r profile.d /etc diff --git a/conf/s6 b/conf/s6 @@ -1,4 +1,18 @@ -#!/bin/sh -e +#!/usr/bin/env execlineb +elgetpositionals +backtick -n x { dirname ${0}/.. } importas rootdir x -cd "$(dirname "$0")/.." -ln -sf "$PWD/s6" /etc +cd ${rootdir} + +backtick -n x { pwd } importas pwd x +backtick -n x { uname } importas uname x + +if { cp dot/profile /etc } +if { cp -r profile.d /etc } +if { ln -sf ${pwd}/s6 /etc } + +ifelse { ${uname} = OpenBSD } { + cp ../init/openbsd /etc/rc.d/service +} + +echo OS not supported diff --git a/conf/service b/conf/service @@ -1,8 +0,0 @@ -#!/bin/sh -e - -cd "$(dirname "$0")" - -case "$(uname)" in -(OpenBSD) cp "../init-script/openbsd" /etc/rc.d/service ;; -(*) echo OS not supported, do it by hand or extend me ;; -esac diff --git a/dot/profile b/dot/profile @@ -1 +1,7 @@ -. /etc/profile +export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin + +umask 022 + +for f in /etc/profile.d/*.sh; do + . "$f" +done diff --git a/init-script/OpenBSD b/init-script/OpenBSD @@ -1,10 +0,0 @@ -#!/bin/ksh - -daemon="$(which service-init)" - -. /etc/rc.d/rc.subr - -pexp="$(which service-init)" -rc_reload=NO - -rc_cmd $1 diff --git a/init-script/openbsd b/init-script/openbsd @@ -1,8 +0,0 @@ -#!/usr/bin/env execlineb -elgetpositionals - -ifelse { test $1 = start } { background { service-init } } -ifelse { test $1 = stop } { service-halt } -ifelse { test $1 = restart } { if { $0 stop } $0 start } -ifelse { test $1 = reload } { pkill -HUP service-init } -echo "usage: service {start,stop,restart,reload,check}" diff --git a/profile b/profile @@ -1,13 +0,0 @@ -# I would /really/ prefer having only /bin and end of the story. But many -# systems just like to split /bin over and over because NFS roots or split -# hierarchies with /usr mounted afterward. -# -# So in the meantime that mounting all the "bin" directories to /bin -# gets a common practice, I will keep this rather complex $PATH. -export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin - -umask 022 - -for f in /etc/profile.d/*.sh; do - . "$f" -done diff --git a/s6/tinydns/h-o.st/zone/h-o.st/alias/@ b/s6/tinydns/h-o.st/zone/h-o.st/alias/@ @@ -1 +0,0 @@ -../host/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/h-o.st/alias/g b/s6/tinydns/h-o.st/zone/h-o.st/alias/g @@ -1 +0,0 @@ -../host/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/h-o.st/alias/git b/s6/tinydns/h-o.st/zone/h-o.st/alias/git @@ -1 +0,0 @@ -../host/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/h-o.st/alias6/@ b/s6/tinydns/h-o.st/zone/h-o.st/alias6/@ @@ -1 +0,0 @@ -../host6/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/h-o.st/alias6/a.mx b/s6/tinydns/h-o.st/zone/h-o.st/alias6/a.mx @@ -1 +0,0 @@ -../host6/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/h-o.st/alias6/a.ns b/s6/tinydns/h-o.st/zone/h-o.st/alias6/a.ns @@ -1 +0,0 @@ -../host6/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/h-o.st/alias6/g b/s6/tinydns/h-o.st/zone/h-o.st/alias6/g @@ -1 +0,0 @@ -../host6/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/h-o.st/alias6/git b/s6/tinydns/h-o.st/zone/h-o.st/alias6/git @@ -1 +0,0 @@ -../host6/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/h-o.st/host/glaphyrae b/s6/tinydns/h-o.st/zone/h-o.st/host/glaphyrae @@ -1 +0,0 @@ -199.247.28.162 diff --git a/s6/tinydns/h-o.st/zone/h-o.st/host6/glaphyrae b/s6/tinydns/h-o.st/zone/h-o.st/host6/glaphyrae @@ -1 +0,0 @@ -2001:19f0:5001:7ac:5400:01ff:fe90:7c33 diff --git a/s6/tinydns/h-o.st/zone/h-o.st/ns/@ b/s6/tinydns/h-o.st/zone/h-o.st/ns/@ @@ -1 +0,0 @@ -../host/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/h-o.st/txt/@ b/s6/tinydns/h-o.st/zone/h-o.st/txt/@ @@ -1 +0,0 @@ -v=spf1 mx -all diff --git a/s6/tinydns/h-o.st/zone/himalaya-solaire.org/alias/@ b/s6/tinydns/h-o.st/zone/himalaya-solaire.org/alias/@ @@ -1 +0,0 @@ -../../h-o.st/host/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/himalaya-solaire.org/alias/www b/s6/tinydns/h-o.st/zone/himalaya-solaire.org/alias/www @@ -1 +0,0 @@ -../../h-o.st/host/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/himalaya-solaire.org/ns/@ b/s6/tinydns/h-o.st/zone/himalaya-solaire.org/ns/@ @@ -1 +0,0 @@ -../../h-o.st/host/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/himalaya-solaire.org/txt/@ b/s6/tinydns/h-o.st/zone/himalaya-solaire.org/txt/@ @@ -1 +0,0 @@ -"v=spf1 include:_mailcust.gandi.net ?all" diff --git a/s6/tinydns/h-o.st/zone/josuah.net/alias/@ b/s6/tinydns/h-o.st/zone/josuah.net/alias/@ @@ -1 +0,0 @@ -../../h-o.st/host/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/josuah.net/alias/git b/s6/tinydns/h-o.st/zone/josuah.net/alias/git @@ -1 +0,0 @@ -../../h-o.st/host/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/josuah.net/alias/irc b/s6/tinydns/h-o.st/zone/josuah.net/alias/irc @@ -1 +0,0 @@ -../../h-o.st/host/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/josuah.net/alias/mail b/s6/tinydns/h-o.st/zone/josuah.net/alias/mail @@ -1 +0,0 @@ -../../h-o.st/host/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/josuah.net/alias/www b/s6/tinydns/h-o.st/zone/josuah.net/alias/www @@ -1 +0,0 @@ -../../h-o.st/host/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/josuah.net/alias6/@ b/s6/tinydns/h-o.st/zone/josuah.net/alias6/@ @@ -1 +0,0 @@ -../../h-o.st/host6/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/josuah.net/alias6/git b/s6/tinydns/h-o.st/zone/josuah.net/alias6/git @@ -1 +0,0 @@ -../../h-o.st/host6/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/josuah.net/alias6/irc b/s6/tinydns/h-o.st/zone/josuah.net/alias6/irc @@ -1 +0,0 @@ -../../h-o.st/host6/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/josuah.net/alias6/mail b/s6/tinydns/h-o.st/zone/josuah.net/alias6/mail @@ -1 +0,0 @@ -../../h-o.st/host6/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/josuah.net/alias6/www b/s6/tinydns/h-o.st/zone/josuah.net/alias6/www @@ -1 +0,0 @@ -../../h-o.st/host6/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/josuah.net/ns/@ b/s6/tinydns/h-o.st/zone/josuah.net/ns/@ @@ -1 +0,0 @@ -../../h-o.st/host/glaphyrae- \ No newline at end of file diff --git a/s6/tinydns/h-o.st/zone/josuah.net/txt/@ b/s6/tinydns/h-o.st/zone/josuah.net/txt/@ @@ -1 +0,0 @@ -"v=spf1 mx -all" diff --git a/s6/tinydns/x/setup b/s6/tinydns/x/setup @@ -5,19 +5,23 @@ if { touch data/data } ifte { cd data tinydns-data } { exit 1 } -forbacktickx -o 0 x { ls zone } -importas -n apex x +forbacktickx -o 0 -d "\n" x { ls zone } importas -n type x +forbacktickx -o 0 -d "\n" x { + cd zone/${type} elglob x * find -L ${x} -type f -o -type l +} importas path x -forbacktickx -o 0 x { ls zone/${apex} } -importas -n type x +# transform top/mid/low to low.mid.top +backtick -n x { + heredoc 0 ${path} + pipeline { tr "/" "\n" } + pipeline { sed "1!G;h;$!d" } + pipeline { tr "\n" "." } + sed "s/\\.$//; s/^@.//" +} importas -n name x -forbacktickx -o 0 x { ls zone/${apex}/${type} } -importas -n name x +forbacktickx -o 0 -d "\n" x { cat zone/${type}/${path} } importas content x -forbacktickx -d "\n" -o 0 x { cat zone/${apex}/${type}/${name} } -importas -n content x - -if { echo ${type} ${name} ${apex} ${content} } +if { printf "%-6s %-20s %s\n" ${type} ${name} ${content} } ifelse { test ${type} = txt } { # encode to octal: "\254\055\301\006\241\062\046\102" @@ -31,11 +35,9 @@ ifelse { test ${type} = txt } { s/ +/\\\\/g " } tr -d "\n" - } - importas text x + } importas text x - redirfd -a 1 data/data - echo "'${name}:${text}" + redirfd -a 1 data/data echo "'${name}:${text}" } ifelse { heredoc 0 ${type} grep -Eq "^[0-9]+$" } { @@ -43,7 +45,8 @@ ifelse { heredoc 0 ${type} grep -Eq "^[0-9]+$" } { echo ":${type}:${name}:${content}" } -ifelse { test ${name} = @ } { - tinydns-edit data/data data/data.new add ${type} ${apex} ${content} -} -tinydns-edit data/data data/data.new add ${type} ${name}.${apex} ${content} +ifelse { heredoc 0 ${content} grep -vq : } + { tinydns-edit data/data data/data.new add ${type} ${name} ${content} } + +ifelse -n { if -n { test ${type} = host } if -n { test ${type} = alias } } + { tinydns-edit data/data data/data.new add ${type}6 ${name} ${content} }