dotfiles/install.sh
Frank Villaro-Dixon 9557769749 install
2015-04-09 18:47:24 +02:00

146 lines
2.6 KiB
Bash
Executable file

#!/bin/bash
set -x
function deploy_directory()
{ # {{{
# @arg1: dst directory
# @arg2: src directory
if [ ! -d $1 ]; then mkdir $1; fi;
cd $1;
for i in `ls $2`; do ln -s $2/$i ./$i; done
cd ..
} # }}}
function deploy_encryption()
{
cd ~
mkdir $SECURE_DIR/.mozilla
ln -s $SECURE_DIR/.mozilla ~./.mozilla
}
function deploy_for_desktop()
{ # {{{
cd ~
ln -s $WAI/xinitrc ./.xinitrc
ln -s $WAI/xbindkeysrc ./.xbindkeysrc
ln -s $WAI/inputrc ./.inputrc
ln -s $WAI/Xmodmap ./.Xmodmap
ln -s $WAI/octaverc ./.octaverc
ln -s $WAI/lynxrc ./.lynxrc
cd ~
deploy_directory ~/texmf $WAI/texmf
cd ~
if [ ! -d "~/.my_utils" ]; then mkdir ~/.my_utils; fi;
cd ~/.my_utils
ln -s $WAI/Utils/track.sh ./track.sh
ln -s $WAI/Utils/blink.sh ./blink.sh
ln -s $WAI/Utils/octopus.sh ./octopus.sh
ln -s $WAI/chooseWP.sh ~/Pictures/wallpapers/chooseWP.sh
} # }}}
function deploy_vim()
{ # {{{
cd ~
ln -s $WAI/vim/vimrc ./.vimrc
ln -s $WAI/vim ./.vim
} # }}}
function deploy_ssh()
{ # {{{
cd ~
if [ -d ~/.ssh && ! -h ~/.ssh ]; then
mv ~/.ssh ~/.sshBAK
fi;
if [ ! -d "$SECURE_DIR/.ssh/" ]; then
mkdir "$SECURE_DIR/.ssh"
if [ -d ~/.sshBAK ]; then #could've reversed 2 ifs, i know
mv ~/.sshBAK/* $SECURE_DIR/.ssh/
rm -f ~/.sshBAK
fi;
fi;
ln -s $SECURE_DIR/.ssh/ ~/.ssh
cd ~/.ssh
ln -s $WAI/ssh/config ./
} # }}}
function deploy_mutt()
{ # {{{
cd ~
ln -s $WAI/mailcap ./.mailcap
if [ -d ~/.mutt && ! -h ~/.mutt ]; then
mv ~/.mutt ~/.muttBAK
fi;
if [ ! -d $SECURE_DIR/.mutt ]; then
mkdir $SECURE_DIR/.mutt;
if [ -d ~/.muttBAK ]; then
mv ~/.muttBAK/* $SECURE_DIR/.mutt/
fi;
fi;
if [ ! -h ~/.mutt ]; then
ln -s $SECURE_DIR/.mutt/ ~/.mutt/
fi
cd ~/.mutt
ln -s $WAI/mutt/muttrc ./
ln -s $WAI/mutt/killsig ./
ln -s $WAI/mutt/passwords.gpg ./
ln -s $WAI/mutt/crypto ./
ln -s $WAI/mutt/colors.test1 ./
ln -s $WAI/mutt/colors.test2 ./
ln -s $WAI/mutt/unlock-pass.sh ./
ln -s $WAI/mutt/account.frank ./
ln -s $WAI/mutt/account.aei ./
mkdir ~/.mutt/certificates
mkdir ~/.mutt/cache
mkdir ~/.mutt/cache/bodies
mkdir ~/.mutt/cache/headers
} # }}}
WAI=`pwd`
if [ $(hostname) = "intersect" ]; then
SECURE_DIR=~/Private
else
SECURE_DIR=~
echo "FIXME"
exit
fi;
#simple files
cd ~
ln -s $WAI/Utils/ .my_utils
ln -s $WAI/bashrc ./.bashrc
ln -s $WAI/bash_ps1 ./.bash_ps1
ln -s $WAI/signature ./.signature
ln -s $WAI/gitconfig ./.gitconfig
ln -s $WAI/vacation.msg ./.vacation.msg
#deploy_for_desktop
#deploy_encryption
deploy_vim
deploy_ssh
#deploy_mutt
cd ~
if [ -d "Programmation" ]; then mkdir Programmation; fi;
cd ~/Programmation
ln -s $WAI/git_auto_pull.sh ./git_auto_pull.sh