dot

packages and services management
Log | Files | Refs | README

commit c6f2ec96c18d2db481e7fac87cc0f1bf80ed54e2
parent dc1821346753ea5452bc3f71fba22bbfe842b954
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sun,  6 Jan 2019 03:52:44 +0100

rename directories and discover s6-log

Diffstat:
Abin/fmt | 23+++++++++++++++++++++++
Mbin/mail-filter | 3+--
Mbin/open | 2+-
Mbin/s6-mk-build | 2+-
Mbin/s6-rc-log | 17++++++++++-------
Mconf/profile | 5+----
Retc/s6-mk/.s6-log/env/SERVICE -> etc/s6-mk/.log/env/SERVICE | 0
Aetc/s6-mk/.log/run | 7+++++++
Retc/s6-mk/.s6-log/type -> etc/s6-mk/.log/type | 0
Detc/s6-mk/.s6-log/run | 9---------
Aetc/s6-mk/alert/default/consumer-for | 1+
Aetc/s6-mk/alert/default/run | 2++
Retc/s6-mk/.s6-log/type -> etc/s6-mk/alert/default/type | 0
Metc/s6-mk/monit/default/data/alert/irc | 6+++++-
Aetc/s6-mk/monit/default/producer-for | 1+
Retc/s6-mk/.s6-log/env/SERVICE -> etc/s6-mk/qmail-smtpd/log/env/SERVICE | 0
Aetc/s6-mk/qmail-smtpd/log/run | 9+++++++++
Retc/s6-mk/.s6-log/type -> etc/s6-mk/qmail-smtpd/log/type | 0
Aetc/s6-mk/test/current | 1+
Retc/s6-mk/.s6-log/env/SERVICE -> etc/s6-mk/test/lock | 0
Retc/s6-mk/.s6-log/env/SERVICE -> etc/s6-mk/test/state | 0
Mhome/.config/open/protocol/git | 5++---
Rprofile.d/dot.sh -> profile/dot.sh | 0
Rprofile.d/go.sh -> profile/go.sh | 0
Rprofile.d/locale.sh -> profile/locale.sh | 0
Rprofile.d/man.sh -> profile/man.sh | 0
Rprofile.d/openbsd.sh -> profile/openbsd.sh | 0
Rprofile.d/pack.sh -> profile/pack.sh | 0
Rprofile.d/plan-9.sh -> profile/plan-9.sh | 0
Rprofile.d/prompt.sh -> profile/prompt.sh | 0
Rprofile.d/ssh.sh -> profile/ssh.sh | 0
Rprofile.d/umask.sh -> profile/umask.sh | 0
32 files changed, 65 insertions(+), 28 deletions(-)

diff --git a/bin/fmt b/bin/fmt @@ -0,0 +1,23 @@ +#!/usr/bin/awk -f + +function fold(blk) +{ + len = length(prefix); + gsub("\t", " ", blk); + gsub(" +", " ", blk); + sub("^ *", "", blk); sub(" *$", "", blk); + + for (p = first; (line = substr(blk, 1, 80 - len)) != ""; p = prefix) { + if (length(line) == 80 - len) + sub(" +[^ ]*$", "", line); + print(p line); + blk = substr(blk, length(line) + 1); + sub("^ *", "", blk); + } +} + +/^[ \t]*$/ { fold(blk); blk = ""; next; } + +{ blk = blk " " $0; } + +END { fold(blk); } diff --git a/bin/mail-filter b/bin/mail-filter @@ -28,5 +28,4 @@ importas rule x forbacktickx -n x { mpick -v -t ${rule} ${@} } importas file x -if { test ${file} != ${target}/new } -mv $file ${target}/new +mv ${file} ${target}/new diff --git a/bin/open b/bin/open @@ -11,7 +11,7 @@ backtick -n x { heredoc 0 $1 sed "s|.*\\.||" } importas extension x backtick -n x { heredoc 0 $1 sed "s|://.*||" } importas protocol x define regex "[^@:/#]+://(([^@:/#]*)@)?([^:/#]*)?(:([^/#]*))?(/([^#]*))?(#(.*))?" -backtick x { heredoc 0 $1 sed -r "s,${regex},\\2\\n\\3\\n\\5\\n\\7\\n\\9," } +backtick x { heredoc 0 $1 sed -r "s,${regex},\\2\\\n\\3\\\n\\5\\\n\\7\\\n\\9," } importas -s -d "\n" uri x ifelse { if { test ${protocol} } test -e ${OPEN}/protocol/${protocol} } diff --git a/bin/s6-mk-build b/bin/s6-mk-build @@ -41,7 +41,7 @@ ifthenelse { test ${type} = bundle } { ifthenelse { test ${type} = longrun } { ifthenelse { test -d /etc/s6-mk/${sv}/log } { s6-hiercopy /etc/s6-mk/${sv}/log ${sv},log } - { s6-hiercopy /etc/s6-mk/.s6-log ${sv},log } + { s6-hiercopy /etc/s6-mk/.log ${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},x } diff --git a/bin/s6-rc-log b/bin/s6-rc-log @@ -3,14 +3,17 @@ elgetpositionals if -n { test ${#} = 0 } -backtick x { - pipeline { s6-rc list ${@} } - pipeline { sed -n "s/,log$// p" } - sort -} -importas -ns -d "\n" sv x +pipeline { + forbacktickx -n x { + pipeline { s6-rc list ${@} } + pipeline { sed -n "s/,log$// p" } + sort + } + importas sv x -pipeline { elglob -0 x /var/log/${sv}/@* cat ${x} /var/log/${sv}/current } + elglob -0 x /var/log/${sv}/@* + cat ${x} /var/log/${sv}/current +} pipeline { sort -t " " -k1,1 } pipeline { s6-tai64nlocal } less diff --git a/conf/profile b/conf/profile @@ -3,7 +3,4 @@ cd "$(dirname "${0}")/.." mkdir -p /etc/profile.d - -for file in profile.d/*; do - cp "${file}" /etc/profile.d -done +cp profile/* /etc/profile.d diff --git a/etc/s6-mk/.s6-log/env/SERVICE b/etc/s6-mk/.log/env/SERVICE diff --git a/etc/s6-mk/.log/run b/etc/s6-mk/.log/run @@ -0,0 +1,7 @@ +#!/usr/bin/env execlineb +fdmove -c 2 1 +s6-envdir env + +importas SERVICE SERVICE + +s6-log -b t /var/log/${SERVICE} diff --git a/etc/s6-mk/.s6-log/type b/etc/s6-mk/.log/type diff --git a/etc/s6-mk/.s6-log/run b/etc/s6-mk/.s6-log/run @@ -1,9 +0,0 @@ -#!/usr/bin/env execlineb -fdmove -c 2 1 -s6-envdir env - -multisubstitute { - importas SERVICE SERVICE -} - -s6-log -b t /var/log/$SERVICE diff --git a/etc/s6-mk/alert/default/consumer-for b/etc/s6-mk/alert/default/consumer-for @@ -0,0 +1 @@ +monit diff --git a/etc/s6-mk/alert/default/run b/etc/s6-mk/alert/default/run @@ -0,0 +1,2 @@ +#!/usr/bin/env execlineb + diff --git a/etc/s6-mk/.s6-log/type b/etc/s6-mk/alert/default/type diff --git a/etc/s6-mk/monit/default/data/alert/irc b/etc/s6-mk/monit/default/data/alert/irc @@ -5,9 +5,13 @@ importas -i host IRC_HOST importas -i chan IRC_CHAN importas -i root IRC_ROOT +forstdin -n x { + +} + if -n { if -t { redirfd -wn 1 ${root}/${host}/in echo "/j ${chan}" } - if -t { redirfd -wn 1 ${root}/${host}/${chan}/in echo "[alert]" "${@}" } + if -t { redirfd -wn 1 ${root}/${host}/${chan}/in echo "[alert]" "" } } if { echo "could not send irc notification" } exit 1 diff --git a/etc/s6-mk/monit/default/producer-for b/etc/s6-mk/monit/default/producer-for @@ -0,0 +1 @@ +alert diff --git a/etc/s6-mk/.s6-log/env/SERVICE b/etc/s6-mk/qmail-smtpd/log/env/SERVICE diff --git a/etc/s6-mk/qmail-smtpd/log/run b/etc/s6-mk/qmail-smtpd/log/run @@ -0,0 +1,9 @@ +#!/usr/bin/env execlineb +fdmove -c 2 1 +s6-envdir env + +importas SERVICE SERVICE + +s6-log -b + -^ +" fatal: " 1 + f t /var/log/$SERVICE diff --git a/etc/s6-mk/.s6-log/type b/etc/s6-mk/qmail-smtpd/log/type diff --git a/etc/s6-mk/test/current b/etc/s6-mk/test/current @@ -0,0 +1 @@ +asdf diff --git a/etc/s6-mk/.s6-log/env/SERVICE b/etc/s6-mk/test/lock diff --git a/etc/s6-mk/.s6-log/env/SERVICE b/etc/s6-mk/test/state diff --git a/home/.config/open/protocol/git b/home/.config/open/protocol/git @@ -14,11 +14,10 @@ importas u x backtick -n x { homeof ${u} } importas home x -if { printf "\"%s\"\n" ${host} ${path} } backtick -n x { dirname ${home}/git/${host}/${path} } importas dir x -if { mkdir -p ${dir} } cd ${dir} -if { echo ${dir} } +if { mkdir -p ${dir} } +cd ${dir} git clone ${uri} diff --git a/profile.d/dot.sh b/profile/dot.sh diff --git a/profile.d/go.sh b/profile/go.sh diff --git a/profile.d/locale.sh b/profile/locale.sh diff --git a/profile.d/man.sh b/profile/man.sh diff --git a/profile.d/openbsd.sh b/profile/openbsd.sh diff --git a/profile.d/pack.sh b/profile/pack.sh diff --git a/profile.d/plan-9.sh b/profile/plan-9.sh diff --git a/profile.d/prompt.sh b/profile/prompt.sh diff --git a/profile.d/ssh.sh b/profile/ssh.sh diff --git a/profile.d/umask.sh b/profile/umask.sh