2018-05-17 02:05:52 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# This ensures that the entire script is downloaded before execution
|
|
|
|
{
|
|
|
|
|
|
|
|
# Change this url to point to your repo if you made customizations
|
|
|
|
repourl="git://github.com/alopexc0de/dotfiles.git"
|
|
|
|
|
|
|
|
# Exit the script if any errors are encountered
|
2018-05-17 03:46:31 +00:00
|
|
|
#set -e
|
2018-05-17 02:05:52 +00:00
|
|
|
|
|
|
|
basedir=$HOME/dotfiles
|
|
|
|
bindir=$HOME/bin
|
|
|
|
postinst=$HOME/.dotfiles.postinst
|
|
|
|
|
|
|
|
# Attempts to safely install the configs as symlinks (backing up existing ones)
|
|
|
|
function symlink() {
|
|
|
|
src=$1
|
|
|
|
dest=$2
|
|
|
|
|
|
|
|
if [ -e $dest ]; then
|
|
|
|
if [ -L $dest ]; then
|
|
|
|
# Already symlinked -- I'll assume correctly.
|
|
|
|
return
|
|
|
|
else
|
|
|
|
# Rename files with a ".old" extension.
|
|
|
|
echo "$dest already exists, renaming to $dest.old"
|
|
|
|
backup=$dest.old
|
|
|
|
if [ -e $backup ]; then
|
|
|
|
echo "Error: $backup already exists. Please delete or rename it."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
mv -v $dest $backup
|
|
|
|
fi
|
|
|
|
fi
|
2018-05-17 03:22:55 +00:00
|
|
|
echo "Linking $(basename $src)..."
|
2018-05-17 02:05:52 +00:00
|
|
|
ln -sf $src $dest
|
|
|
|
}
|
2017-06-22 17:21:58 +00:00
|
|
|
|
2018-10-18 18:12:15 +00:00
|
|
|
read -p "Press enter to install my dotfiles " WAIT_FOR_INPUT
|
2018-05-16 22:37:00 +00:00
|
|
|
|
2018-05-17 02:05:52 +00:00
|
|
|
if ! which git >>/dev/null ; then
|
|
|
|
echo "Error: git is not installed"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# If the update script exists, try to do a normal update
|
2020-03-25 19:26:51 +00:00
|
|
|
if [ -x "$basedir/internal_bin/check_for_upgrade.sh" ]; then
|
2018-05-17 02:05:52 +00:00
|
|
|
source "$basedir/shell/env"
|
2020-03-25 19:26:51 +00:00
|
|
|
env _DOTFILES=$basedir DISABLE_UPDATE_PROMPT='FALSE' zsh -f $basedir/internal_bin/check_for_upgrade.sh
|
2018-05-17 02:05:52 +00:00
|
|
|
else
|
|
|
|
echo "Cloning dotfiles to $basedir"
|
|
|
|
rm -rf $basedir
|
2018-05-17 03:59:56 +00:00
|
|
|
git clone --depth=1 $repourl $basedir
|
2018-05-17 02:05:52 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Start installing config
|
|
|
|
|
2020-03-26 16:09:36 +00:00
|
|
|
echo "Linking config and local files"
|
2020-03-25 19:26:51 +00:00
|
|
|
# Environment
|
2019-12-13 20:28:24 +00:00
|
|
|
symlink $basedir/home/.local $HOME/.local
|
2020-03-25 19:26:51 +00:00
|
|
|
symlink $basedir/home/.config $HOME/.config
|
|
|
|
|
2020-10-05 15:30:49 +00:00
|
|
|
echo "Installing Oh-My-ZSH"
|
|
|
|
echo "When the install is done, type \"exit\" to continue installing dotfiles"
|
|
|
|
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
|
|
|
|
2020-03-26 19:11:08 +00:00
|
|
|
echo "Building i3 configuration"
|
2020-03-26 21:58:55 +00:00
|
|
|
$basedir/bin/build-i3-config
|
2020-03-26 19:11:08 +00:00
|
|
|
|
2020-03-26 16:09:36 +00:00
|
|
|
echo "Linking X-Session files"
|
|
|
|
# Stuff related to the X-Session
|
|
|
|
symlink $basedir/home/.config/compton.conf $HOME/.compton.conf
|
2020-03-25 19:26:51 +00:00
|
|
|
symlink $basedir/home/Xresources $HOME/.Xresources
|
2020-03-26 20:14:21 +00:00
|
|
|
symlink $basedir/home/xinitrc $HOME/.xinitrc
|
2020-03-25 19:26:51 +00:00
|
|
|
|
2020-03-26 16:09:36 +00:00
|
|
|
echo "Linking shell files"
|
|
|
|
# Shell stuff
|
2020-03-25 19:26:51 +00:00
|
|
|
symlink $basedir/home/shell/tmux.conf $HOME/.tmux.conf
|
|
|
|
symlink $basedir/home/shell/bashrc $HOME/.bashrc
|
|
|
|
symlink $basedir/home/shell/zshrc $HOME/.zshrc
|
|
|
|
symlink $basedir/home/shell/vimrc $HOME/.vimrc
|
2020-03-26 20:14:21 +00:00
|
|
|
symlink $basedir/home/dmenurc $HOME/.dmenurc
|
|
|
|
symlink $basedir/home/dmrc $HOME/.dmrc
|
2020-03-25 19:26:51 +00:00
|
|
|
|
2020-03-26 16:09:36 +00:00
|
|
|
# Global git
|
|
|
|
symlink $basedir/home/gitconfig $HOME/.gitconfig
|
|
|
|
|
|
|
|
echo "Installing shell-history"
|
|
|
|
python3 -m pip install shellhistory
|
2017-06-22 17:21:58 +00:00
|
|
|
|
2018-05-17 03:22:55 +00:00
|
|
|
echo "Installing VIM Pathogen..."
|
2018-05-17 02:05:52 +00:00
|
|
|
mkdir -p $HOME/.vim/autoload $HOME/.vim/bundle
|
|
|
|
curl -LSso $HOME/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
|
2017-06-22 17:21:58 +00:00
|
|
|
|
2018-05-17 03:22:55 +00:00
|
|
|
echo "Installing VIM Sensible..."
|
2018-05-17 02:05:52 +00:00
|
|
|
cd $HOME/.vim/bundle
|
2017-06-22 17:21:58 +00:00
|
|
|
git clone git://github.com/tpope/vim-sensible.git
|
|
|
|
|
2020-10-05 15:30:49 +00:00
|
|
|
echo "Installing VIM Iceberg theme"
|
|
|
|
cd /tmp
|
|
|
|
wget https://www.vim.org/scripts/download_script.php?src_id=25718 -O iceberg.zip
|
|
|
|
unzip iceberg.zip
|
|
|
|
cp -r iceberg.vim/{autoload,colors} ~/.vim/
|
|
|
|
|
2018-05-17 03:22:55 +00:00
|
|
|
echo "Adding user bin..."
|
2020-03-25 18:54:55 +00:00
|
|
|
mkdir -p $bindir
|
|
|
|
for file_path in $basedir/bin/*; do
|
|
|
|
symlink $file_path $bindir/$(basename $file_path)
|
2018-05-17 02:05:52 +00:00
|
|
|
done
|
2018-05-17 00:56:23 +00:00
|
|
|
|
2018-05-17 03:22:55 +00:00
|
|
|
echo "Changing default shell to ZSH..."
|
2017-06-22 17:21:58 +00:00
|
|
|
chsh -s /usr/bin/zsh
|
|
|
|
|
2018-05-17 02:05:52 +00:00
|
|
|
if [ -e "$postinst" ]; then
|
2018-05-17 03:22:55 +00:00
|
|
|
echo "Running post install..."
|
2018-05-17 02:05:52 +00:00
|
|
|
source "$postinst"
|
|
|
|
else
|
2018-08-20 19:58:12 +00:00
|
|
|
echo "No post install script found. Optionally create one at $postinst and reinstall your dotfies"
|
2018-05-17 02:05:52 +00:00
|
|
|
fi
|
2017-06-23 03:13:57 +00:00
|
|
|
|
2017-06-22 17:21:58 +00:00
|
|
|
echo "Install done."
|
|
|
|
echo "Check tmux, vim, and your shell to verify everything is correct"
|
2017-06-22 17:22:53 +00:00
|
|
|
echo "you may need to launch a new instance of your shell"
|
2018-05-17 02:05:52 +00:00
|
|
|
|
|
|
|
} # Ensures that the whole script is downloaded before execution
|