dot

packages and services management
Log | Files | Refs | README

commit a371d9369f4f3efc4f1aaa3eb0270ff4cf4960ee
parent ae7675f8dd9f4860abc8332143495922d7fe16c2
Author: Josuah Demangeon <mail@josuah.net>
Date:   Wed, 14 Mar 2018 19:29:33 +0100

lstree is now full awk \o/

Diffstat:
M.profile | 5++---
Mbin/lstree | 51++++++++++++++++++++++++++++-----------------------
Mbin/pack | 15+++++++--------
Mmblaze/profile | 1+
Mpack/build/autotools | 2+-
Mpack/build/gmake | 2+-
Mpack/build/make | 2+-
Apack/redis/build | 13+++++++++++++
8 files changed, 54 insertions(+), 37 deletions(-)

diff --git a/.profile b/.profile @@ -25,9 +25,8 @@ export PLAN9="$PACKROOT/src/plan9" export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/sbin" export PATH="$HOME/etc/bin:$PACKROOT/bin:$PATH:$PLAN9/bin" -export MANPATH="/usr/share/man:/usr/local/share/man" -export MANPATH="$HOME/etc/man:/usr/share/man:/usr/local/man" -export MANPATH="$PACKROOT/share/man:$MANPATH:$PLAN9/man" +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" diff --git a/bin/lstree b/bin/lstree @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/awk -f # list paths in a tree with some stat infos @@ -17,33 +17,38 @@ # -rwxr-xr-x 1 josuah josuah 5430 Feb 17 19:51 | `- xdg-open # -rwxr-xr-x 1 josuah josuah 468 Feb 17 19:55 ... -LC_COLLATE="C" +BEGIN { + LINE = "| "; + NODE = "|- "; + TAIL = "`- "; + VOID = " "; -cd "${1:-.}" + find = "LC_COLLATE='C' find . " \ + "-name '*.git' -prune -o " \ + "-name 'CVS' -prune -o " \ + "-exec ls -ld {} +"; -find . -name '*.git' -prune -o -name CVS -prune -o -exec ls -ld {} + | - awk -v LINE='| ' -v NODE='|- ' -v TAIL='`- ' -v VOID=' ' ' + for (num = 0; find | getline; num++) { + sub(" \\.$", "", $0); + sub(" -> .*", "", $0); + infos = $0; + sub(" \\./.*", "", infos); + sub(".* \\./", "./", $0); -{ - sub(" \\.$", "", $0); - sub(" -> .*", "", $0); - infos = $0; - sub(" \\./.*", "", infos); - sub(".* \\./", "./", $0); + count = split($0, path_v, "/"); + for (i = 2; i <= count; i++) + line_v[num":"i] = LINE; - count = split($0, path_v, "/"); - for (i = 2; i <= count; i++) - line_v[NR":"i] = LINE; - - line_v[NR":"count] = NODE; - line_v[NR":"1] = infos " "; - line_v[NR"name"] = count == 1 ? "." : path_v[count]; -} + line_v[num":"count] = NODE; + line_v[num":"1] = infos " "; + line_v[num"name"] = count == 1 ? "." : path_v[count]; + } + close(find); + num--; -END { for (i = 2; !stop; i++) { stop = tail = 1; - for (l = NR; l > 0; l--) { + for (l = num; l > 0; l--) { if (line_v[l":"i] == LINE && tail) { line_v[l":"i] = VOID; stop = 0; @@ -56,9 +61,9 @@ END { } } - for (l = 1; l <= NR; l++) { + for (l = 1; l <= num; l++) { for (i = 1; line_v[l":"i] != ""; i++) printf("%s", line_v[l":"i]); printf("%s\n", line_v[l"name"]); } -}' | $PAGER +} diff --git a/bin/pack b/bin/pack @@ -11,7 +11,6 @@ mkdir -p "$PACKROOT/src" "$PACKROOT/opt" case "$1" in (tar) [ -d "$SRC" ] && exit 0 || mkdir -p "$SRC" - [ -d "$SRC" ] && exit 0 || mkdir -p "$SRC" IFS="" read -r url < "$PACK/$2/tar" curl -#L "$url" | case "$url" in @@ -20,7 +19,7 @@ case "$1" in (*.txz|*.tar.xz) xz -d - ;; esac | tar -xf - -C "$SRC" || rmdir "$SRC" - find "$SRC" -mindepth 2 -maxdepth 2 -exec mv {} "$SRC" + + find "$SRC" -mindepth 2 -maxdepth 2 -exec mv {} "$SRC" \; rmdir "$SRC"/* 2>/dev/null || true ;; (git) @@ -46,19 +45,19 @@ case "$1" in [ -d "$SRC" ] || "$0" get "$2" cd "$SRC" - mkdir -p "$OPT" + mkdir -p "$PREFIX" exec "$PACK/$2/build" ;; (add) - [ -d "$OPT" ] || "$0" build "$2" || rm -r "$OPT" + [ -d "$PREFIX" ] || "$0" build "$2" || rm -r "$PREFIX" - cd "$OPT" + cd "$PREFIX" exec find * -type d \ - -exec mkdir -p "$PACKROOT/{}" \; -o \ - -exec ln -sf "$OPT/{}" "$PACKROOT/{}" \; + -exec mkdir -p "$PACKROOT/{}" \; -o \ + -exec ln -sf "$PREFIX/{}" "$PACKROOT/{}" \; ;; (del) - rm -rf "$OPT" + rm -rf "$PREFIX" find -L "$PACKROOT" -name opt -prune -o -name src -prune -o \ -type l -exec rm {} + ;; diff --git a/mblaze/profile b/mblaze/profile @@ -1,2 +1,3 @@ Sendmail: msmtp Local-Mailbox: mail@josuah.net +Outbox: /home/josuah/var/mail/INBOX diff --git a/pack/build/autotools b/pack/build/autotools @@ -1,7 +1,7 @@ #!/bin/sh -ex ./configure \ - --prefix="$OPT" \ + --prefix="$PREFIX" \ --sbindir="$OPT/bin" \ --sysconfdir="$HOME/.config" \ --localstatedir="$HOME/var" diff --git a/pack/build/gmake b/pack/build/gmake @@ -10,4 +10,4 @@ case "$(uname)" in esac $make -$make PREFIX="$OPT" install +$make PREFIX="$PREFIX" install diff --git a/pack/build/make b/pack/build/make @@ -1,4 +1,4 @@ #!/bin/sh -ex make -make PREFIX="$OPT" install +make PREFIX="$PREFIX" install diff --git a/pack/redis/build b/pack/redis/build @@ -0,0 +1,13 @@ +#!/bin/sh -ex + +case "$(uname)" in +(Linux) + make="make" + ;; +(*BSD) + make="gmake" + ;; +esac + +$make +$make PREFIX="$PREFIX" install