dotfiles/place-dotfiles.sh

71 lines
1.8 KiB
Bash
Raw Normal View History

2021-04-15 22:45:15 +00:00
#!/bin/sh
# place-dotfiles.sh: simple script to create symlinks from many of my dotfiles
# by x1phosura
dotfiles_root="$HOME"/73h4x/dotfiles/x1yoga-manjaro # where dotfiles live
#dotfiles_root="$PWD" # alternative (for testing)
dest="$HOME" # destination (usually $HOME)
if [ ! -d "$dotfiles_root" ]; then
echo "ERROR: $dotfiles_root doesn't exist. Aborting..."
exit 1
fi
2021-04-15 22:45:15 +00:00
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 \
.gdbinit \
.tmux.conf \
.vimrc \
2021-04-15 22:45:15 +00:00
.xinitrc \
.Xresources"
config_dir_list="alacritty \
cava \
i3 \
nano \
neofetch \
nvim \
picom \
2021-04-15 22:45:15 +00:00
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