dot

packages and services management
Log | Files | Refs | README

commit 3a263e01d24755d3a31feae06113c39674174b1a
parent 2e93d8cf767317465731af7619bd9dd6221e6a14
Author: josuah <mail@josuah.net>
Date:   Thu, 22 Dec 2016 16:20:24 +0000

Fixed scripts again

Diffstat:
M.config/abduco/config.h | 2+-
M.local/bin/agenda | 1+
M.local/bin/build | 42+++++++++++++++++++++---------------------
M.local/bin/lightsaber | 2++
M.local/bin/status | 24++++++++++++------------
M.local/bin/www | 17+++++++++--------
M.local/share/build/iomenu | 3+--
M.profile | 55++++++++++++++++++++++++++++---------------------------
8 files changed, 75 insertions(+), 71 deletions(-)

diff --git a/.config/abduco/config.h b/.config/abduco/config.h @@ -6,7 +6,7 @@ static char KEY_DETACH = CTRL('\\'); /* redraw key to send a SIGWINCH signal to underlying process * (set to 0 to disable the redraw key) */ -static char KEY_REDRAW = CTRL('L'); +static char KEY_REDRAW = 0; /* Where to place the "abduco" directory storing all session socket files. * The first directory to succeed is used. */ diff --git a/.local/bin/agenda b/.local/bin/agenda @@ -37,6 +37,7 @@ FILES awk_ical=' BEGIN { + RS = ""; FS = ":"; } diff --git a/.local/bin/build b/.local/bin/build @@ -17,7 +17,7 @@ then usage() -( +{ printf '%s\n' "\ Usage: ${0##*/} COMMAND PACKAGE @@ -29,38 +29,38 @@ l[inks] Update links from ~${PROGRAMS#$HOME} to ~${LOCAL#$HOME} v[iew] View the list of available packages" exit 0 -) +} view() -( +{ find -L "$LOCAL/share/build" -type f | while IFS='' read -r f do read -r comment description < "$f" printf ' %-12s %s\n' "${f#$LOCAL/share/build/}" "$description" done | sort | more exit 0 -) +} error() -( +{ printf '\033[1;31merror\033[0;1m %-12s\033[m %s\n' "$1" "$2" 1>&2 exit 1 -) +} info() -( +{ printf '\033[1;36minfo\033[0;1m %-12s\033[m %s\n' "$1" "$2" 1>&2 -) +} # # Default build function, to be overriden in the build recipes scripts # build() -( +{ find "$CONFIG/$1" -name '*.diff' -exec patch -N -p 1 -i {} \; for file in "$CONFIG/$1/config.mk" "$CONFIG/$1/config.h" @@ -72,12 +72,12 @@ build() [ -f ./configure ] && ./configure --prefix="$PREFIX" make && make PREFIX="$PREFIX" install clean -) +} compile() -( - name="$1" tar="$2" +{ + name="$1" PREFIX="$PROGRAMS/$name" script="$LOCAL/share/build/$name" export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 @@ -92,11 +92,11 @@ compile() cd "$PREFIX" && mkdir -p bin doc etc include lib libexec share man cd src && build "$name" cd "$PREFIX" && rmdir -p ./* 2> /dev/null -) +} download() -( +{ name="$1" tar="$2" script="$LOCAL/share/build/$name" [ -d "$PROGRAMS/$name/src" ] && error "$name" "already in $PROGRAMS" @@ -117,29 +117,29 @@ download() wget -O - "$tar" | tar -xv"$opt" -f - -C "$PROGRAMS/$name" 1> /dev/null mv "$PROGRAMS/$name/"* "$PROGRAMS/$name/src" -) +} remove() -( +{ info "$1" "removing" rm -rf "${PROGRAMS:?}/$1" -) +} index() -( +{ name="$1" info "$name" "updating index in ~${LOCAL#$HOME}" cd "$PROGRAMS/$name" || exit 1 find . -type d ! -path "*/src/*" -exec mkdir -p "$LOCAL/{}" \; find . ! -type d ! -path "*/src/*" -exec ln -sf "$PWD/{}" "$LOCAL/{}" \; -) +} main() -( +{ mkdir -p "$PROGRAMS" case "$1" in @@ -177,7 +177,7 @@ main() info '' "removing broken links from ~${LOCAL#$HOME}" find -L "$LOCAL" -type l -exec rm {} \; -) +} main "$@" diff --git a/.local/bin/lightsaber b/.local/bin/lightsaber @@ -2,6 +2,7 @@ # Thank you to jansen.price@gmail.com for the original idea. + help() { printf 'Usage: %s COLOR WIDTH @@ -76,6 +77,7 @@ wait_button() print_handle '-' } + blink_blade() { local color="$1" length="$2" diff --git a/.local/bin/status b/.local/bin/status @@ -10,7 +10,7 @@ STOP=' ' # Maildir format, just file count in "$MAIL/new" # status_mail() -( +{ if [ -d "$MAIL/new" ] then mail="$(find "$MAIL/new" -type f | wc -l)" @@ -19,32 +19,32 @@ status_mail() printf %s "$mail" fi -) +} status_abduco() -( +{ buffers="$(($(abduco | wc -l) - 1))" [ "$buffers" -gt 0 ] && printf '[%s]' "$buffers" -) +} status_date() -( +{ date +'%Y-%m-%d %H:%M' -) +} status_cpu() -( +{ read -r latest_1 latest_5 latest_15 trailing < /proc/loadavg printf '%s %s %s' "$latest_1" "$latest_5" "$latest_15" -) +} status_battery() -( +{ battery="$( find -L /sys/class/power_supply -maxdepth 2 -name capacity \ 2> /dev/null @@ -55,11 +55,11 @@ status_battery() IFS='' read -r battery < "$battery" printf '%d%%' "$battery" fi -) +} main() -( +{ printf %s "$START" while [ "$#" -gt 0 ] do @@ -71,7 +71,7 @@ main() shift done printf '%s\n' "$STOP" -) +} [ $# -gt 0 ] && main "$@" || main mail abduco cpu battery date diff --git a/.local/bin/www b/.local/bin/www @@ -5,7 +5,7 @@ LAYOUT="layout.html" parse() -( +{ item="$1" input="$2" # print the input up to the next keyword, and shift position in input @@ -19,6 +19,7 @@ parse() # execute the keyword action and print its output case "${input%%\}\}*}" in + *content* ) [ -f "$item/index.txt" ] && cat "$item/index.txt" ;; @@ -46,14 +47,14 @@ parse() esac parse "$item" "${input#*\}\}}" -) +} # # HTML list of the current directory content. # list() -( +{ dir="$1" printf '<ul>\n' @@ -66,22 +67,22 @@ list() ) printf '</ul>' -) +} # # HTML line of relative links to first level directory # nav() -( +{ find . -mindepth 1 -maxdepth 1 -type d ! -path '*/.*' | sort | sed -r 's_..(.*)_| <a href="{{ root }}/\1">\1</a>_' -) +} main() -( +{ if [ ! -f layout.html ] then printf '%s: no "%s" file in "%s"\n' "${0##*/}" "$LAYOUT" "$PWD" @@ -93,7 +94,7 @@ main() do parse "${d#./}" "$(cat "$LAYOUT")" > "$d/index.html" done -) +} main "$@" diff --git a/.local/share/build/iomenu b/.local/share/build/iomenu @@ -1,4 +1,3 @@ # Input/Output interactive menu and completion engine. -tar=http://repo.or.cz/iomenu.git/snapshot/0a71e514ca5fc5bdf94ca0721cc946bbfc7732e6.tar.gz - +tar=http://repo.or.cz/iomenu.git/snapshot/cb518c1501b1f112242668896d7932dbeb4ed52d.tar.gz diff --git a/.profile b/.profile @@ -15,26 +15,26 @@ . ~/.local/bin/build -export ENV="$HOME/.profile" +export ENV="$HOME/.profile" # mail -export NAME='Josuah Demangeon' -export EMAIL='mail@josuah.net' -export MAIL="$HOME/mail/INBOX" +export NAME='Josuah Demangeon' +export EMAIL='mail@josuah.net' +export MAIL="$HOME/mail/INBOX" # default commands -export EDITOR="vim" -export VISUAL="$EDITOR" -export FCEDIT="$EDITOR" -export PAGER="less" -export MANPAGER="$PAGER" -export DVTM_EDITOR="$PAGER" +export EDITOR="vim" +export VISUAL="$EDITOR" +export FCEDIT="$EDITOR" +export PAGER="less" +export MANPAGER="$PAGER" +export DVTM_EDITOR="$PAGER" # xdg base directory -export XDG_DATA_HOME="$HOME/.local/share" -export XDG_CONFIG_HOME="$HOME/.config" -export XDG_CACHE_HOME="$HOME/.cache" -export XDG_RUNTIME_DIR="$HOME/.cache" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_CACHE_HOME="$HOME/.cache" +export XDG_RUNTIME_DIR="$HOME/.cache" # prompt export PS1='$( @@ -62,23 +62,24 @@ export PS3=' > ' #_______________________________________________________________________________ # coreutils -alias l='ls -lh --color' -alias la='ls -Alh --color' -alias cl='printf "\033[H\033[2J"' -alias bh='busybox --help' +alias l='ls -lh --color' +alias la='ls -Alh --color' +alias cl='printf "\033[H\033[2J"' +alias bh='busybox --help' # iomenu -alias a='io-abduco' -alias r='io-run' -alias g='io-grep' -alias v='io-files' -alias m='io-man' -alias f='find ! -path "*/.git/*" -type f | iomenu' -alias d='find ! -path "*/.git/*" -type d | iomenu' -alias c='cd "$(d)"' +alias a='io-abduco' +alias r='io-run' +alias g='io-grep' +alias v='io-files' +alias m='io-man' +alias i='io-ii' +alias f='find ! -path "*/.git/*" -type f | iomenu' +alias d='find ! -path "*/.git/*" -type d | iomenu' +alias c='cd "$(d)"' # tmux -alias t='tmux attach &>/dev/null || tmux new' +alias t='tmux attach &>/dev/null || tmux new' # utilities alias myip='curl icanhazip.com'