dot

packages and services management
Log | Files | Refs | README

commit e95ddbdb46bdf07d366f6528adce13d3b3be7328
parent 6bd9b4026ff950dac1c246e068d79446cab5f17d
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sun,  9 Dec 2018 13:37:34 +0100

various scripts fixups

Diffstat:
Mbin/mail-draft | 2+-
Mbin/mail-reply | 20+++++++++++++++++---
Mbin/mail-send | 9+++++++++
Mbin/mail-write | 1-
Mbin/service-bundle | 18++++++------------
Abin/service-compile | 20++++++++++++++++++++
Mbin/service-disable | 7+------
Mbin/service-enable | 16++--------------
Mbin/service-list | 7++++++-
Mbin/service-log | 2+-
Apack/s6-rc/uri/0.4.1.0 | 1+
Apack/s6-rc/uri/git | 1+
Mpack/s6-rc/version | 2+-
Ds6/pjsua/iptel.org/conf/realm | 1-
Rs6/pjsua/iptel.org/conf/auto-play -> s6/pjsua/x/conf/auto-play | 0
Rs6/pjsua/iptel.org/conf/cli-telnet-port -> s6/pjsua/x/conf/cli-telnet-port | 0
As6/pjsua/x/conf/realm | 1+
As6/pjsua/x/conf/use-cli | 0
Ms6/pjsua/x/setup | 3++-
19 files changed, 69 insertions(+), 42 deletions(-)

diff --git a/bin/mail-draft b/bin/mail-draft @@ -9,7 +9,7 @@ importas -n draft x loopwhilex -o 101 if { printf "Draft: %s\n" ${draft} } -if { printf " [e]dit, [s]end, [c]ancel, [d]elete, [gs] sign, [ge] encrypt" } +if { printf " [e]dit, [s]end, [c]ancel, [d]elete, [gs] sign, [ge] encrypt " } backtick -n x { sed q } importas x x diff --git a/bin/mail-reply b/bin/mail-reply @@ -13,6 +13,9 @@ importas mail x backtick -n x { maddr -a -h local-mailbox:alternate-mailboxes: ${MBLAZE}/profile } importas me x +backtick -n x { mhdr -d -h from ${mail} } +importas From x + backtick -n -D ${From} To { pipeline { mhdr -d -h reply-to ${mail} } grep -Fv ${me} @@ -23,11 +26,22 @@ backtick -n Cc { grep -Fv ${me} } -backtick -n From { mhdr -h local-mailbox ${MBLAZE}/profile } backtick -n Subject { mscan -f %S ${mail} } -export Body ${mail} + +backtick -n x { mail-write } +importas draft x + + +if { + echo + pipeline { mshow ${mail} } + sed "s/^/> /; s/ *$//; s/> >/>>/g" +} + +if { + redirfd -a 1 ${draft} pipeline { mshow ${mail} } - sed "s/^/> /; s/ *$//; s/> >/>>/g" + sed "s/^/> /; s/ *$//; s/> >/>>/g" } mail-draft ${draft} diff --git a/bin/mail-send b/bin/mail-send @@ -4,6 +4,15 @@ elgetpositionals -P 1 backtick -n x { mseq ${1} } importas -n draft x +backtick -n USER { whoami } +importas USER USER +backtick -n HOME { homeof $USER } +importas HOME HOME +importas -D ${HOME}/.mblaze MBLAZE MBLAZE + +backtick -n -D ${HOME}/mail/OUTBOX x { mhdr -h outbox ${MBLAZE}/profile } +importas outbox x + if { if -tn { redirfd -r 0 ${draft} mmime -c } if { redirfd -r 0 ${draft} diff --git a/bin/mail-write b/bin/mail-write @@ -26,7 +26,6 @@ multisubstitute { importas -n Cc Cc importas -n Subject Subject importas -n To To - importas -n Body Body } if { diff --git a/bin/service-bundle b/bin/service-bundle @@ -1,6 +1,7 @@ #!/usr/bin/env execlineb cd /var/s6 +# make a bundle for base service with all variants forbacktickx -n x { pipeline { s6-ls . } pipeline { sed "s/,.*//" } @@ -8,16 +9,9 @@ forbacktickx -n x { } importas base x -if { rm -rf ${base} } -if { mkdir ${base} } +if { mkdir -p ${base} } +if { redirfd -w 1 ${base}/type echo bundle } -if { - redirfd -w 1 ${base}/type - echo bundle -} - -if { - redirfd -w 1 ${base}/contents - elglob -0s x ${base},* - printf "%s\n" ${x} -} +redirfd -w 1 ${base}/contents +elglob -0s x ${base},* +printf "%s\n" ${x} diff --git a/bin/service-compile b/bin/service-compile @@ -0,0 +1,20 @@ +#!/usr/bin/env execlineb +cd /var/s6 + +backtick -n x { s6-clock } +importas time x + +backtick -n x { pwd } +importas pwd x + +if { s6-rc-compile .s6-rc/compiled${time} . } +if { s6-rc-update -l ${pwd}/.s6-rc/live ${pwd}/.s6-rc/compiled${time} } + +# build a bundle with a service and its logger (if any) +elglob -0 svlist *,x +forbacktickx -d "\n" -o 0 x { pipeline { printf "%s\n" ${svlist} } sed "s/,x$//" } +importas sv x + +ifthenelse { test -d ${sv},log } + { s6-rc-bundle -f -l .s6-rc/live add ${sv} ${sv},x ${sv},log } + { s6-rc-bundle -f -l .s6-rc/live add ${sv} ${sv},x } diff --git a/bin/service-disable b/bin/service-disable @@ -4,9 +4,4 @@ elgetpositionals -P 1 if { rm -rf ${@},x ${@},log } if { service-bundle } - -backtick -n t { s6-clock } -importas t t - -if { s6-rc-compile /var/s6/.s6-rc/compiled$t /var/s6 } -if { s6-rc-update -l /var/s6/.s6-rc/live /var/s6/.s6-rc/compiled$t } +if { service-compile } diff --git a/bin/service-enable b/bin/service-enable @@ -3,17 +3,5 @@ elgetpositionals -P 1 cd /var/s6 if { service-build $@ } -#if { service-bundle } - -backtick -n x { s6-clock } -importas time x - -if { s6-rc-compile .s6-rc/compiled${time} . } -if { s6-rc-update -l /var/s6/.s6-rc/live /var/s6/.s6-rc/compiled${time} } - -# build a bundle with a service and its logger (if any) -forx x { $@ } -importas sv x -ifthenelse { test -d ${sv},log } - { s6-rc-bundle -f -l .s6-rc/live add ${sv} ${sv},x ${sv},log } - { s6-rc-bundle -f -l .s6-rc/live add ${sv} ${sv},x } +if { service-bundle } +if { service-compile } diff --git a/bin/service-list b/bin/service-list @@ -1,4 +1,9 @@ #!/usr/bin/env execlineb elgetpositionals -P 1 -s6-rc -l /var/s6/.s6-rc/live list $@ +pipeline { + ifelse { test ${#} = 0 } + { s6-rc-db -l /var/s6/.s6-rc/live list all } + s6-rc -l /var/s6/.s6-rc/live list $@ +} +sort diff --git a/bin/service-log b/bin/service-log @@ -7,5 +7,5 @@ backtick x { } importas -ns -d "\n" sv x -pipeline { tail -f "/var/log/${sv}/current" } +pipeline { tail -n 100 -f "/var/log/${sv}/current" } s6-tai64nlocal diff --git a/pack/s6-rc/uri/0.4.1.0 b/pack/s6-rc/uri/0.4.1.0 @@ -0,0 +1 @@ +http://skarnet.org/software/s6-rc/s6-rc-0.4.1.0.tar.gz diff --git a/pack/s6-rc/uri/git b/pack/s6-rc/uri/git @@ -0,0 +1 @@ +git://github.com/skarnet/s6-rc diff --git a/pack/s6-rc/version b/pack/s6-rc/version @@ -1 +1 @@ -0.4.0.1 +git diff --git a/s6/pjsua/iptel.org/conf/realm b/s6/pjsua/iptel.org/conf/realm @@ -1 +0,0 @@ -asterisk diff --git a/s6/pjsua/iptel.org/conf/auto-play b/s6/pjsua/x/conf/auto-play diff --git a/s6/pjsua/iptel.org/conf/cli-telnet-port b/s6/pjsua/x/conf/cli-telnet-port diff --git a/s6/pjsua/x/conf/realm b/s6/pjsua/x/conf/realm @@ -0,0 +1 @@ +* diff --git a/s6/pjsua/x/conf/use-cli b/s6/pjsua/x/conf/use-cli diff --git a/s6/pjsua/x/setup b/s6/pjsua/x/setup @@ -10,4 +10,5 @@ redirfd -r 0 conf/${var} withstdinas -n x importas x x -printf "--%s %s\n" $var $x +pipeline { printf "--%s %s\n" ${var} ${x} } +sed "s/ *$//"