dot

packages and services management
Log | Files | Refs | README

commit 28259e869f551cdbcda2110f0e97075893232bb2
parent a8e4a52d38bc21e348ca1ef91e8bcc30273d9d1e
Author: josuah <mail@josuah.net>
Date:   Thu,  3 Nov 2016 02:05:38 -0400

Cleanup, and moving things arount

Diffstat:
Mbin/buffers | 15+++++++--------
Mbin/config | 34++++++++++++++++------------------
Mbin/config-build | 81++++++++++++++++++++++++++++++++++++++++---------------------------------------
Mbin/config-git | 14+++++++-------
Mbin/config-vim | 14++++++++------
Dcron/.config/cron/jobs/beepnow | 2--
Dcron/.config/cron/jobs/checkmail | 2--
Dcron/.config/cron/tab | 9---------
Rshell/.config/shell/status-line -> git/projects | 0
Mshell/.profile | 8++------
Rshell/.config/shell/environment -> shell/environment | 0
Rshell/.config/shell/functions -> shell/functions | 0
Rshell/.config/shell/status-line -> shell/status-line | 0
Rvim/.vim/plugins -> vim/plugins | 0
14 files changed, 81 insertions(+), 98 deletions(-)

diff --git a/bin/buffers b/bin/buffers @@ -6,7 +6,7 @@ # Manage abduco sessions like buffers. # External: stest (dmenu), iomenu, abduco -# Busybox: mkdir, tee, sort, tr, sed +# Busybox: mkdir, tee, sort, tr, sed, exec help=' Usage: buffers COMMAND @@ -140,7 +140,7 @@ run() name="$(get_name "$command" "$path")" # run new or existing abduco session with this name - TERM='screen' ABDUCO="$command" abduco -e '^z' -A "$name" \ + TERM='screen' ABDUCO="$command" exec abduco -e '^z' -A "$name" \ $command $options } @@ -163,13 +163,16 @@ attach() # get the session name by prompting the user name="$(abduco | tr ! / | sed -r '1d; s/(.*)\t(.*)/\2 # \1/' | sort | - iomenu -s '#' | tr / !)" + iomenu -s '#' -l 8 | tr / !)" # set the name of the terminal. printf '\033]0;%s\007' "$name" | tr ! / # attach to the session. - [ "$name" ] && TERM='screen' ABDUCO="$name" abduco -e '^z' -a "$name" + if [ "$name" ] + then + TERM='screen' ABDUCO="$name" exec abduco -e '^z' -a "$name" + fi } main() @@ -188,10 +191,6 @@ main() exit 0 ;; esac - - # reset the screen, print reminder of current sessions - printf '\033[2J\033[300;0f\033[0m\n' - abduco | tr ! / | sort -t "$TAB" -k 3 | sed 1d } main $@ diff --git a/bin/config b/bin/config @@ -1,13 +1,10 @@ # ,--. ,-- * # | ,--. ---. |- , ,--, # | | | | | | | | | -# `--' `--' ' ' ' ' `--| 2016-10-11 +# `--' `--' ' ' ' ' `--| 2016-11-03 #--------------------- `--' ---------------------------------------------------- -# FUNCTIONS -#------------------------------------------------------------------------------- - help() { printf '%s\n' " @@ -27,18 +24,19 @@ COMMAND" } -# ALGORYTHM -#------------------------------------------------------------------------------- - -[ $# -eq 0 ] && help +main() +{ + [ $# -eq 0 ] && help + + if [ -f "$0-$1"* ] + then + subcommand="$1" + shift + CONFIG="${0%/*/*}" "$0-$subcommand"* $* + exit $? + else + help + fi +} -if [ -f "$0-$1"* ] -then - subcommand="$1" - shift - "$0-$subcommand"* $* - exit $? -else - help -fi -;; +main $@ diff --git a/bin/config-build b/bin/config-build @@ -1,17 +1,11 @@ # Install sources from build receipes -# VARIABLES -# ------------------------------------------------------------------------------ - PROGRAMS="${PROGRAMS:-$HOME/Programs}" PREFIX="${LOCAL:-$HOME/.local}" CONFIG="${CONFIG:-$HOME/Config}" -# FUNCTIONS -#------------------------------------------------------------------------------- - help() { { @@ -38,17 +32,20 @@ PACKAGE" exit 0 } + error() { printf '%s: \033[1;31m%s\033[0m\n' "$(basename "$0")" "$1" 1>&2 exit 1 } + info() { printf '%s: \033[1m%s\033[0m\n' "$(basename "$0")" "$1" 1>&2 } + compile() { local name="$1" tar="$2" @@ -99,6 +96,7 @@ remove() rm -rf "$PROGRAMS/$name" } + index() { local name="$1" @@ -113,6 +111,7 @@ index() done } + # # Default build function, to be overriden in the build recipes scripts # @@ -134,37 +133,39 @@ build() } -# ALGORYTHM -#------------------------------------------------------------------------------- - -mkdir -p "$PROGRAMS" "$PREFIX" - -case "$1" in -d | download ) - download "$2" "$tar" - index "$2" - ;; -i | install ) - [ ! -d "$PROGRAMS/$2/src" ] && download "$2" "$tar" - compile "$2" - index "$2" - ;; -r | remove ) - remove "$2" - ;; -u | update ) - remove "$2" - download "$2" "$tar" - compile "$2" - index "$2" - ;; -l | link ) - index '' - ;; -* | '' ) - help - ;; -esac - -info "Removing broken links from $PREFIX" -find -L "$PREFIX" -type l -exec rm {} \; +main() +{ + mkdir -p "$PROGRAMS" "$PREFIX" + + case "$1" in + d | download ) + download "$2" "$tar" + index "$2" + ;; + i | install ) + [ ! -d "$PROGRAMS/$2/src" ] && download "$2" "$tar" + compile "$2" + index "$2" + ;; + r | remove ) + remove "$2" + ;; + u | update ) + remove "$2" + download "$2" "$tar" + compile "$2" + index "$2" + ;; + l | link ) + index '' + ;; + * | '' ) + help + ;; + esac + + info "Removing broken links from $PREFIX" + find -L "$PREFIX" -type l -exec rm {} \; +} + +main $@ diff --git a/bin/config-git b/bin/config-git @@ -1,10 +1,10 @@ # Clone projects git repository to ~/Projects -git="$HOME/Projects" +cd -mkdir -p "$git" -cd "$git" - -sed '/^[ \t-]*$/ d; 1,/^PROJECTS$/ d' "$pwd/README" | while read line -do git clone --recursive "${line##* }" "${line%% *}" -done +sed 's/^[[:space:]]*#.*//; /^[[:space:]]*$/ d' "$CONFIG/git/projects" | + while read recository location + do + mkdir -p "${location%/*}" + git clone --recursive $repository $location + done diff --git a/bin/config-vim b/bin/config-vim @@ -1,17 +1,19 @@ -# Downloads vim plugins from .vim/plugin into ~/.vim/bundle +# Downloads vim plugins from $CONFIG/plugin into ~/.vim/bundle -bundle=~/.vim/bundle +BUNDLE=~/.vim/bundle -[ -d "$bundle" ] && rm -r "$bundle" ~/.vim/autoload/pathogen.vim -mkdir -p "$bundle" ~/.vim/autoload +[ -d "$BUNDLE" ] && rm -r "$BUNDLE" ~/.vim/autoload/pathogen.vim +mkdir -p "$BUNDLE" ~/.vim/autoload wget -qO ~/.vim/autoload/pathogen.vim http://tpo.pe/pathogen.vim # Remove empty lines and command, download the plugins and extract them -for plugin in $(sed 's/^[[:space:]]*#.*//; /^[[:space:]]*$/ d;' ~/.vim/plugins) +for plugin in $( + sed 's/^[[:space:]]*#.*//; /^[[:space:]]*$/ d' "$CONFIG/vim/plugins" +) do printf 'Downloading %s\n' "$plugin" wget -qO- "http://github.com/$plugin/archive/master.tar.gz" | - tar -xvz -f- -C "$bundle" 1> /dev/null & + tar -xvz -f- -C "$BUNDLE" 1> /dev/null & done wait diff --git a/cron/.config/cron/jobs/beepnow b/cron/.config/cron/jobs/beepnow @@ -1,2 +0,0 @@ -#!/bin/sh -printf 'beep' > ~/beep diff --git a/cron/.config/cron/jobs/checkmail b/cron/.config/cron/jobs/checkmail @@ -1,2 +0,0 @@ -#!/bin/sh -mbsync -a diff --git a/cron/.config/cron/tab b/cron/.config/cron/tab @@ -1,9 +0,0 @@ -# ____________________________________ Minute (0-59) -# / _____________________________ Hour (0-23) -# / / ______________________ Month_Day (1-31) -# / / / _______________ Month (1-12) -# / / / / ________ Weekday (0-6) 0=sun -# / / / / / _ Command run-string -#/ / / / / / -*/1 * * * * $HOME/.config/cron/jobs/checkmail -*/1 * * * * $HOME/.config/cron/jobs/beepnow diff --git a/shell/.config/shell/status-line b/git/projects diff --git a/shell/.profile b/shell/.profile @@ -9,8 +9,8 @@ [ "$PROFILE" ] && return 0 || PROFILE=1 # Source other parts of shell configuration -. ~/.config/shell/environment -. ~/.config/shell/functions +. "$CONFIG"/shell/environment +. "$CONFIG"/shell/functions # PROMPT @@ -27,10 +27,6 @@ PS1='$( PS2=' > ' PS3=' > ' -ps1() -{ -} - # ALIAS #------------------------------------------------------------------------------- diff --git a/shell/.config/shell/environment b/shell/environment diff --git a/shell/.config/shell/functions b/shell/functions diff --git a/shell/.config/shell/status-line b/shell/status-line diff --git a/vim/.vim/plugins b/vim/plugins