#!/bin/bash confdir=$(dirname $0) files="abcde.conf bash_logout bashrc conkyrc crawlrc gitconfig gitignore gtkrc inputrc muttrc nethackrc procmailrc screenrc tmux.conf vimrc Xdefaults xmobarrc bash bin irssi fortune module-setup ncmpc newsbeuter procmail terminfo urxvt vim xmonad" function install() { if [[ -e "$2" && ! -h "$2" ]]; then mv "$2" "$2.bak" fi if [[ -d "$2" && -h "$2" ]]; then rm -f "$2" fi target="$confdir/$1" tmp=$(dirname $2) if [[ "$tmp" != '.' ]]; then for i in ${tmp//\// }; do target="../$target" done fi mkdir -p $(dirname $2) ln -sf "$target" "$2" } for file in $files; do install "${file}" ".${file}" done install repl.rc .re.pl/repl.rc install authorized_keys .ssh/authorized_keys cd .bin find -type f -exec chmod a+x '{}' \; ln -sf ssh scp ln -sf ssh sftp