dot

packages and services management
Log | Files | Refs | README

commit afc3d46baef3f39efe4af417bebcc1bca92c6b3e
parent 592f2e0a1b761227bbebc2716f69c2aa53130fcd
Author: Josuah Demangeon <mail@josuah.net>
Date:   Mon, 30 Jul 2018 00:40:05 +0200

m as a menu

Diffstat:
Mbin/m | 111++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------
Mbin/pack-chroot | 32+++++++++++++++++++++++++-------
Mpack/dwm/build | 1+
Apack/qbe/git | 1+
Apack/qbe/version | 1+
Mpack/spoon/build | 2+-
Apack/spoon/config.mk | 2++
7 files changed, 99 insertions(+), 51 deletions(-)

diff --git a/bin/m b/bin/m @@ -1,47 +1,72 @@ #!/bin/sh -FORMAT='%13F|${E}%c%u%t[%n] %2i %15f %s' +FORMAT='\n%c%4n %i%s\n %t%u %i%D %f' -test $# -eq 0 && exec mscan -f "$FORMAT" +while printf 'mail> ' + read cmd args +do + set -- $args + case "${cmd#-}" in + (h) + mdirs "$HOME/mail" | while read -r dir + do printf '\n %s\n' "$(basename "$dir")" | tr a-z A-Z + printf ' --------------------------------------------------\n' + mlist -t "$dir" | msort -d | mthread | mseq -S | + mscan -f "$FORMAT" + done 2>/dev/null | less + ;; + (p) + mshow "$@" + ;; + (v) + FILE="$(mktemp /tmp/html_mail.XXXXXXXXXXXXXXX)" + mv "$FILE" "${FILE}.html" + FILE="${FILE}.html" + mshow -O $1 $(mshow -t $1 | awk -F ':' '/html/ {print $1 }')> "$FILE" + links "$FILE" + rm "$FILE" + ;; + (s) + mflag -S "$@" + ;; + (d) + mflag -T "$@" + ;; + (r) + mrep "$@" + ;; + (n) + mcom "$@" + ;; + (l) + test "$#" -eq 1 && LIMIT=$1 || LIMIT=10 + mdirs "$HOME/mail" | mlist | msort -d | mthread | tail -n $LIMIT | mseq -S | + mscan -f "$FORMAT" + ;; + (u) + mbsync -aq + exec "$0" scan + ;; -case "$1" in -(update) - mbsync -aq - exec "$0" scan - ;; -(scan) - mdirs "$HOME/mail" | grep -vE "(RSS| )" | mlist -st | - msort -d | mthread | mseq -S | - mscan -f "$FORMAT" - ;; -(vu) - shift - mflag -S "$@" - ;; -(rm) - shift - mflag -T "$@" - ;; -(rep) - shift - mrep "$@" - ;; -(last) - shift - test "$#" -eq 1 && LIMIT=$1 || LIMIT=10 - mdirs "$HOME/mail" | mlist | msort -d | mthread | tail -n $LIMIT | mseq -S | - mscan -f "$FORMAT" - ;; -(html) - shift - FILE="$(mktemp /tmp/html_mail.XXXXXXXXXXXXXXX)" - mv "$FILE" "${FILE}.html" - FILE="${FILE}.html" - mshow -O $1 $(mshow -t $1 | awk -F ':' '/html/ {print $1 }')> "$FILE" - w3m "$FILE" - rm "$FILE" - ;; -(*) - mless "$@" - ;; -esac + (m) + printf ' +\033[1m Display mail \033[m + h summarize the headers of the mail in a list + p print the current or specified mail + t print the current or specified mail as a thread + v view the html version with links + l print 10 or as specified lasts mails + +\033[1m Exchange mail\033[m + n write a new mail + r reply to current or specified mail + u update the local mail from the server + +\033[1m Edit and move\033[m + s mark mail as seen + d mark mail as deleted + f filter mails again + +' ;; + esac +done diff --git a/bin/pack-chroot b/bin/pack-chroot @@ -1,23 +1,41 @@ #!/bin/sh -e -pack add busybox -pack add dash - +# +# New empty directory tree +# +! umount -R /mnt/pack rm -rf /mnt/pack mkdir -p /mnt/pack cd /mnt/pack -mkdir -p etc/pack bin dev #sys proc +mkdir -p etc/pack bin dev +# +# Resources used for bootstraping +# +pack add busybox +pack add dash +CC="$(readlink -f "$(command -v cc)")" +cp "$CC" bin/"$(basename "$CC")" +ln -s "$(basename "$CC")" bin/cc + +# +# Tools used +# cp -r /etc/pack/* etc/pack cp -r /opt/dash/cur/* . ln -s dash bin/sh cp /opt/busybox/cur/bin/busybox bin cp "$(which pack)" bin + +# +# Minimal config +# echo root:x:0:0:root:/root:/bin/bash >etc/passwd echo nameserver 87.98.175.85 >etc/resolv.conf +# +# Mount, start, stop, unmount +# mount -t devtmpfs devtmpfs dev - PATH=/bin chroot /mnt/pack /bin/sh -c '/bin/busybox --install -s /bin && exec ash' - -umount /mnt/pack/dev +umount -R /mnt/pack/dev diff --git a/pack/dwm/build b/pack/dwm/build @@ -1,4 +1,5 @@ #!/bin/sh -ex +ln -sf /usr/include/freetype2/* /usr/include/ cp "$PACK/config.h" "$PACK/config.mk" . make "PREFIX=$PREFIX" install diff --git a/pack/qbe/git b/pack/qbe/git @@ -0,0 +1 @@ +git://c9x.me/qbe.git diff --git a/pack/qbe/version b/pack/qbe/version @@ -0,0 +1 @@ +git diff --git a/pack/spoon/build b/pack/spoon/build @@ -1,6 +1,6 @@ #!/bin/sh -ex -cp "$PACK/config.h" . +cp "$PACK/config.mk" "$PACK/config.h" . ./configure sed -r '/mpd/ s,^[^#],#,' Makefile >sed mv sed Makefile diff --git a/pack/spoon/config.mk b/pack/spoon/config.mk @@ -0,0 +1,2 @@ +UNAME = Linux +CFLAGS = -I/opt/libalsa/cur/include