dot

packages and services management
Log | Files | Refs | README

commit 5c2ffe5d72055968bdd0c8122fc627439fc177fa
parent 011721492a52e77eaa4f68372fe9c58ce2808542
Author: Josuah Demangeon <josuah.demangeon@gandi.net>
Date:   Mon, 21 Aug 2017 15:50:00 +0200

adapted scripts to newer io

Diffstat:
Miomenu/bin/io | 11++++-------
Miomenu/bin/io-cache | 7++-----
Mpkg/bin/pkg-service | 24++++++++++++------------
Mvim/.vimrc | 4+++-
4 files changed, 21 insertions(+), 25 deletions(-)

diff --git a/iomenu/bin/io b/iomenu/bin/io @@ -5,16 +5,14 @@ export LC_COLLATE=C mkdir -p "$HOME/.abduco" touch "$HOME/.abduco/names" - -# update sessions list +# --- update sessions list ----------------------------------------------------- [ "$(abduco | wc -l | tr -cd 0-9)" = 1 ] && rm "$HOME/.abduco/names" || grep -F -e "$( abduco | awk -F '\t' 'NR > 1 { print $3 " " }' )" "$HOME/.abduco/names" | sort -uk 2,2 -o "$HOME/.abduco/names" - -# build arguments +# build arguments -------------------------------------------------------------- if [ $# -gt 0 ] then @@ -23,7 +21,7 @@ else selection=$({ cut -d ' ' -f 3- "$HOME/.abduco/names" cat "$ROOT/var/cache/io" - } | iomenu -p io -s -h | sed 's/# //') + } | iomenu -p io -# | sed 's/# //') command=$(printf %s "$selection" | cut -d ' ' -f 1) path=$( printf %s "$selection" | cut -d ' ' -f 2-) @@ -37,8 +35,7 @@ fi hash=$(printf %s "$path" | cksum | cut -d ' ' -f 1) - -# create session or attach to it +# create session or attach to it ----------------------------------------------- printf '%s %s\n' "$hash" "$path" >> "$HOME/.abduco/names" [ "$SSH_TTY" ] && e='^\' || e='^Z' diff --git a/iomenu/bin/io-cache b/iomenu/bin/io-cache @@ -18,10 +18,7 @@ awk -v MAIL="${MAIL%/*}" ' mailv[mailc++] = $0 } - $0 ~ "/[.]git/$" || - $0 ~ "/src/[^/]*/$" && - $0 !~ "/git/.*/src/" && - $0 !~ "/src/.*/src/" { + $0 ~ "/[.]git/$" || $0 ~ "/src/[^/]*/$" { sub("/[.]git/$", "/") searchv[searchc++] = $0 } @@ -30,7 +27,7 @@ awk -v MAIL="${MAIL%/*}" ' musicv[musicc++] = $0 } - $0 ~ ".*\\.[0-9]p?(.gz)?$" { + $0 ~ ".*[.][0-9]p?(.gz)?$" { manv[manc++] = $0 } diff --git a/pkg/bin/pkg-service b/pkg/bin/pkg-service @@ -10,23 +10,23 @@ case "$1" in ;; (stop|status) shift 2 - [ "$srv" ] && [ -d "$ROOT/run/pid/$srv" ] && - for pid in $(ls "$ROOT/run/pid/$srv") + [ "$srv" ] && [ -d "$ROOT/var/pid/$srv" ] && + for pid in $(ls "$ROOT/var/pid/$srv") do for arg in "$@" - do grep -qF "$arg" "$ROOT/run/pid/$srv/$pid" || continue 2 + do grep -qF "$arg" "$ROOT/var/pid/$srv/$pid" || continue 2 done found=1 - if cmp "$ROOT/run/pid/$srv/$pid" "/proc/$pid/cmdline" 2> /dev/null + if cmp "$ROOT/var/pid/$srv/$pid" "/proc/$pid/cmdline" 2> /dev/null then - cmdline="$(tr '\0' ' ' < "$ROOT/run/pid/$srv/$pid")" + cmdline="$(tr '\0' ' ' < "$ROOT/var/pid/$srv/$pid")" if [ "$cmd" = stop ] && kill "$pid" then printf '%-15s [x] %s\n' "$srv" "$cmdline" - rm -f "$ROOT/run/pid/$srv/$pid" + rm -f "$ROOT/var/pid/$srv/$pid" else printf '%-15s [r] %s\n' "$srv" "$cmdline" fi @@ -38,21 +38,21 @@ case "$1" in shift 2 if ! "$0" status "$srv" "$@" then - mkdir -p "$ROOT/run/pid/$srv" + mkdir -p "$ROOT/var/pid/$srv" . "$ROOT/pkg/$srv/run" "$@" >> "$ROOT/var/log/$srv" 2>&1 - if cp "/proc/$PID/cmdline" "$ROOT/run/pid/$srv/$PID" 2> /dev/null + if cp "/proc/$PID/cmdline" "$ROOT/var/pid/$srv/$PID" 2> /dev/null then - cmdline=$(tr '\0' ' ' < "$ROOT/run/pid/$srv/$PID") + cmdline=$(tr '\0' ' ' < "$ROOT/var/pid/$srv/$PID") printf '%-15s [+] %s\n' "$srv" "$cmdline" else - touch "$ROOT/run/pid/$srv/$PID" + touch "$ROOT/var/pid/$srv/$PID" fi fi "$0" status "$srv" ;; (update) - find "$ROOT/run/pid" -type f | while IFS='' read path + find "$ROOT/var/pid" -type f | while IFS='' read path do if ! cmp "$path" "/proc/${path##*/}/cmdline" > /dev/null 2>&1 then @@ -65,7 +65,7 @@ case "$1" in fi done - rmdir "$ROOT/run/pid"/* 2> /dev/null + rmdir "$ROOT/var/pid"/* 2> /dev/null ;; (*) printf '[start <pkg>|stop <pkg>|restart <pkg>|status <pkg>|update]\n' diff --git a/vim/.vimrc b/vim/.vimrc @@ -10,4 +10,6 @@ set incsearch highlight colorcolumn ctermbg=0 ctermfg=1 highlight search ctermbg=3 ctermfg=0 -nmap coh :set hlsearch!<cr> +nmap coh :set hlsearch!<cr>:set hlsearch?<cr> +nmap col :set list !<cr>:set list ?<cr> +nmap col :set paste !<cr>:set paste ?<cr>