dot

packages and services management
Log | Files | Refs | README

commit a3b647abf9fdd58a82b472a2c3171eadea89c5e2
parent f488b18b962d6112ab49818a334a5be64635d5ad
Author: Josuah Demangeon <mail@josuah.net>
Date:   Tue, 18 Dec 2018 23:42:28 +0100

keep the scandir on /run

Diffstat:
Mbin/mail-head | 8+++++---
Mbin/service-compile | 37+++++++++++++++++++++++++++----------
Mbin/service-disable | 2+-
Mbin/service-enable | 14+++++++-------
Mbin/service-list | 39+++++++++++++++++----------------------
Retc/s6/tor/josuah.net/serv/gopher/HiddenServiceDir -> etc/s6/tor/gopher/conf/service/gopher/HiddenServiceDir | 0
Retc/s6/tor/josuah.net/serv/gopher/HiddenServicePort -> etc/s6/tor/gopher/conf/service/gopher/HiddenServicePort | 0
Retc/s6/tor/josuah.net/serv/http/HiddenServiceDir -> etc/s6/tor/http/conf/service/http/HiddenServiceDir | 0
Retc/s6/tor/josuah.net/serv/http/HiddenServicePort -> etc/s6/tor/http/conf/service/http/HiddenServicePort | 0
Retc/s6/tor/josuah.net/serv/icecast/HiddenServiceDir -> etc/s6/tor/icecast/conf/service/icecast/HiddenServiceDir | 0
Retc/s6/tor/josuah.net/serv/icecast/HiddenServicePort -> etc/s6/tor/icecast/conf/service/icecast/HiddenServicePort | 0
Retc/s6/tor/x/conf/Log -> etc/s6/tor/x/conf/config/Log | 0
Retc/s6/tor/x/conf/PIDFile -> etc/s6/tor/x/conf/config/PIDFile | 0
Retc/s6/tor/x/conf/RunAsDaemon -> etc/s6/tor/x/conf/config/RunAsDaemon | 0
Retc/s6/tor/x/conf/SOCKSPort -> etc/s6/tor/x/conf/config/SOCKSPort | 0
Retc/s6/tor/x/conf/User -> etc/s6/tor/x/conf/config/User | 0
Metc/s6/tor/x/setup | 9+++++++--
17 files changed, 64 insertions(+), 45 deletions(-)

diff --git a/bin/mail-head b/bin/mail-head @@ -1,6 +1,6 @@ #!/usr/bin/env execlineb -define FORMAT " %t %s\\n %D %40f\\n" +define FORMAT " %D %22f %100S" backtick -n x { whoami } importas USER x @@ -17,8 +17,10 @@ importas box x backtick -n x { pipeline { mlist -i ${box} } sed "s/ *[^ ]*$//" } importas count x if { printf " \033[1m%-30s\033[m %s\n\n" ${box} ${count} } -if { +if { pipeline { pipeline { mlist -s ${box} } pipeline { msort -d } mscan -f ${FORMAT} -} +} sed "s/ *$//" } +if -tn { heredoc 0 ${count} grep -q " 0 unseen" } +if { echo } diff --git a/bin/service-compile b/bin/service-compile @@ -13,10 +13,6 @@ if { } importas base x - if -nt { - if { test -d ${base}/type } - if { grep -Fxvq bundle ${base}/type } - } if { mkdir -p ${base} } if { redirfd -w 1 ${base}/type echo bundle } redirfd -w 1 ${base}/contents @@ -24,10 +20,31 @@ if { printf "%s\n" ${x} } -backtick -n x { s6-clock } -importas time x +# compile the live database +if { + backtick -n x { s6-clock } + importas time x + + if { mkdir -p source compiled } + if { s6-rc-compile compiled/${time} source } + if { s6-ln -nsf compiled/${time} current } + s6-rc-update -l /var/s6/live /var/s6/compiled/${time} +} + +# bundle the service,x and service,log +if { + cd source + + forbacktickx -n -o 0 x { + pipeline { ls } + pipeline { sed -n "s/,x// p" } + sort -u + } + importas bundle x + + backtick x { if { test -d ${bundle},log } echo ${bundle},log } + importas -s -d "\n" logger x -if { mkdir -p source compiled } -if { s6-rc-compile compiled/${time} source } -if { s6-ln -nsf compiled/${time} current } -s6-rc-update -l /var/s6/live /var/s6/compiled/${time} + s6-rc-bundle -fb -l /var/s6/live -c /var/s6/current + add ${bundle} ${bundle},x ${logger} +} diff --git a/bin/service-disable b/bin/service-disable @@ -1,5 +1,5 @@ #!/usr/bin/env execlineb elgetpositionals -if { rm -rf /var/s6/source/${@} /var/s6/source/${@},log } +if { rm -rf /var/s6/source/${@},x /var/s6/source/${@},log } service-compile diff --git a/bin/service-enable b/bin/service-enable @@ -18,20 +18,20 @@ withstdinas x importas -n type x if { cd /etc/s6/${base} redirfd -w 1 /dev/null ls -d ${mod} } -if { rm -rf ${sv} ${sv},log } +if { rm -rf ${sv},x ${sv},log } -ifte { } { if { rm -rf ${sv} ${sv},log } exit 1 } +ifte { } { if { rm -rf ${sv},x ${sv},log } exit 1 } # copy all the modules if { forx -o 0 x { x ${mod} } importas x x - s6-hiercopy /etc/s6/${base}/${x} ${sv} + s6-hiercopy /etc/s6/${base}/${x} ${sv},x } # build bundles recursively if { if -t { test ${type} = bundle } - backtick -i x { sed "s/^#.*//; /^[ \t]*$/ d" ${sv}/contents } + backtick -i x { sed "s/^#.*//; /^[ \t]*$/ d" ${sv},x/contents } importas -s -d "\n" x x service-build ${x} } @@ -42,10 +42,10 @@ if { ifthenelse { test -d /etc/s6/${sv}/log } { s6-hiercopy /etc/s6/${sv}/log ${sv},log } { s6-hiercopy /etc/s6/.s6-log ${sv},log } - if { redirfd -a 1 ${sv}/producer-for echo ${sv},log } + if { redirfd -a 1 ${sv},x/producer-for echo ${sv},log } if { redirfd -w 1 ${sv},log/env/SERVICE echo ${sv} } - if { redirfd -w 1 ${sv},log/consumer-for echo ${sv} } + if { redirfd -w 1 ${sv},log/consumer-for echo ${sv},x } } -if { cd ${sv} if -t { test -x setup } ./setup } +if { cd ${sv},x if -t { test -x setup } ./setup } service-compile diff --git a/bin/service-list b/bin/service-list @@ -1,29 +1,24 @@ #!/usr/bin/env execlineb elgetpositionals -forbacktickx -n -o 0 x { - pipeline { - ifthenelse { test ${#} = 0 } - { s6-rc-db -l /var/s6/live list longruns } - { s6-rc -l /var/s6/live list $@ } +pipeline { + forbacktickx -n -o 0 x { + pipeline { + ifthenelse { test ${#} = 0 } + { s6-rc-db -l /var/s6/live list longruns } + { s6-rc -l /var/s6/live list $@ } + } + pipeline { sed -n "s/,x$// p" } + sort } - pipeline { grep -v ",log$" } - sort -} -importas service x + importas service x -backtick -n x { - pipeline { s6-svstat -o up,wantedup /var/s6/scandir/${service} } - sed " - s/true true/ ok / - s/true false/ no / - s/false true/fail/ - s/false false/down/ - " -} -importas flag x + backtick -n x { s6-svstat -o up,wantedup /var/s6/scandir/${service},x } + importas up x -backtick -n x { s6-svstat -o updownfor /var/s6/scandir/${service} } -importas updownfor x + backtick -n x { s6-svstat -o updownfor /var/s6/scandir/${service},x } + importas since x -printf " %s %-40s %10ds\n" ${flag} ${service} ${updownfor} + if { printf "%10ds %s %s\n" ${since} ${up} ${service} } +} +sed "s/true true/ up /; s/true false/kill/g; s/false true/down/; s/false false/fail/g;" diff --git a/etc/s6/tor/josuah.net/serv/gopher/HiddenServiceDir b/etc/s6/tor/gopher/conf/service/gopher/HiddenServiceDir diff --git a/etc/s6/tor/josuah.net/serv/gopher/HiddenServicePort b/etc/s6/tor/gopher/conf/service/gopher/HiddenServicePort diff --git a/etc/s6/tor/josuah.net/serv/http/HiddenServiceDir b/etc/s6/tor/http/conf/service/http/HiddenServiceDir diff --git a/etc/s6/tor/josuah.net/serv/http/HiddenServicePort b/etc/s6/tor/http/conf/service/http/HiddenServicePort diff --git a/etc/s6/tor/josuah.net/serv/icecast/HiddenServiceDir b/etc/s6/tor/icecast/conf/service/icecast/HiddenServiceDir diff --git a/etc/s6/tor/josuah.net/serv/icecast/HiddenServicePort b/etc/s6/tor/icecast/conf/service/icecast/HiddenServicePort diff --git a/etc/s6/tor/x/conf/Log b/etc/s6/tor/x/conf/config/Log diff --git a/etc/s6/tor/x/conf/PIDFile b/etc/s6/tor/x/conf/config/PIDFile diff --git a/etc/s6/tor/x/conf/RunAsDaemon b/etc/s6/tor/x/conf/config/RunAsDaemon diff --git a/etc/s6/tor/x/conf/SOCKSPort b/etc/s6/tor/x/conf/config/SOCKSPort diff --git a/etc/s6/tor/x/conf/User b/etc/s6/tor/x/conf/config/User diff --git a/etc/s6/tor/x/setup b/etc/s6/tor/x/setup @@ -3,14 +3,19 @@ if { mkdir -p data } redirfd -w 1 data/conf -if { if -t { test -d serv } cd conf +cd conf + +if { + cd config + forbacktickx x { ls } importas file x if { printf "%-20s " $file } cat $file } +if { + cd service -if { if -t { test -d serv } cd serv forbacktickx x { ls } importas dir x if { printf "\n## %s ##\n\n" $dir } forbacktickx x { ls $dir } importas file x