dot

packages and services management
Log | Files | Refs | README

commit 74feabbe04bd53f881eaea6c8ecd3567b33f268c
parent 62e49cc4e3e900ea42813935b43f9dbf201d0bc4
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sun,  4 Nov 2018 14:57:47 +0100

Merge branch 'master' of file:///root/dot

Diffstat:
AMakefile | 3+++
MREADME | 0
Dbin/misc/mdoc | 74--------------------------------------------------------------------------
Mbin/remap/o | 0
Mbin/remap/xdg-open | 0
Abin/service/service-disable | 10++++++++++
Abin/service/service-enable | 8++++++++
Abin/service/service-init | 27+++++++++++++++++++++++++++
Abin/service/service-load | 7+++++++
Abin/service/service-reload | 4++++
Abin/service/service-restart | 5+++++
Abin/service/service-shutdown | 3+++
Abin/service/service-start | 4++++
Abin/service/service-status | 3+++
Abin/service/service-stop | 4++++
Aconf-profile | 5+++++
Mconf-s6 | 18+++++++++---------
Ddot/profile | 34----------------------------------
Aprofile | 13+++++++++++++
Aprofile.d/go.sh | 2++
Aprofile.d/locale.sh | 8++++++++
Aprofile.d/man.sh | 1+
Aprofile.d/openbsd.sh | 1+
Aprofile.d/pack.sh | 3+++
Aprofile.d/plan9.sh | 2++
Aprofile.d/prompt.sh | 28++++++++++++++++++++++++++++
Aprofile.d/ssh.sh | 1+
Aprofile.d/umask.sh | 1+
Ds6-init | 27---------------------------
Ds6-load | 7-------
30 files changed, 152 insertions(+), 151 deletions(-)

diff --git a/Makefile b/Makefile @@ -0,0 +1,3 @@ +all: + ./conf-bin + ./conf- diff --git a/README b/README diff --git a/bin/misc/mdoc b/bin/misc/mdoc @@ -1,74 +0,0 @@ -#!/bin/sh -e -# print stub of an mdoc man page or parts of it - -test $# = 1 || exec "$0" -h - -case $1 in - -(dd) date +'.Dd $Mdocdate: %B %d %Y$' - exit 0 - ;; -(bd) printf '.Bd -literal -offset indent\n' - sed -e 's/\\/\\\\/g' -e 's/^\./\\./' - printf '.Ed' - exit 0 - ;; -(start) date +'.Dd $Mdocdate: %B %d %Y$' - exec cat <<'EOF' -.Dt PROGNAME section -.Os -. -. -.Sh NAME -. -.Nm progname -.Nd one line about what it does -. -. -.Sh SYNOPSIS -. -.Nm progname -.Op Fl options -.Ar -. -. -.Sh DESCRIPTION -. -The -.Nm -utility -. -. -.\" .Sh CONTEXT -.\" For section 9 functions only. -.\" .Sh RETURN VALUES -.\" For sections 2, 3, and 9 function return values only. -.\" .Sh ENVIRONMENT -.\" For sections 1, 6, 7, and 8 only. -.\" .Sh FILES -.\" .Sh EXIT STATUS -.\" For sections 1, 6, and 8 only. -.\" .Sh EXAMPLES -.\" .Sh DIAGNOSTICS -.\" For sections 1, 4, 6, 7, 8, and 9 printf/stderr messages only. -.\" .Sh ERRORS -.\" For sections 2, 3, 4, and 9 errno settings only. -.\" .Sh SEE ALSO -.\" .Xr foobar 1 -.\" .Sh STANDARDS -.\" .Sh HISTORY -. -. -.Sh AUTHORS -. -.An Josuah Demangeon -.Aq Mt mail@josuah.net -. -. -.\" .Sh CAVEATS -.\" .Sh BUGS -EOF - ;; -(*) echo 'usage: mdoc {dd,db,start}' - ;; -esac diff --git a/bin/remap/o b/bin/remap/o diff --git a/bin/remap/xdg-open b/bin/remap/xdg-open diff --git a/bin/service/service-disable b/bin/service/service-disable @@ -0,0 +1,10 @@ +#!/usr/bin/env execlineb +importas 1 1 + +if { mkdir -p /etc/s6rc/ok-all } +if { touch /etc/s6rc/ok-all/content } +if { + pipeline { grep -Fv $1 /etc/s6rc/ok } + sort -u -o /etc/s6rc/ok-all/content - +} + diff --git a/bin/service/service-enable b/bin/service/service-enable @@ -0,0 +1,8 @@ +#!/usr/bin/env execlineb +importas 1 1 + +cd /etc/s6/ +if { + pipeline { ls -d $1 } + sort -u -o /etc/s6/ok-all/content /etc/s6/ok-all/content - +} diff --git a/bin/service/service-init b/bin/service/service-init @@ -0,0 +1,27 @@ +#!/usr/bin/env execlineb + +if { s6-rmrf /run/s6 /var/s6/init } +if { s6-mkdir -p /run/s6 /var/s6 /var/log } +if { s6-ln -sf /var/s6/s6-logger /run/s6 } + +background { + # wait until s6-svscan starts + redirfd -w 1 /var/s6/s6-logger/fifo + + s6-setsid -- + fdmove -c 1 2 + + backtick -n t { s6-clock } + importas t t + if { s6-rc-compile /var/s6/compiled${t} /etc/s6 } + if { s6-rc-init -c /var/s6/compiled${t} -l /var/s6/live /run/s6 } + if { s6-ln -nsf /var/s6/compiled${t} /var/s6/compiled } + if { s6-rc -l /var/s6/live change -u ok-all } + if { echo ok } +} + +cd /var/s6 +redirfd -r 0 /dev/null +redirfd -wnb 1 /var/s6/s6-logger/fifo +fdmove -c 2 1 +s6-svscan -t0 /run/s6 diff --git a/bin/service/service-load b/bin/service/service-load @@ -0,0 +1,7 @@ +#!/usr/bin/env execlineb + +backtick t { s6-clock } importas -n t t +if { s6-rc-compile /var/s6/compiled$t /etc/s6 } +if { s6-rc-update -l /var/s6/live /var/s6/compiled$t } +if { s6-ln -nsf /var/s6/compiled$t /var/s6/compiled } +if { s6-rc -l /var/s6/live change -u ok-all } diff --git a/bin/service/service-reload b/bin/service/service-reload @@ -0,0 +1,4 @@ +#!/usr/bin/env execlineb +importas 1 1 + +s6-svc -h /run/s6/$1 diff --git a/bin/service/service-restart b/bin/service/service-restart @@ -0,0 +1,5 @@ +#!/usr/bin/env execlineb +importas 1 1 + +if { service-stop $1 } +if { service-start $1 } diff --git a/bin/service/service-shutdown b/bin/service/service-shutdown @@ -0,0 +1,3 @@ +#!/usr/bin/env execlineb + +s6-rc -l /var/s6/live change -d -a diff --git a/bin/service/service-start b/bin/service/service-start @@ -0,0 +1,4 @@ +#!/usr/bin/env execlineb +importas 1 1 + +s6-rc -l /var/s6/live change -u $1 diff --git a/bin/service/service-status b/bin/service/service-status @@ -0,0 +1,3 @@ +#!/usr/bin/env execlineb + +dollarat s6-rc -l /var/s6/live listall diff --git a/bin/service/service-stop b/bin/service/service-stop @@ -0,0 +1,4 @@ +#!/usr/bin/env execlineb +importas 1 1 + +s6-rc -l /var/s6/live change -d $1 diff --git a/conf-profile b/conf-profile @@ -0,0 +1,5 @@ +#!/bin/sh -e + +cd "$(dirname "$0")" +cp profile /etc +cp -r profile.d /etc diff --git a/conf-s6 b/conf-s6 @@ -1,10 +1,10 @@ -#!/bin/sh -ex -# install configuration files with symlinks and clone bin +#!/usr/bin/env execlineb +importas 0 0 -cd "$(dirname "$0")" -mkdir -p /etc/s6 /var/s6 /run/s6 -cp -RLf s6/s6-logger /var/s6 -cp -RLf s6/ok-all /etc/s6 -rm -rf /var/s6/s6-logger/fifo -mkfifo /var/s6/s6-logger/fifo -test -d /etc/s6/ok-all || cp -r s6/ok-all +backtick x { dirname $0 } importas -n x x cd $x +if { mkdir -p /etc/s6 /var/s6 /run/s6 } +if { cp -RLf s6/s6-logger /var/s6 } +if { cp -RLf s6/ok-all /etc/s6 } +if { rm -rf /var/s6/s6-logger/fifo } +if { mkfifo /var/s6/s6-logger/fifo } +if -n { test -d /etc/s6/ok-all } cp -r s6/ok-all /etc/s6 diff --git a/dot/profile b/dot/profile @@ -1,34 +0,0 @@ -## basic ## - -export TZ=Europe/Paris -export EMAIL=mail@josuah.net -export EDITOR=ex -export VISUAL=ex -export PAGER=less -export ENV=$HOME/.profile - -## locales ## - -export LANG=en_US.UTF-8 -export LC_COLLATE=C -export LC_CTYPE=en_US.UTF-8 -export LC_MONETARY=en_US.UTF-8 -export LC_MESSAGES=en_US.UTF-8 -export LC_NUMERIC=en_US.UTF-8 -export LC_TIME=en_US.UTF-8 - -## paths ## - -export PXPATH=/var/px -export GOPATH=$HOME/go -export MANPATH=/usr/man:/usr/share/man:/usr/local/man:/usr/local/share/man -export MANPATH=$PXPATH/man:$MANPATH -export PATH=$HOME/.local/bin:$GOPATH/bin:$PXPATH/bin:$PATH - -## programs ## - -export CVSROOT=anoncvs@anoncvs.fr.openbsd.org:/cvs -export SSH_AUTH_SOCK=$HOME/.ssh/agent -export ENV=$HOME/.bashrc -export LESS=-SR -export OPEN="$HOME/dot/open" diff --git a/profile b/profile @@ -0,0 +1,13 @@ +# I would /really/ prefer having only /bin and end of the story. But many +# systems just like to split /bin over and over because NFS roots or split +# hierarchies with /usr mounted afterward. +# +# So in the meantime that mounting all the "bin" directories to /bin +# gets a common practice, I will keep this rather complex $PATH. +export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/local/bin:/l + +umask 022 + +for f in /etc/profile.d/*.sh; do + . "$f" +done diff --git a/profile.d/go.sh b/profile.d/go.sh @@ -0,0 +1,2 @@ +export GOPATH=/usr/go +export PATH=$GOPATH/bin:$PATH diff --git a/profile.d/locale.sh b/profile.d/locale.sh @@ -0,0 +1,8 @@ +export LANG=en_US.UTF-8 +export LC_COLLATE=C +export LC_CTYPE=en_US.UTF-8 +export LC_MONETARY=en_US.UTF-8 +export LC_MESSAGES=en_US.UTF-8 +export LC_NUMERIC=en_US.UTF-8 +export LC_TIME=en_US.UTF-8 +export TZ=Europe/Paris diff --git a/profile.d/man.sh b/profile.d/man.sh @@ -0,0 +1 @@ +export MANPATH=/man:/usr/man:/usr/share/man:/usr/local/man:/usr/local/share/man diff --git a/profile.d/openbsd.sh b/profile.d/openbsd.sh @@ -0,0 +1 @@ +export CVSROOT=anoncvs@anoncvs.fr.openbsd.org:/cvs diff --git a/profile.d/pack.sh b/profile.d/pack.sh @@ -0,0 +1,3 @@ +export PACK=/var/px +export MANPATH=$PACK/man:$MANPATH +export PATH=$PACK/bin:$PATH diff --git a/profile.d/plan9.sh b/profile.d/plan9.sh @@ -0,0 +1,2 @@ +export PLAN9=/usr/lib/plan9 +export PATH=$PATH:$PLAN9/bin diff --git a/profile.d/prompt.sh b/profile.d/prompt.sh @@ -0,0 +1,28 @@ +case "$0" in +(*zsh) + export vt_red='${red}' + export vt_green='${green}' + export vt_bold='${bold}' + export vt_norm='${norm}' + ;; +(*bash) + export vt_red=$(printf '\\[\033[31m\\]') + export vt_green=$(printf '\\[\033[32m\\]') + export vt_bold=$(printf '\\[\033[1m\\]') + export vt_norm=$(printf '\\[\033[m\\]') + ;; +(*) + export vt_red=$(printf '\033[31m') + export vt_green=$(printf '\033[32m') + export vt_bold=$(printf '\033[1m') + export vt_norm=$(printf '\033[m') + ;; +esac + +PS1= +PS1=$PS1$vt_bold$(uname -n)$vt_norm +PS1=$PS1'$PWD' +PS1=$PS1$vt_bold$(test $? = 0 && echo "$vt_green" || echo "$vt_red") +PS1=$PS1'$(test "$(whoami)" = root && echo "# " || echo "\$ ")'$vt_norm + +export PS1 diff --git a/profile.d/ssh.sh b/profile.d/ssh.sh @@ -0,0 +1 @@ +export SSH_AUTH_SOCK=$HOME/.ssh/agent diff --git a/profile.d/umask.sh b/profile.d/umask.sh @@ -0,0 +1 @@ +umask 0022 diff --git a/s6-init b/s6-init @@ -1,27 +0,0 @@ -#!/usr/bin/env execlineb - -if { s6-rmrf /run/s6 /var/s6/init } -if { s6-mkdir -p /run/s6 /var/s6 /var/log } -if { s6-ln -sf /var/s6/s6-logger /run/s6 } - -background { - # wait until s6-svscan starts - redirfd -w 1 /var/s6/s6-logger/fifo - - s6-setsid -- - fdmove -c 1 2 - - backtick -n t { s6-clock } - importas t t - if { s6-rc-compile /var/s6/compiled${t} /etc/s6 } - if { s6-rc-init -c /var/s6/compiled${t} -l /var/s6/live /run/s6 } - if { s6-ln -nsf /var/s6/compiled${t} /var/s6/compiled } - if { s6-rc -l /var/s6/live -u change ok-all } - if { echo ok } -} - -cd /var/s6 -redirfd -r 0 /dev/null -redirfd -wnb 1 /var/s6/s6-logger/fifo -fdmove -c 2 1 -s6-svscan -t0 /run/s6 diff --git a/s6-load b/s6-load @@ -1,7 +0,0 @@ -#!/usr/bin/env execlineb - -backtick t { s6-clock } importas -n t t -if { s6-rc-compile "/var/s6/compiled$t" /etc/s6 } -if { s6-rc-update -l /var/s6/live "/var/s6/compiled$t" } -if { s6-ln -nsf "/var/s6/compiled$t" /var/s6/compiled } -if { s6-rc -l /var/s6/live -u change ok-all }