dot

packages and services management
Log | Files | Refs | README

commit f0360fb78295db85d7d4e6a81539fa82ce3e6932
parent 6652dc5ac66a285cc951f08cd50419a31dbb6eef
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sat, 26 Jan 2019 23:26:20 +0100

use a wildcard instead of adding each host by hand

Diffstat:
Mbin/s6-mk | 57++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
Dbin/s6-mk-build | 55-------------------------------------------------------
Mbin/s6-mk-compile | 15---------------
Dbin/s6-mk-up | 7-------
Dconf/host | 17-----------------
Mconf/init | 26++++----------------------
Mhome/.ssh/config | 20+-------------------
Mprofile/man.sh | 2+-
8 files changed, 62 insertions(+), 137 deletions(-)

diff --git a/bin/s6-mk b/bin/s6-mk @@ -1,3 +1,58 @@ #!/usr/bin/env execlineb +elgetpositionals -ii ii-freenode ircs://josuah@irc.freenode.net:6697 +if { mkdir -p /etc/s6-rc } +cd /etc/s6-rc + +forx -o 0 x { ${@} } +importas sv x + +backtick -n x { heredoc 0 ${sv} cut -d , -f 1 } +importas base x + +backtick -n x { heredoc 0 ${sv} cut -s -d , -f 2- } +importas -s -d , modules x + +redirfd -r 0 /etc/s6-mk/${base}/default/type +withstdinas x +importas -n type x + +backtick -n x { if { printf %s ${sv} } if -t { test ${type} = longrun } echo ,x } +importas svname x + +if { rm -rf ${sv} ${sv},x ${sv},log } + +# in case of fire, abandon the ship +ifte { } { if { rm -rf ${sv} ${sv},x ${sv},log } exit 1 } + +# copy each module +if { + forx -o 0 x { default ${modules} } + importas mod x + s6-hiercopy /etc/s6-mk/${base}/${mod} ${svname} +} + +# build bundles recursively +ifthenelse { test ${type} = bundle } { + backtick -i x { sed "s/^#.*//; /^[ \t]*$/ d; s/,x$//" ${sv}/contents } + importas -s -d "\n" x x + s6-mk ${x} +} { } + +# setup the logger for longruns +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/.log ${sv},log } + if { redirfd -a 1 ${sv},x/producer-for echo ${sv},log } + if { redirfd -w 1 ${sv},log/consumer-for echo ${sv},x } + if { redirfd -w 1 ${sv},log/pipeline-name echo ${sv} } + if { redirfd -w 1 ${sv},log/env/SERVICE echo ${sv} } +} { } + +# run setup scripts +cd ${svname} +forx -o 0 x { default ${modules} } +importas mod x +if -t { test -f /etc/s6-mk/${base}/${mod}/setup } +/etc/s6-mk/${base}/${mod}/setup diff --git a/bin/s6-mk-build b/bin/s6-mk-build @@ -1,55 +0,0 @@ -#!/usr/bin/env execlineb -elgetpositionals - -if { mkdir -p /var/s6-mk } -cd /var/s6-mk - -forx -o 0 x { ${@} } -importas sv x - -backtick -n x { heredoc 0 ${sv} cut -d , -f 1 } -importas base x - -backtick -n x { heredoc 0 ${sv} cut -s -d , -f 2- } -importas -s -d , modules x - -redirfd -r 0 /etc/s6-mk/${base}/default/type -withstdinas x -importas -n type x - -if { cd /etc/s6-mk/${base} redirfd -w 1 /dev/null ls -d ${modules} } -if { rm -rf ${sv},x ${sv},log } - -# in case of fire, abandon the ship -ifte { } { if { rm -rf ${sv},x ${sv},log } exit 1 } - -# copy each module -if { - forx -o 0 x { default ${modules} } - importas mod x - s6-hiercopy /etc/s6-mk/${base}/${mod} ${sv},x -} - -# build bundles recursively -ifthenelse { test ${type} = bundle } { - backtick -i x { sed "s/^#.*//; /^[ \t]*$/ d; s/,x$//" ${sv},x/contents } - importas -s -d "\n" x x - s6-mk-build ${x} -} { } - -# setup the logger for longruns -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/.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 } -} { } - -# run asetup scripts -cd ${sv},x -forx -o 0 x { default ${modules} } -importas mod x -if -t { test -f /etc/s6-mk/${base}/${mod}/setup } -/etc/s6-mk/${base}/${mod}/setup diff --git a/bin/s6-mk-compile b/bin/s6-mk-compile @@ -26,18 +26,3 @@ if { if { s6-rc-update /var/s6-rc/${clock} } if { s6-ln -nsf ${clock} /var/s6-rc/current } } - -# bundle with service,x (and service,log if any) -if { - cd /var/s6-mk - forbacktickx -n -d "\n" -o 0 x { - pipeline { ls } - pipeline { sed -n "s/,x$// p" } - sort -u - } - importas bundle x - backtick x { if -t { test -d ${bundle},log } echo ${bundle},log } - importas -s -d "\n" logger x - if -t { redirfd -w 1 /dev/null redirfd -w 2 /dev/null s6-rc list -- ${bundle} } - s6-rc-bundle -c /var/s6-rc/${clock} add ${bundle} ${bundle},x ${logger} -} diff --git a/bin/s6-mk-up b/bin/s6-mk-up @@ -1,7 +0,0 @@ -#!/usr/bin/env execlineb -elgetpositionals - -if { s6-mk-build "$@" } -if { s6-mk-compile } -if { s6-rc -u change "${@},x" } -if { s6-rc-status "${@},x" } diff --git a/conf/host b/conf/host @@ -1,17 +0,0 @@ -#!/usr/bin/env execlineb -elgetpositionals - -backtick -n x { dirname ${0} } -importas basedir x - -backtick -n x { uname -n } -importas hostname x - -if { mkdir -p /var/s6/source/ok-all } -if { cp ${basedir}/host/${hostname}/services /var/s6/source/ok-all } - -ifthenelse { test -f host/${hostname}/services } { - backtick -n x host/${hostname}/services - importas -s -d "\n" svs x - service-enable ${svs} -} {} diff --git a/conf/init b/conf/init @@ -1,29 +1,13 @@ #!/usr/bin/env execlineb if { rm -rf /run/s6 /run/s6-rc } -if { mkdir -p /var/s6-mk /var/s6-rc /run/s6 } - -# root "logger" service -if { s6-mkdir -p /run/s6/logger } -if { s6-mkfifo /run/s6/logger/fifo } -if { redirfd -w 1 /run/s6/logger/run printf "%s\n" - "#!/usr/bin/env execlineb" - "fdmove -c 2 1" - "redirfd -rnb 0 fifo" - "s6-log -bp t /var/log/s6" } -if { s6-chmod 0755 /run/s6/logger/run } -if { redirfd -w 1 /run/s6/logger/type echo "longrun" } - -# main "host" service -if { s6-mkdir -p /var/s6-mk/host } -if { touch /var/s6-mk/host/contents } -if { redirfd -w 1 /var/s6-mk/host/type echo "bundle" } +if { mkdir -p /etc/s6-rc /var/s6-rc /run/s6 } background { ifthenelse { test ! -h current } { backtick -n x { s6-clock } importas clock x - if { s6-rc-compile /var/s6-rc/${clock} /var/s6-mk } + if { s6-rc-compile /var/s6-rc/${clock} /etc/s6-rc } if { s6-ln -sfn ${clock} /var/s6-rc/current } } { } @@ -31,10 +15,8 @@ background { redirfd -w 1 /run/s6/logger/log if { s6-rc-init -d -c /var/s6-rc/current /run/s6 } - if { s6-rc -u change s6rc-fdholder } - if { s6-rc -u change s6rc-oneshot-runner } - if { s6-rc -u change host } - echo ":: s6-rc ready ::" + if { s6-rc -u change ok-all } + echo "=== s6-rc ready ===" } redirfd -r 0 /dev/null diff --git a/home/.ssh/config b/home/.ssh/config @@ -1,25 +1,7 @@ AddKeysToAgent yes ServerAliveInterval 30 -host ::1 - IdentityFile /mnt/key/ssh/josuah.key - -host 127.0.0.1 - IdentityFile /mnt/key/ssh/josuah.key - -host localhost - IdentityFile /mnt/key/ssh/josuah.key - -host bitreich.org - IdentityFile /mnt/key/ssh/josuah.key - -host josuah.net - IdentityFile /mnt/key/ssh/josuah.key - -host *.josuah.net - IdentityFile /mnt/key/ssh/josuah.key - -host *.github.com +host * IdentityFile /mnt/key/ssh/josuah.key host git.epitech.eu diff --git a/profile/man.sh b/profile/man.sh @@ -1 +1 @@ -export MANPATH=/man:/usr/man:/usr/share/man:/usr/local/man:/usr/local/share/man +export MANPATH=/share/man:/usr/share/man:/usr/local/share/man