dot

packages and services management
Log | Files | Refs | README

commit 2df103ec1400670a854eb17ad7fe7b52716ae676
parent 7b40d44681009e81222c4d342e325f7daed7b8d6
Author: Josuah Demangeon <mail@josuah.net>
Date:   Thu,  8 Nov 2018 00:49:52 +0100

enable and disable scripts

Diffstat:
Rbin/copy -> bin/clip-in | 0
Rbin/paste -> bin/clip-out | 0
Mbin/service-disable | 14+++++++-------
Mbin/service-enable | 26+++++++++++++++++++++-----
4 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/bin/copy b/bin/clip-in diff --git a/bin/paste b/bin/clip-out diff --git a/bin/service-disable b/bin/service-disable @@ -1,9 +1,9 @@ #!/usr/bin/env execlineb -importas 1 1 +cd /var/s6/source -if { mkdir -p /etc/s6rc/ok-all } -if { touch /etc/s6rc/ok-all/contents } -if { - pipeline { grep -Fv $1 /etc/s6rc/ok } - sort -u -o /etc/s6rc/ok-all/contents - -} +if { mkdir -p ok-all } +if { touch ok-all/contents } + +forbacktickx -n x { pipeline { dollarat } tr / - } importas x x +if { rm -rf $x } +pipeline { grep -Fv $x ok-all/contents } sort -u -o ok-all/contents - diff --git a/bin/service-enable b/bin/service-enable @@ -1,8 +1,24 @@ #!/usr/bin/env execlineb -importas 1 1 +cd /var/s6/source +define SERVICE /root/dot/s6 importas SERVICE SERVICE -cd /etc/s6/ -if { - pipeline { echo $1 } - sort -u -o /etc/s6/ok-all/contents /etc/s6/ok-all/contents - +ifelse { pipeline { dollarat } grep -Evq "^[^/]+/[^/]+\$" } { + foreground { echo "usage: service-enable service/version..." } + exit 1 } + +forbacktickx -n src { dollarat } importas src src + +backtick -n dir { dirname $src } importas dir dir +backtick -n dst { pipeline { echo $src } tr / - } importas dst dst +define -n log ${dst}-log importas log log + +if { rm -rf $dst $log } +if { s6-hiercopy ${SERVICE}/s6-log/x $log } +if { s6-hiercopy ${SERVICE}/${dir}/x $dst } +if { s6-hiercopy ${SERVICE}/${src} $dst } +if { redirfd -w 1 ${dst}/env/SERVICE echo $dst } +if { redirfd -w 1 ${dst}/producer-for echo $log } +if { redirfd -w 1 ${log}/consumer-for echo $dst } +if { pipeline { echo $dst } sort -u -o ok-all/contents ok-all/contents - } +if { pipeline { echo $log } sort -u -o ok-all/contents ok-all/contents - }