dotfiles/install.sh
2022-09-06 15:03:53 -05:00

87 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
packages="sshpass tmux python3-pip cargo"
pip="awscli"
read -p "Are you sure? (Y/N) "
if [[ "$REPLY" != "Y" ]]
then
echo "OK, Bye!"
exit 0
fi
echo "Creating necessary directories ..."
mkdir -p ~/.config
release=$(lsb_release -d | grep -i ubuntu > /dev/null && echo ubuntu || echo unknown)
echo "Release is $release"
if [[ "$release" == "ubuntu" ]]
then
echo "Installing packages ..."
sudo apt install -y $packages
fi
if [[ -f /usr/bin/pip3 ]]
then
echo "Pip 3 detected, installing packages ..."
pip install --user -U $pip
fi
if [[ -f ~/.dotfiles/bash/bashrc ]]
then
echo "Dotfiles bashrc found, linking it ..."
rm -rf ~/.bashrc
ln -sf ~/.dotfiles/bash/bashrc ~/.bashrc
fi
if [[ -f ~/.dotfiles/tmux/tmux.conf ]]
then
echo "Dotfiles tmux.conf found, linking it ..."
rm -rf ~/.tmux.conf
ln -sf ~/.dotfiles/tmux/tmux.conf ~/.tmux.conf
rm -rf ~/.tmux
ln -sf ~/.dotfiles/tmux ~/.tmux
fi
# I hate this but no other option worked ...
if [[ ! -f /usr/local/bin/starship ]]
then
echo "Installing starship ..."
curl -sS https://starship.rs/install.sh | sh
fi
if [[ -f ~/.dotfiles/starship/starship.toml ]]
then
echo "Installing starship configuration ..."
rm -rf ~/.config/starship.toml
ln -sf ~/.dotfiles/starship/starship.toml ~/.config/starship.toml
fi
if [[ -f ~/.dotfiles/git/gitconfig ]]
then
echo "Installing git configuration ..."
rm -rf ~/.gitconfig
ln -sf ~/.dotfiles/git/gitconfig ~/.gitconfig
fi
if [[ -d ~/.dotfiles/ssh ]]
then
echo "Installing ssh configuration ..."
rm -rf ~/.ssh
ln -sf ~/.dotfiles/ssh ~/.ssh
fi
if [[ -d ~/.dotfiles/vim ]]
then
echo "Installing vim configuration ..."
rm -rf ~/.vim*
mkdir -p ~/.vim/bundle
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
cp ~/.dotfiles/vim/vimrc ~/.vimrc
fi
. ~/.bashrc