dot

packages and services management
Log | Files | Refs | README

commit 7088cbfc84693d1ddfe2273b9b36e1e4295379e4
parent 0ae5b34e3b0f56cc65711d0f3cf10d89bf25e84d
Author: Josuah Demangeon <mail@josuah.net>
Date:   Thu,  5 Apr 2018 01:47:08 +0200

doing u9fs again

Diffstat:
M.profile | 5++---
Mbin/xdg-abduco | 16+++++++---------
Mbin/xdg-open | 42++++++++++++++++++++++--------------------
Mgit/config | 6++++--
Rrun/9pfs/path -> run/9pfs-ssh/path | 0
Rrun/9pfs/run -> run/9pfs-ssh/run | 0
Rrun/9pfs/sock -> run/9pfs-ssh/sock | 0
Arun/u9fs-unix/host | 1+
Arun/u9fs-unix/path | 1+
Arun/u9fs-unix/run | 14++++++++++++++
Arun/u9fs-unix/sock | 2++
Arun/u9fs-unix/user | 1+
Arun/u9fs/pass | 8++++++++
Mrun/u9fs/run | 5++---
14 files changed, 64 insertions(+), 37 deletions(-)

diff --git a/.profile b/.profile @@ -30,7 +30,6 @@ export PATH="$HOME/etc/bin:$PACKROOT/bin:$PATH:$PLAN9/bin" export MANPATH="$HOME/etc/man:/usr/share/man:/usr/local/share/man:$PLAN9/man" export MANPATH="$PACKROOT/share/man:$MANPATH" -export MANPAGER="less" export ABDUCO_CMD="dvtm-status" export ABDUCO_SOCKET_DIR="/tmp" @@ -55,7 +54,7 @@ export SSH_AUTH_SOCK="/tmp/ssh-agent" export SVDIR="$HOME/run" export TERM="screen" -export PS1='$([ $? -gt 0 ] && printf "\\033[31;1mx\\033[m\\n\\r")'"$( +export PS1='$([ $? -gt 0 ] && printf "x\\n\\r")'"$( [ "$(whoami)" = "root" ] && s='#' || s='$' - printf '\033]0;$PWD\a\n%s%s ' "$(uname -n)" "$s" + printf '\n%s%s ' "$(uname -n)" "$s" )" diff --git a/bin/xdg-abduco b/bin/xdg-abduco @@ -15,12 +15,10 @@ touch "$dir/names" grep -e "^$(abduco | sed -rn 's/.* ([0-9]+)$/\1/p') " "$dir/names" | sort -k2 -uo "$dir/names" -for name in "$@"; do continue; done - # get the real path name -[ ! -h "$name" ] || name="$(readlink -f "$name")" -[ ! -e "$name" ] || name="$(cd "$(dirname "$name")"; pwd)/$(basename "$name")" -[ ! -d "$name" ] || name="$name" "$(cd "$name"; pwd)" +[ ! -h "$2" ] || name="$(readlink -f "$name")" +[ ! -e "$2" ] || name="$(cd "$(dirname "$name")"; pwd)/$(basename "$name")" +[ ! -d "$2" ] || name="$name" "$(cd "$name"; pwd)" case "$#" in (0) @@ -29,13 +27,13 @@ case "$#" in (*) printf '\033]0;%s\a' "$2" 1>&2 - hash="$(printf %s "$name" | cksum | cut -d ' ' -f 1)" - printf '%s\t%s\n' "$hash" "$name" >> "$dir/names" + hash="$(printf %s "$2" | cksum | cut -d ' ' -f 1)" + printf '%s\t%s\n' "$hash" "$2" >> "$dir/names" if [ "$ABDUCO" ] then - ABDUCO="$name" abduco -n "$hash" "$@" - printf '"%s" open in the background\n' "$name" + ABDUCO="$2" abduco -n "$hash" "$@" + printf '"%s" open in the background\n' "$2" else ABDUCO="$2" exec abduco -A "$hash" "$@" fi diff --git a/bin/xdg-open b/bin/xdg-open @@ -2,11 +2,6 @@ # open the resource given as argument according to its content -# [scheme://][user[:pass]@]host[:port][/path] -IFS=' ' read scheme user pass host port path << EOF -$(xdg-uri "$1") -EOF - case "$(tty)" in (/dev/pts/*|/dev/ttyp*) ;; @@ -15,6 +10,13 @@ case "$(tty)" in ;; esac +[ "$ABDUCO" ] || exec xdg-abduco "$0" "$@" + +# [scheme://][user[:pass]@]host[:port][/path] +IFS=' ' read scheme user pass host port path << EOF +$(xdg-uri "$1") +EOF + case "$host" in (*.onion) [ "$TOR" ] || TOR="$1" exec torsocks "$0" "$1" @@ -52,7 +54,7 @@ esac case "$1" in (rfc://*) - exec xdg-abduco rfc "$host" + exec rfc "$host" ;; (git://*) user="" @@ -63,7 +65,7 @@ case "$1" in esac mkdir -p "$HOME/git/$host/$user" cd "$HOME/git/$host/$user" - exec xdg-abduco git clone "$1" + exec git clone "$1" ;; (9p://*) dir="$HOME/var/9p/$host" @@ -74,14 +76,14 @@ case "$1" in if [ "$file" ] then mkdir "$(dirname "$file")" - xdg-abduco curl -o "$file" "$1" + curl -o "$file" "$1" exec "$0" "$file" else - exec xdg-abduco ftp "$1" + exec ftp "$1" fi ;; (gopher://*) - exec xdg-abduco sacc "$1" + exec sacc "$1" ;; (http://*|https://*) case "$host" in @@ -100,7 +102,7 @@ case "$1" in exec "$0" "$file" ;; (tools.ietf.org) - exec xdg-abduco rfc "$1" + exec rfc "$1" ;; (*) if [ "$file" ] @@ -122,20 +124,20 @@ case "$1" in printf '/j #%s\n' "$path" > "$HOME/var/irc/$host/in" ;; (news://*) - exec xdg-abduco links "$1" + exec links "$1" ;; (sftp://*) [ "$port" = . ] && port='22' - exec xdg-abduco sftp -P "$port" "$host" + exec sftp -P "$port" "$host" ;; (ssh://*) [ "$port" = . ] && port="" || port="-p $port" [ "$user" = . ] && user="" || user="$user@" [ "$pass" = . ] && pass="" || pass="$" - exec xdg-abduco ssh $port "$user$host" + exec ssh $port "$user$host" ;; (telnet://*) - exec xdg-abduco telnet "$port" "$host" + exec telnet "$port" "$host" ;; (*://*) exec printf 'unsupported protocol\n' 1>&2 @@ -159,16 +161,16 @@ case "$1" in exec ffplay -loop 0 "$1" ;; (*.opus|*.mp3|*.flac|*.ogg|*.vorbis|*.wav|*.webm|*.mp4|*.mkv|*.ogv|*.avi) - exec xdg-abduco ffplay "$1" + exec ffplay "$1" ;; (*/music/*) - xdg-abduco playdir "$1" + exec playdir "$1" ;; (*.[0-9]|*.[0-9]p|*.[0-9].gz) - exec xdg-abduco mandoc -a -T utf8 "$1" + exec mandoc -a -T utf8 "$1" ;; (*.o|*.a) - exec xdg-abduco objdump -D "$1" + exec objdump -D "$1" ;; (*.html) exec firefox "$1" @@ -216,7 +218,7 @@ case "$1" in exec ar vx "$1" ;; (*) - [ -f "$1" ] && exec xdg-abduco $EDITOR "$1" + [ -f "$1" ] && exec $EDITOR "$1" [ -d "$1" ] && cd "$1" && exec "$SHELL" ;; esac diff --git a/git/config b/git/config @@ -5,9 +5,8 @@ [alias] dog = log --all --graph --decorate --branches --date=short --oneline stat = log --all --graph --decorate --branches --stat - poule = pull s = status -s --branch - count = !expr $(git diff | grep ^+ | wc -l) - \ + count = !expr $(git diff | grep ^+ | wc -l) - \ $(git diff | grep ^- | wc -l) [core] @@ -15,3 +14,6 @@ [push] default = simple + +[color] + ui = never diff --git a/run/9pfs/path b/run/9pfs-ssh/path diff --git a/run/9pfs/run b/run/9pfs-ssh/run diff --git a/run/9pfs/sock b/run/9pfs-ssh/sock diff --git a/run/u9fs-unix/host b/run/u9fs-unix/host @@ -0,0 +1 @@ +nas.josuah.net diff --git a/run/u9fs-unix/path b/run/u9fs-unix/path @@ -0,0 +1 @@ +lib diff --git a/run/u9fs-unix/run b/run/u9fs-unix/run @@ -0,0 +1,14 @@ +#!/bin/sh -e + +# forward u9fs from a remote host to a local socket through ssh + +exec 2>&1 + +IFS='' read -r host <host +IFS='' read -r user <user +IFS='' read -r path <path + +exec unixserver -v /tmp/u9fs ssh "$user@$host" '. ./.profile;' u9fs \ + -a none \ + -u "$user" \ + "'$path'" diff --git a/run/u9fs-unix/sock b/run/u9fs-unix/sock @@ -0,0 +1 @@ +/tmp/u9fs+ \ No newline at end of file diff --git a/run/u9fs-unix/user b/run/u9fs-unix/user @@ -0,0 +1 @@ +josuah diff --git a/run/u9fs/pass b/run/u9fs/pass @@ -0,0 +1,7 @@ +#!/bin/sh -e + +stty -echo +sed q > key +stty echo + +chmod 600 key+ \ No newline at end of file diff --git a/run/u9fs/run b/run/u9fs/run @@ -2,16 +2,15 @@ # forward u9fs from a remote host to a local socket through ssh -socket="/tmp/9pfs" mountp="$HOME/var/9p" exec 2>&1 -IFS='' read -r host <host IFS='' read -r user <user IFS='' read -r path <path -exec unixserver -v /tmp/u9fs ssh "$user@$host" '. ./.profile;' u9fs \ +exec tcpserver 0.0.0.0 564 u9fs \ -a none \ + -A key \ -u "$user" \ "'$path'"