Source

dotfiles / basedotfiles

#! /bin/bash
# basedotfiles
# sourced by set/get dotfiles

# CONSTANTS
DOTFILEDIR=~/dev/dotfiles
PASSWDFILE=~/dev/dotfiles/passwords
BACKUPDIR=~/dev/dotfiles/backup

# passwd function
getPasswd() { awk '/^'"${1}"'/{print $2}' ${PASSWDFILE}; }

# Remove backupfiles
# TODO: Use single regex
rm_bkpfiles() {
    find ${DOTFILEDIR} -type f -name "*.bak" -exec rm -f {} \;
    find ${DOTFILEDIR} -type f -name "*-bak" -exec rm -f {} \;
    find ${DOTFILEDIR} -type f -name "*~" -exec rm -f {} \;
    find ${DOTFILEDIR} -type f -name "*.swp" -exec rm -f {} \;
    find ${DOTFILEDIR} -type f -name "*.orig" -exec rm -f {} \;
}

# Files
# Do not(!) use files with spaces
files=(
    ~/.bashrc             #  0
    ~/.aliases            #  1
    ~/.inputrc            #  2
    ~/.xinitrc            #  3
    ~/.Xdefaults          #  4
    ~/.Xmodmap            #  5
    ~/.vimrc              #  6
    ~/.weechat/\*.conf    #  7
    ~/.ncmpcpp/config     #  8
    ~/.bin/colortest      #  9
    ~/.bin/mplayer        # 10
    ~/.bin/lodgeit.py     # 11
    ~/.config/awesome/\*  # 12
    ~/.vim/               # 13
    ~/.hgrc               # 14
)

declare -a fileDirs
fileDirs[7]=.weechat
fileDirs[8]=.ncmpcpp
fileDirs[9]=.bin
fileDirs[10]=.bin
fileDirs[11]=.bin
fileDirs[12]=awesome-config

# Passwords etc.
# Shall not contain spaces!
declare -a pwds
pwds=(
    BouncerDomain         # 0
    BouncerPasswd         # 1
    MailAddress           # 2
)
declare -a pwdFiles
pwdFiles[0]=.weechat/irc.conf
pwdFiles[1]=.weechat/irc.conf
pwdFiles[2]=.hgrc