dot

packages and services management
Log | Files | Refs | README

commit d08c3a4b819d96376410511b194c5a536127ad3a
parent f31c06dbcbd859b6748dc2e22bfc20163f05b4e5
Author: josuah <mail@josuah.net>
Date:   Tue, 22 Nov 2016 10:58:35 +0100

Restructured directories

Diffstat:
A.cache/buffer/history | 0
Rbuild/abduco -> .config/build/abduco | 0
Rbuild/barkdown -> .config/build/barkdown | 0
Rbuild/byacc -> .config/build/byacc | 0
Rbuild/ctags -> .config/build/ctags | 0
Rbuild/dmenu -> .config/build/dmenu | 0
Rbuild/dvtm -> .config/build/dvtm | 0
Rbuild/dwm -> .config/build/dwm | 0
D.config/build/environment | 19-------------------
Rbuild/fzf -> .config/build/fzf | 0
Rbuild/fzy -> .config/build/fzy | 0
Rbuild/git -> .config/build/git | 0
Rbuild/ii -> .config/build/ii | 0
Rbuild/iirc -> .config/build/iirc | 0
Rbuild/iomenu -> .config/build/iomenu | 0
Rbuild/isync -> .config/build/isync | 0
Rbuild/less -> .config/build/less | 0
Rbuild/libevent -> .config/build/libevent | 0
Rbuild/libncurses -> .config/build/libncurses | 0
Rbuild/libtermkey -> .config/build/libtermkey | 0
Rbuild/libutf -> .config/build/libutf | 0
Rbuild/lpeg -> .config/build/lpeg | 0
Rbuild/lua -> .config/build/lua | 0
Rbuild/m4 -> .config/build/m4 | 0
Rbuild/mandoc -> .config/build/mandoc | 0
Rbuild/mblaze -> .config/build/mblaze | 0
Rbuild/mmh -> .config/build/mmh | 0
Rbuild/msmtp -> .config/build/msmtp | 0
Rbuild/mujs -> .config/build/mujs | 0
Rbuild/pcre -> .config/build/pcre | 0
Rbuild/reflex -> .config/build/reflex | 0
Rbuild/retawq -> .config/build/retawq | 0
Rbuild/s-mailx -> .config/build/s-mailx | 0
Rbuild/st -> .config/build/st | 0
Rbuild/tmux -> .config/build/tmux | 0
Rbuild/unagi -> .config/build/unagi | 0
Rbuild/vim -> .config/build/vim | 0
Rbuild/vis -> .config/build/vis | 0
Rbuild/yasm -> .config/build/yasm | 0
Rbuild/zsh -> .config/build/zsh | 0
A.config/environment | 19+++++++++++++++++++
Rbin/adagio -> .local/bin/adagio | 0
Rbin/agenda -> .local/bin/agenda | 0
Rbin/blawk -> .local/bin/blawk | 0
Rbin/buffer -> .local/bin/buffer | 0
A.local/bin/build | 170+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rbin/dna -> .local/bin/dna | 0
Rbin/drawk -> .local/bin/drawk | 0
Rbin/lightsaber -> .local/bin/lightsaber | 0
Rbin/lsync -> .local/bin/lsync | 0
Rbin/music -> .local/bin/music | 0
Rbin/peax -> .local/bin/peax | 0
Rbin/piano -> .local/bin/piano | 0
Rbin/status -> .local/bin/status | 0
Rbin/theme -> .local/bin/theme | 0
Rbin/version -> .local/bin/version | 0
Rbin/www -> .local/bin/www | 0
Rbin/www.1 -> .local/bin/www.1 | 0
R.config/fonts/terminus-v12n.psf.gz -> .local/share/fonts/tty/terminus-v12n.psf.gz | 0
R.config/fonts/terminus-v14b.psf.gz -> .local/share/fonts/tty/terminus-v14b.psf.gz | 0
R.config/fonts/terminus-v14n.psf.gz -> .local/share/fonts/tty/terminus-v14n.psf.gz | 0
R.config/fonts/terminus-v16b.psf.gz -> .local/share/fonts/tty/terminus-v16b.psf.gz | 0
R.config/fonts/terminus-v16n.psf.gz -> .local/share/fonts/tty/terminus-v16n.psf.gz | 0
R.config/fonts/terminus-v18b.psf.gz -> .local/share/fonts/tty/terminus-v18b.psf.gz | 0
R.config/fonts/terminus-v18n.psf.gz -> .local/share/fonts/tty/terminus-v18n.psf.gz | 0
R.config/fonts/terminus-v20b.psf.gz -> .local/share/fonts/tty/terminus-v20b.psf.gz | 0
R.config/fonts/terminus-v20n.psf.gz -> .local/share/fonts/tty/terminus-v20n.psf.gz | 0
R.config/fonts/terminus-v22b.psf.gz -> .local/share/fonts/tty/terminus-v22b.psf.gz | 0
R.config/fonts/terminus-v22n.psf.gz -> .local/share/fonts/tty/terminus-v22n.psf.gz | 0
R.config/fonts/terminus-v24b.psf.gz -> .local/share/fonts/tty/terminus-v24b.psf.gz | 0
R.config/fonts/terminus-v24n.psf.gz -> .local/share/fonts/tty/terminus-v24n.psf.gz | 0
R.config/fonts/terminus-v28b.psf.gz -> .local/share/fonts/tty/terminus-v28b.psf.gz | 0
R.config/fonts/terminus-v28n.psf.gz -> .local/share/fonts/tty/terminus-v28n.psf.gz | 0
R.config/fonts/terminus-v32b.psf.gz -> .local/share/fonts/tty/terminus-v32b.psf.gz | 0
R.config/fonts/terminus-v32n.psf.gz -> .local/share/fonts/tty/terminus-v32n.psf.gz | 0
M.profile | 25+++++++++++++------------
Dbin/build | 170-------------------------------------------------------------------------------
Dbin/config | 106-------------------------------------------------------------------------------
Ainstall | 106+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
79 files changed, 308 insertions(+), 307 deletions(-)

diff --git a/.cache/buffer/history b/.cache/buffer/history diff --git a/build/abduco b/.config/build/abduco diff --git a/build/barkdown b/.config/build/barkdown diff --git a/build/byacc b/.config/build/byacc diff --git a/build/ctags b/.config/build/ctags diff --git a/build/dmenu b/.config/build/dmenu diff --git a/build/dvtm b/.config/build/dvtm diff --git a/build/dwm b/.config/build/dwm diff --git a/.config/build/environment b/.config/build/environment @@ -1,19 +0,0 @@ -# Environment variables for the "build" script package manager - -# The right place would have been '.pam_environment', but Debian prevents -# users to set $PATH in it, considering it as a security threat. - -export PROGRAMS="$HOME/Programs" -export CONFIG="$HOME/Config" -export LOCAL="$HOME/.local" -export XDG_DATA_HOME="$HOME/.local/share" -export XDG_CONFIG_HOME="$HOME/.config" -export XDG_CACHE_HOME="$HOME/.cache" - -export PATH="$LOCAL/bin/$dir:$PATH" -export PATH="$LOCAL/bin:$CONFIG/bin:$PATH" -export CPATH="$LOCAL/include:$CPATH" -export MANPATH="$LOCAL/share/man:$LOCAL/man:$MANPATH" -export LIBPATH="$LOCAL/lib:$LIBPATH" -export LD_RUN_PATH="$LOCAL/lib:$LD_RUN_PATH" -export LD_LIBRARY_PATH="$LOCAL/lib:$LD_LIBRARY_PATH" diff --git a/build/fzf b/.config/build/fzf diff --git a/build/fzy b/.config/build/fzy diff --git a/build/git b/.config/build/git diff --git a/build/ii b/.config/build/ii diff --git a/build/iirc b/.config/build/iirc diff --git a/build/iomenu b/.config/build/iomenu diff --git a/build/isync b/.config/build/isync diff --git a/build/less b/.config/build/less diff --git a/build/libevent b/.config/build/libevent diff --git a/build/libncurses b/.config/build/libncurses diff --git a/build/libtermkey b/.config/build/libtermkey diff --git a/build/libutf b/.config/build/libutf diff --git a/build/lpeg b/.config/build/lpeg diff --git a/build/lua b/.config/build/lua diff --git a/build/m4 b/.config/build/m4 diff --git a/build/mandoc b/.config/build/mandoc diff --git a/build/mblaze b/.config/build/mblaze diff --git a/build/mmh b/.config/build/mmh diff --git a/build/msmtp b/.config/build/msmtp diff --git a/build/mujs b/.config/build/mujs diff --git a/build/pcre b/.config/build/pcre diff --git a/build/reflex b/.config/build/reflex diff --git a/build/retawq b/.config/build/retawq diff --git a/build/s-mailx b/.config/build/s-mailx diff --git a/build/st b/.config/build/st diff --git a/build/tmux b/.config/build/tmux diff --git a/build/unagi b/.config/build/unagi diff --git a/build/vim b/.config/build/vim diff --git a/build/vis b/.config/build/vis diff --git a/build/yasm b/.config/build/yasm diff --git a/build/zsh b/.config/build/zsh diff --git a/.config/environment b/.config/environment @@ -0,0 +1,19 @@ +# Environment variables for the "build" script package manager + +# The right place would have been '.pam_environment', but Debian prevents +# users to set $PATH in it, considering it as a security threat. + +export PROGRAMS="$HOME/Programs" +export CONFIG="$HOME/Config" +export LOCAL="$HOME/.local" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_CACHE_HOME="$HOME/.cache" + +export PATH="$LOCAL/bin/$dir:$PATH" +export PATH="$LOCAL/bin:$PATH" +export CPATH="$LOCAL/include:$CPATH" +export MANPATH="$LOCAL/share/man:$LOCAL/man:$MANPATH" +export LIBPATH="$LOCAL/lib:$LIBPATH" +export LD_RUN_PATH="$LOCAL/lib:$LD_RUN_PATH" +export LD_LIBRARY_PATH="$LOCAL/lib:$LD_LIBRARY_PATH" diff --git a/bin/adagio b/.local/bin/adagio diff --git a/bin/agenda b/.local/bin/agenda diff --git a/bin/blawk b/.local/bin/blawk diff --git a/bin/buffer b/.local/bin/buffer diff --git a/.local/bin/build b/.local/bin/build @@ -0,0 +1,170 @@ +# Install sources from build receipes + + +PROGRAMS="$HOME/Programs" +PREFIX="$HOME/.local" +CONFIG="$HOME/.config/build" + + +help() +{ + local name description + + { + printf '%s\n' " +Usage: ${0##*/} COMMAND PACKAGE + +COMMAND + d[ownload] Download PACKAGE's sources + i[nstall] Download then install PACKAGE + r[emove] Remove build PACKAGE and its sources + u[pdate] Delete, then download and install again PACKAGE + l[ink] Update links from ~${PROGRAMS#$HOME} to ~${PREFIX#$HOME} + +PACKAGE" + find "$CONFIG" -type f -o -type l | while IFS='' read -r file + do + name="${file#$CONFIG/}" + IFS='' read -r description < "$file" + printf '\t%-12s %s\n' "$name" "${description#\# }" + done | sort + } | more + + 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 +} + + +# +# Default build function, to be overriden in the build recipes scripts +# +build() +{ + for patch in $(find "$CONFIG/$1" -name '*.diff') + do + patch -p1 < "$patch" + done + + [ -f "$CONFIG/$1/config.mk" ] && cp -f "$CONFIG/$1/config.mk" . + [ -f "$CONFIG/$1/config.h" ] && cp -f "$CONFIG/$1/config.h" . + [ -f ./autogen.sh ] && ./autogen.sh + [ -f ./configure ] && ./configure --prefix="$PREFIX" + + make && make prefix="$PREFIX" PREFIX="$PREFIX" install clean + return $? +} + + +compile() +{ + local name="$1" tar="$2" + local PREFIX="$PROGRAMS/$name" + + [ ! -f "$CONFIG/$name" ] && error "$2 has no build script" + . "$CONFIG/$name" + + info "Installing $name" + + cd "$PREFIX" && mkdir -p bin doc etc include lib libexec man share + cd src && build "$name" + cd "$PREFIX" && rmdir -p --ignore-fail-on-non-empty * +} + +download() +{ + local name="$1" tar="$2" + local tmp="$(mktemp -u)" + + [ -d "$PROGRAMS/$name/src" ] && error "$name/src already in $PROGRAMS" + [ ! -f "$CONFIG/$name" ] && error "$2 has no build script" + . "$CONFIG/$name" + + info "Downloading $tar" + + case "$tar" in + *.tar ) opt='' ;; + *.tbz2 | *.tar.bz2 ) opt='j' ;; + *.tgz | *.tar.gz ) opt='z' ;; + *.txz | *.tar.xz ) opt='J' ;; + *) error 'not a known tar extension' ;; + esac + + mkdir -p "$tmp" "$PROGRAMS/$name" + wget -O - "$tar" | tar -xv"$opt" -f - -C "$tmp" 1> /dev/null + + mv "$tmp/"* "$PROGRAMS/$name/src" + rm -rf "$tmp" +} + +remove() +{ + local name="$1" + + info "Removing $name" + rm -rf "$PROGRAMS/$name" +} + + +index() +{ + local name="$1" + + info "Updating index in $PREFIX/$1" + + find "$PROGRAMS/$name" -mindepth 2 -type f ! -path "*/src/*" | + while read path + do + mkdir -p "$(dirname "$PREFIX/${path#$PROGRAMS/*/}")" + ln -sf "$path" "$PREFIX/${path#$PROGRAMS/*/}" + done +} + + +main() +{ + mkdir -p "$PROGRAMS" "$PREFIX" "$CONFIG" + + 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/dna b/.local/bin/dna diff --git a/bin/drawk b/.local/bin/drawk diff --git a/bin/lightsaber b/.local/bin/lightsaber diff --git a/bin/lsync b/.local/bin/lsync diff --git a/bin/music b/.local/bin/music diff --git a/bin/peax b/.local/bin/peax diff --git a/bin/piano b/.local/bin/piano diff --git a/bin/status b/.local/bin/status diff --git a/bin/theme b/.local/bin/theme diff --git a/bin/version b/.local/bin/version diff --git a/bin/www b/.local/bin/www diff --git a/bin/www.1 b/.local/bin/www.1 diff --git a/.config/fonts/terminus-v12n.psf.gz b/.local/share/fonts/tty/terminus-v12n.psf.gz Binary files differ. diff --git a/.config/fonts/terminus-v14b.psf.gz b/.local/share/fonts/tty/terminus-v14b.psf.gz Binary files differ. diff --git a/.config/fonts/terminus-v14n.psf.gz b/.local/share/fonts/tty/terminus-v14n.psf.gz Binary files differ. diff --git a/.config/fonts/terminus-v16b.psf.gz b/.local/share/fonts/tty/terminus-v16b.psf.gz Binary files differ. diff --git a/.config/fonts/terminus-v16n.psf.gz b/.local/share/fonts/tty/terminus-v16n.psf.gz Binary files differ. diff --git a/.config/fonts/terminus-v18b.psf.gz b/.local/share/fonts/tty/terminus-v18b.psf.gz Binary files differ. diff --git a/.config/fonts/terminus-v18n.psf.gz b/.local/share/fonts/tty/terminus-v18n.psf.gz Binary files differ. diff --git a/.config/fonts/terminus-v20b.psf.gz b/.local/share/fonts/tty/terminus-v20b.psf.gz Binary files differ. diff --git a/.config/fonts/terminus-v20n.psf.gz b/.local/share/fonts/tty/terminus-v20n.psf.gz Binary files differ. diff --git a/.config/fonts/terminus-v22b.psf.gz b/.local/share/fonts/tty/terminus-v22b.psf.gz Binary files differ. diff --git a/.config/fonts/terminus-v22n.psf.gz b/.local/share/fonts/tty/terminus-v22n.psf.gz Binary files differ. diff --git a/.config/fonts/terminus-v24b.psf.gz b/.local/share/fonts/tty/terminus-v24b.psf.gz Binary files differ. diff --git a/.config/fonts/terminus-v24n.psf.gz b/.local/share/fonts/tty/terminus-v24n.psf.gz Binary files differ. diff --git a/.config/fonts/terminus-v28b.psf.gz b/.local/share/fonts/tty/terminus-v28b.psf.gz Binary files differ. diff --git a/.config/fonts/terminus-v28n.psf.gz b/.local/share/fonts/tty/terminus-v28n.psf.gz Binary files differ. diff --git a/.config/fonts/terminus-v32b.psf.gz b/.local/share/fonts/tty/terminus-v32b.psf.gz Binary files differ. diff --git a/.config/fonts/terminus-v32n.psf.gz b/.local/share/fonts/tty/terminus-v32n.psf.gz Binary files differ. diff --git a/.profile b/.profile @@ -10,21 +10,22 @@ [ "$PROFILE" ] && return 0 || PROFILE=1 -. "$HOME/.config/build/environment" +. "$HOME/.config/environment" +export ABDUCO_SOCKET_DIR="$XDG_CACHE_HOME" -export EMAIL="mail@josuah.net" +export EMAIL="mail@josuah.net" -export MAIL="$HOME/Mail/INBOX" -export ENV="$HOME/.profile" +export MAIL="$HOME/Mail/INBOX" +export ENV="$HOME/.profile" -export EDITOR="vim" -export ALTERNATE_EDITOR="vi" -export VISUAL="$EDITOR" -export FCEDIT="$EDITOR" -export PAGER="less -R" -export MANPAGER="$PAGER" -export DVTM_EDITOR="$PAGER" +export EDITOR="vim" +export ALTERNATE_EDITOR="vi" +export VISUAL="$EDITOR" +export FCEDIT="$EDITOR" +export PAGER="less -R" +export MANPAGER="$PAGER" +export DVTM_EDITOR="$PAGER" export PS1='$( [ $? -eq 0 ] && color=2 || color=1 @@ -213,7 +214,7 @@ main() if [ "$TERM" = 'linux' ] then theme coal - setfont ~/.config/fonts/terminus-v16n.psf.gz + setfont ~/.local/share/fonts/tty/terminus-v16n.psf.gz fi } diff --git a/bin/build b/bin/build @@ -1,170 +0,0 @@ -# Install sources from build receipes - - -PROGRAMS="${PROGRAMS:-$HOME/Programs}" -PREFIX="${LOCAL:-$HOME/.local}" -CONFIG="${CONFIG:-$HOME/Config}" - - -help() -{ - local name description - - { - printf '%s\n' " -Usage: ${0##*/} COMMAND PACKAGE - -COMMAND - d[ownload] Download PACKAGE's sources - i[nstall] Download then install PACKAGE - r[emove] Remove build PACKAGE and its sources - u[pdate] Delete, then download and install again PACKAGE - l[ink] Update links from ~${PROGRAMS#$HOME} to ~${PREFIX#$HOME} - -PACKAGE" - find "$CONFIG/build" -type f | while IFS='' read -r file - do - name="${file#$CONFIG/build/}" - IFS='' read -r description < "$file" - printf '\t%-12s %s\n' "$name" "${description#\# }" - done | sort - } | more - - 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 -} - - -# -# Default build function, to be overriden in the build recipes scripts -# -build() -{ - for patch in $(find "$CONFIG/$1" -name '*.diff') - do - patch -p1 < "$patch" - done - - [ -f "$CONFIG/$1/config.mk" ] && cp -f "$CONFIG/$1/config.mk" . - [ -f "$CONFIG/$1/config.h" ] && cp -f "$CONFIG/$1/config.h" . - [ -f ./autogen.sh ] && ./autogen.sh - [ -f ./configure ] && ./configure --prefix="$PREFIX" - - make && make prefix="$PREFIX" PREFIX="$PREFIX" install clean - return $? -} - - -compile() -{ - local name="$1" tar="$2" - local PREFIX="$PROGRAMS/$name" - - [ ! -f "$CONFIG/build/$name" ] && error "$2 has no build script" - . "$CONFIG/build/$name" - - info "Installing $name" - - cd "$PREFIX" && mkdir -p bin doc etc include lib libexec man share - cd src && build "$name" - cd "$PREFIX" && rmdir -p --ignore-fail-on-non-empty * -} - -download() -{ - local name="$1" tar="$2" - local tmp="$(mktemp -u)" - - [ -d "$PROGRAMS/$name/src" ] && error "$name/src already in $PROGRAMS" - [ ! -f "$CONFIG/build/$name" ] && error "$2 has no build script" - . "$CONFIG/build/$name" - - info "Downloading $tar" - - case "$tar" in - *.tar ) opt='' ;; - *.tbz2 | *.tar.bz2 ) opt='j' ;; - *.tgz | *.tar.gz ) opt='z' ;; - *.txz | *.tar.xz ) opt='J' ;; - *) error 'not a known tar extension' ;; - esac - - mkdir -p "$tmp" "$PROGRAMS/$name" - wget -O - "$tar" | tar -xv"$opt" -f - -C "$tmp" 1> /dev/null - - mv "$tmp/"* "$PROGRAMS/$name/src" - rm -rf "$tmp" -} - -remove() -{ - local name="$1" - - info "Removing $name" - rm -rf "$PROGRAMS/$name" -} - - -index() -{ - local name="$1" - - info "Updating index in $PREFIX/$1" - - find "$PROGRAMS/$name" -mindepth 2 -type f ! -path "*/src/*" | - while read path - do - mkdir -p "$(dirname "$PREFIX/${path#$PROGRAMS/*/}")" - ln -sf "$path" "$PREFIX/${path#$PROGRAMS/*/}" - done -} - - -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 b/bin/config @@ -1,106 +0,0 @@ -CONFIG="$(cd "${0%/*/*}"; pwd)" - - -usage() -{ - printf %s " -Usage: ${0##*/} COMMAND - -COMMAND - l link the dotfiles to $HOME - g clone git repos listed in ~/.config/git/projects - m setup mail credentials - v installs vim plugins listed in ~/.vim/plugin -" - - exit 0 -} - - -link() -{ - # Link all dotfiles - find "$CONFIG" -type f -path "$CONFIG/.*" ! -path "*/.git*" | - while IFS='' read -r file - do - destination="$HOME/${file#$CONFIG/}" - - printf '%s\n' "$destination" - mkdir -p "${destination%/*}" - ln -sf "$file" "$destination" - done - - # Delete dead links - find -L "$HOME" -type l -exec rm {} \; -} - - -git_repos() -{ - local projects="$HOME/Projects" - - mkdir -p "$projects" - cd "$projects" - - while read url dir - do - [ "${dir}" ] && mkdir -p "${dir%/*}" - printf 'cloning %s\n' "${url##*/}" - git clone -q "$url" "$dir" 2> /dev/null & - done < ~/.config/git/projects - - printf 'still running in the background' -} - - -netrc() -{ - mkdir -p "$MAIL/cur" "$MAIL/new" "$MAIL/tmp" - - read -p 'address: ' address - read -p 'host: ' host - read -p 'password: ' password - - printf 'machine %s\nlogin %s\npassword "%s"' \ - "$host" "$address" "$password" > ~/.netrc - chmod 400 "$HOME/.netrc" - - printf '\033[A\r\033[K' -} - - -vim_plugins() -{ - local bundle=~/.vim/bundle - - [ -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 & - - # download the plugins and extract them - while IFS='' read -r plugin - do - printf 'downloading %s\n' "$plugin" - wget -qO- "http://github.com/$plugin/archive/master.tar.gz" | - tar -xvz -f- -c "$bundle" 1> /dev/null & - done < ~/.vim/plugins - - printf 'downloading in background...\n' -} - - -main() -{ - [ $# -eq 0 ] && usage - - case "$1" in - l ) link ;; - g ) git_repos ;; - m ) netrc ;; - v ) vim_plugins ;; - * ) usage ;; - esac -} - - -main $@ diff --git a/install b/install @@ -0,0 +1,106 @@ +CONFIG="$(cd "${0%/*}"; pwd)" + + +usage() +{ + printf %s " +Usage: ${0##*/} COMMAND + +COMMAND + l link the dotfiles to $HOME + g clone git repos listed in ~/.config/git/projects + m setup mail credentials + v installs vim plugins listed in ~/.vim/plugin +" + + exit 0 +} + + +link() +{ + # Link all dotfiles + find "$CONFIG" -type f -path "$CONFIG/.*" ! -path "*/.git*" | + while IFS='' read -r file + do + destination="$HOME/${file#$CONFIG/}" + + printf '%s\n' "$destination" + mkdir -p "${destination%/*}" + ln -sf "$file" "$destination" + done + + # Delete dead links + find -L "$HOME" -type l -exec rm {} \; +} + + +git_repos() +{ + local projects="$HOME/Projects" + + mkdir -p "$projects" + cd "$projects" + + while read url dir + do + [ "${dir}" ] && mkdir -p "${dir%/*}" + printf 'cloning %s\n' "${url##*/}" + git clone -q "$url" "$dir" 2> /dev/null & + done < ~/.config/git/projects + + printf 'still running in the background' +} + + +netrc() +{ + mkdir -p "$MAIL/cur" "$MAIL/new" "$MAIL/tmp" + + read -p 'address: ' address + read -p 'host: ' host + read -p 'password: ' password + + printf 'machine %s\nlogin %s\npassword "%s"' \ + "$host" "$address" "$password" > ~/.netrc + chmod 400 "$HOME/.netrc" + + printf '\033[A\r\033[K' +} + + +vim_plugins() +{ + local bundle=~/.vim/bundle + + [ -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 & + + # download the plugins and extract them + while IFS='' read -r plugin + do + printf 'downloading %s\n' "$plugin" + wget -qO- "http://github.com/$plugin/archive/master.tar.gz" | + tar -xvz -f- -c "$bundle" 1> /dev/null & + done < ~/.vim/plugins + + printf 'downloading in background...\n' +} + + +main() +{ + [ $# -eq 0 ] && usage + + case "$1" in + l ) link ;; + g ) git_repos ;; + m ) netrc ;; + v ) vim_plugins ;; + * ) usage ;; + esac +} + + +main $@