dotfiles/install.sh
2022-10-23 16:52:37 -04:00

80 lines
2.7 KiB
Bash
Executable file

#!/bin/bash
backup=~/dotfiles_backup
log_file=~/dotfiles_install.log
dotfiles_dir=~/.dotfiles
config_dir=~/.config
bin_dir=~/.local/bin
## Logging
exec 3>&1 4>&2
trap 'exec 2>&4 1>&3' 0 1 2 3
exec 1>$log_file 2>&1
## Backup current files and folders
mkdir -p $backup
cp -a ~/.bash_profile $backup/
cp -a ~/.bashrc $backup/
cp -a ~/.profile $backup/
cp -a ~/.emacs $backup/
cp -a ~/.emacs.d $backup/
cp -a ~/.Xresources $backup/
cp -a $config_dir/bspwm $backup/
cp -a $config_dir/dunst $backup/
cp -a $config_dir/kitty $backup/
cp -a $config_dir/nvim $backup/
cp -a $config_dir/polybar $backup/
cp -a $bin_dir $backup/
# Delete current files and folders
rm -rf ~/.bash_profile
rm -rf ~/.bashrc
rm -rf ~/.profile
rm -rf ~/.emacs
rm -rf ~/.emacs.d
rm -rf ~/.Xresources
rm -rf $config_dir/bspwm
rm -rf $config_dir/dunst
rm -rf $config_dir/kitty
rm -rf $config_dir/nvim
rm -rf $config_dir/polybar
rm -rf $bin_dir
# Create HOME symlinks
ln -sf $dotfiles_dir/bashrc ~/.bashrc
ln -sf $dotfiles_dir/bash_profile ~/.bash_profile
ln -sf $dotfiles_dir/profile ~/.profile
ln -sf $dotfiles_dir/emacs.d ~/.emacs.d
ln -sf $dotfiles_dir/xinitrc ~/.xinitrc
ln -sf $dotfiles_dir/vimrc ~/.vimrc
ln -sf $dotfiles_dir/Xresources ~/.Xresources
# Create $config_dir, sub-directories, and symlinks
mkdir -p $config_dir/{bspwm,dunst,kitty,nvim,polybar,rofi,sxhkd}
ln -sf $dotfiles_dir/config/bspwm/bspwmrc $config_dir/bspwm/bspwmrc
ln -sf $dotfiles_dir/config/dunst/dunstrc $config_dir/dunst/dunstrc
ln -sf $dotfiles_dir/config/kitty/kitty.conf $config_dir/kitty/kitty.conf
#ln -sf $dotfiles_dir/config/kitty/gruvbox.conf $config_dir/kitty/gruvbox.conf
ln -sf $dotfiles_dir/config/kitty/zenburn.conf $config_dir/kitty/zenburn.conf
ln -sf $dotfiles_dir/config/nvim/init.vim $config_dir/nvim/init.vim
ln -sf $dotfiles_dir/config/polybar/config.ini $config_dir/polybar/config.ini
ln -sf $dotfiles_dir/config/polybar/colors.ini $config_dir/polybar/colors.ini
ln -sf $dotfiles_dir/config/polybar/modules.ini $config_dir/polybar/modules.ini
ln -sf $dotfiles_dir/config/polybar/custom_modules.ini $config_dir/polybar/custom_modules.ini
ln -sf $dotfiles_dir/config/rofi/config.everforest.rasi $config_dir/rofi/config.rasi
#ln -sf $dotfiles_dir/config/rofi/config.gruvbox.rasi $config_dir/rofi/config.rasi
#ln -sf $dotfiles_dir/config/rofi/config.zenburn.rasi $config_dir/rofi/config.rasi
ln -sf $dotfiles_dir/config/sxhkd/sxhkdrc $config_dir/sxhkd/sxhkdrc
# Create $bin_dir and symlinks
mkdir -p $bin_dir
ln -sf $dotfiles_dir/bin/mirror-outputs $bin_dir
ln -sf $dotfiles_dir/bin/single-polybar-launcher $bin_dir
ln -sf $dotfiles_dir/bin/toggle-wifi $bin_dir
# Finishing up
source ~/.bashrc
source ~/.bash_profile
source ~/.profile
xrdb ~/.Xresources