dotfiles/place-dotfiles.sh

66 lines
1.7 KiB
Bash
Executable File

#!/bin/sh
# place-dotfiles.sh: simple script to create symlinks from many of my dotfiles
# by x1phosura
dotfiles_root="$HOME"/73h4x/dotfiles/x1yoga # where dotfiles live
#dotfiles_root="$PWD" # alternative (for testing)
dest="$HOME" # destination (usually $HOME)
if [[ "$(realpath $dotfiles_root)" = "$(realpath $dest)" ]] ; then
echo " ERROR: dotfiles_root and dest are the same directory! Aborting..."
exit 1
fi
dotfile_home_list=".bashrc \
.bashrc_secrets \
.bash_prompt \
.bash_profile \
.vimrc \
.gdbinit \
.tmux.conf \
.xinitrc \
.Xresources"
config_dir_list="alacritty \
cava \
compton \
i3 \
nano \
neofetch \
nvim \
polybar \
ranger \
radare2 \
redshift \
systemd \
rofi \
vis"
# link dotfiles in home directory
for file in $dotfile_home_list ; do
# TODO: only link after checking file's existence in dotfiles_root
ln -svfn "$dotfiles_root"/"$file" "$dest"/"$file"
done
# link dotfiles in .config
# Note: I directly symlink items to .config instead of symlinking .config itself
# because I don't want to preserve everything that programs create there
mkdir -p "$dest"/.config
for file in $config_dir_list; do
# TODO: only link after checking file's existence in config_dir_list
ln -svfn "$dotfiles_root"/.config/"$file" "$dest"/.config/"$file"
done
# link personal /bin directory (ex. contains scripts, java, etc...)
ln -svfn "$dotfiles_root"/bin "$dest"/bin
# link scripts (not used anymore, now served by $HOME/bin)
# mkdir -p "$dest"/73h4x
#ln -svfn "$dotfiles_root"/scripts "$dest"/73h4x/scripts
# link /etc dotfiles (some of these HAVE to be in /etc)
#sudo ln -svf "$dotfiles_root"/etc/default/tlp /etc/default/tlp # tlp dir
# TODO: /etc/pacman.conf