dotfiles/envsetup.sh

59 lines
1.2 KiB
Bash
Raw Normal View History

2012-04-04 22:42:24 +00:00
#!/usr/bin/env bash
2012-03-29 17:02:14 +00:00
# Basic requirements - bash, git
2012-03-29 17:02:14 +00:00
# a die function as always
die() {
printf '%s\n' "$@" >&2
exit 1
}
# Some variable(s)
repo="git://github.com/staticsafe/dotfiles.git"
2012-03-29 17:02:14 +00:00
# Lets get this party on the road, shall we?
gitcheck() {
hash git &>/dev/null || die 'git does not exist, exiting'
printf '%s\n' "git check : PASSED"
2012-03-29 17:02:14 +00:00
}
changeshell() {
if [[ $SHELL == $(command -v zsh) ]]; then
2012-03-29 17:02:14 +00:00
printf '%s\n' "Your default shell is already zsh, continuing."
else
chsh -s $(command -v zsh)
2012-03-29 17:19:13 +00:00
printf '%s\n' "Default shell changed to zsh, logout and login to see changes"
2012-03-29 17:02:14 +00:00
fi
}
linkfiles() {
2012-03-29 17:19:13 +00:00
#find ~/dev/dotfiles -type f -name ".*" -execdir ln -s -f {}
# --target-directory=$HOME \; # removed until I can figure out the issue
ln -sf ~/dotfiles/.zshrc $HOME/
ln -sf ~/dotfiles/.vimrc $HOME/
ln -sf ~/dotfiles/.tmux.conf $HOME/
ln -sf ~/dotfiles/.conkyrc $HOME/
ln -sf ~/dotfiles/.zsh $HOME/
ln -sf ~/dotfiles/.vim $HOME/
2012-03-29 17:02:14 +00:00
touch ~/.zhistory
}
getdotfiles() {
if [[ -d ~/dotfiles ]]; then
cd ~/dotfiles
2012-03-29 17:02:14 +00:00
git pull
linkfiles
else
cd
2012-03-29 17:02:14 +00:00
git clone $repo
linkfiles
fi
}
gitcheck
2012-03-29 17:02:14 +00:00
changeshell
getdotfiles
2012-04-10 17:05:44 +00:00
exec zsh