dot

packages and services management
Log | Files | Refs | README

commit 01b78e099abd9fa1426409e0f2d355455a18cd35
parent ecb8dffd4272316a1658fcff24a6761fe06ea908
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sun,  8 Apr 2018 12:38:20 +0200

add a temporary gopherd

Diffstat:
Mbin/agenda | 4++--
Mbin/git-mirror | 13+------------
Mconfigure | 11+++++++----
Agit/repos | 14++++++++++++++
Arun/gopher/gopherd | 16++++++++++++++++
Arun/gopher/run | 9+++++++++
6 files changed, 49 insertions(+), 18 deletions(-)

diff --git a/bin/agenda b/bin/agenda @@ -148,13 +148,13 @@ function view_one_line(last, line, off) { b_h_m = substr(beg, 12); e_h_m = substr(end, 12); printf("%s\n%2s %2s %s\n%2s %2s [%s] %s\n", - (b_mth != last["mth"]) ? ("\n[" b_mth "]\n") : "", + (b_mth != last["mth"]) ? ("\n[" b_mth "]\n") : (""), (b_day != last["day"]) ? (b_day) : (""), b_h_m, line["S"], (b_day != e_day) ? (e_day) : (""), e_h_m, line["C"], line["L"]); str = line["D"] " "; while ((l = substr(str, 1, 66)) != "") { sub(" +[^ ]*$", "", l); - printf(" | %s\n", l); + printf(" %s\n", l); str = substr(str, length(l) + 1); sub("^ *", "", str); } diff --git a/bin/git-mirror b/bin/git-mirror @@ -1,17 +1,6 @@ #!/bin/sh -e -host="$1" - -: ${host:?} - mkdir -p "$HOME/var/git" cd "$HOME/var/git" -while read -r repo -do - git clone --separate-git-dir="$HOME/var/$repo.git" \ - "$host/$repo.git" "$HOME/git/$host/$repo.git" - mkdir -p "$HOME/git/$host - cd "$HOME/git/$host/$repo" - git init -done +xargs -n 1 git clone --bare "$repo" < "$HOME/.config/git/repos" diff --git a/configure b/configure @@ -1,9 +1,12 @@ #!/bin/sh -e cd "${0%/*}" -. ./.profile # for $SVDIR -mkdir -p "$HOME/var" "$SVDIR" "$HOME/.config/enchive" +mkdir -p "$HOME/run" + +mkdir -p "$HOME/.config/enchive" +ln -fs /mnt/key/enchive.pub "$HOME/.config/enchive/enchive.pub" +ln -fs /mnt/key/enchive.sec "$HOME/.config/enchive/enchive.sec" mkdir='mkdir -p "$0/$1";:' symln='ln -sf "$PWD/$1" "$0/$1";:' @@ -24,5 +27,5 @@ find .[!.]* \ -type f -exec sh -c "$symln" "$HOME" {} \; -o \ -type l -exec sh -c "$symln" "$HOME" {} \; -ln -fs /mnt/key/enchive.pub "$HOME/.config/enchive/enchive.pub" -ln -fs /mnt/key/enchive.sec "$HOME/.config/enchive/enchive.sec" +mkdir -p "$HOME/var/git" +(cd "$HOME/var/git" && xargs -n 1 git clone --bare) <git/repos diff --git a/git/repos b/git/repos @@ -0,0 +1,14 @@ +git://josuah.net/fungus-pathogen.git +git://josuah.net/drawille-el.git +git://josuah.net/alphabet.git +git://josuah.net/miniwi.git +git://josuah.net/iomenu.git +git://josuah.net/ff2txt.git +git://josuah.net/ploot.git +git://josuah.net/util.git +git://josuah.net/josuah.net.git +git://josuah.net/atelier-fu.fr.git +git://josuah.net/cyberia.systems.git +git://josuah.net/etc.git +git://josuah.net/eel.git +git://josuah.net/cgr.git diff --git a/run/gopher/gopherd b/run/gopher/gopherd @@ -0,0 +1,16 @@ +#!/bin/sh + +# usage: gopherd <host> <path> + +cd "$2" || exit + +IFS=' ' read -r path query + +[ -f "./$path" ] && exec cat "./$path" +[ -f "./$path/gophermap" ] && exec cat "./$path/gophermap" +[ -d "./$path" ] && ls "./$path" | + while IFS='' read -r p + do + [ -d "./$path/$p" ] && t=1 || t=0 + printf '%s%s\t%s\t%s\t%s\n' "$t" "$p" "$path/$p" "$1" 70 + done diff --git a/run/gopher/run b/run/gopher/run @@ -0,0 +1,9 @@ +#!/bin/sh -e + + +exec 2>&1 + +IFS='' read -r host <host +IFS='' read -r path <path + +exec tcpserver 0.0.0.0 70 ./gopherd "$host" "$path"