dotfiles/install.sh
2022-10-23 17:15:32 -04:00

60 lines
2.5 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
mv -f ~/{.bash_profile,.bashrc,.profile,.emacs,.emacs.d,.vimrc,.xinitrc,.Xresources} $backup/
mv -f $config_dir/{bspwm,dunst,kitty,nvim,polybar,rofi,sxhkd,tint2,xsettingsd} $backup/
mv -f $bin_dir $backup/
# 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,tint2,sxhkd,xsettingsd}
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
ln -sf $dotfiles_dir/config/tint2/tint2rc $config_dir/tint2/tint2rc
ln -sf $dotfiles_dir/config/xsettingsd/xsettingsd.conf $config_dir/xsettingsd/xsettingsd.conf
# 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
ln -sf $dotfiles_dir/bin/tint2-launcher $bin_dir
# Finishing up
source ~/.bashrc
source ~/.bash_profile
source ~/.profile
xrdb ~/.Xresources