2017-02-07 16:16:45 -06:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
if [[ -z "$XDG_CONFIG_HOME" ]]; then
|
2017-02-10 12:06:59 -06:00
|
|
|
export XDG_CONFIG_HOME="$HOME/.config"
|
2017-02-07 16:16:45 -06:00
|
|
|
fi
|
|
|
|
|
|
|
|
dfp=$(cd "$(dirname "${BASH_SOURCE[0]}" )/" && pwd)
|
|
|
|
|
|
|
|
ALERT_AGREEMENT_FILE="$dfp/.agreed-to-erasing-files.lock"
|
|
|
|
|
|
|
|
# Let user know that this script will delete their current configuration and
|
|
|
|
# that they should read this script before running. We'll use a lock file so
|
|
|
|
# the user only needs to agree once.
|
|
|
|
if [ -f "$ALERT_AGREEMENT_FILE" ]; then
|
2017-02-10 12:06:59 -06:00
|
|
|
# User agreed already - do nothing
|
|
|
|
echo "Linking..."
|
2017-02-07 16:16:45 -06:00
|
|
|
else
|
2017-02-10 12:06:59 -06:00
|
|
|
echo "Running this script may delete existing personal configuration files."
|
|
|
|
echo "Please view this script's source, fully understand it, and backup any"
|
|
|
|
echo "files before continuing."
|
|
|
|
echo "Seriously. Like... entire directories. Just gone."
|
|
|
|
read -r -p "Are you sure you want to continue? [y/N] " response
|
|
|
|
response=${response,,} # to lower case
|
|
|
|
if [[ $response =~ ^(yes|y)$ ]]; then
|
|
|
|
echo "agreed" > "$ALERT_AGREEMENT_FILE"
|
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
fi
|
2017-02-07 16:16:45 -06:00
|
|
|
fi
|
|
|
|
|
2017-02-08 11:54:30 -06:00
|
|
|
# TODO: make sure we have an even number, here
|
2017-02-07 16:16:45 -06:00
|
|
|
links=(
|
2017-02-10 12:06:59 -06:00
|
|
|
# desktop environment files
|
2017-05-05 01:47:33 -05:00
|
|
|
"$dfp/de/bspwmrc" "$XDG_CONFIG_HOME/bspwm/bspwmrc"
|
|
|
|
"$dfp/de/sxhkdrc" "$XDG_CONFIG_HOME/sxhkd/sxhkdrc"
|
|
|
|
"$dfp/de/xresources" "$HOME/.Xresources"
|
|
|
|
"$dfp/de/xinitrc" "$HOME/.xinitrc"
|
|
|
|
"$dfp/de/xprofile" "$HOME/.xprofile"
|
|
|
|
"$dfp/de/xmodmap" "$HOME/.xmodmap"
|
|
|
|
"$dfp/scripts/colors/xresources" "$HOME/.Xresources.colors"
|
|
|
|
"$dfp/de/compton.conf" "$XDG_CONFIG_HOME/compton.conf"
|
2017-02-07 16:16:45 -06:00
|
|
|
|
2017-02-10 12:06:59 -06:00
|
|
|
# shell files
|
2017-05-05 01:47:33 -05:00
|
|
|
"$dfp/shell/bashrc" "$HOME/.bashrc"
|
|
|
|
"$dfp/shell/bash_profile" "$HOME/.bash_profile"
|
|
|
|
"$dfp/shell/tmux.conf" "$HOME/.tmux.conf"
|
|
|
|
"$dfp/shell/tmux-layouts" "$HOME/.tmux/layouts"
|
2017-02-08 11:54:30 -06:00
|
|
|
|
2017-02-10 12:06:59 -06:00
|
|
|
# text editor files
|
2017-05-05 01:47:33 -05:00
|
|
|
"$dfp/apps/neovim/" "$XDG_CONFIG_HOME/nvim"
|
|
|
|
"$dfp/apps/neovim/" "$HOME/.vim"
|
|
|
|
"$dfp/apps/neovim/init.vim" "$HOME/.vimrc"
|
|
|
|
"$dfp/scripts/colors/vim" "$XDG_CONFIG_HOME/nvim/colors/base16-donokai.vim"
|
2017-02-08 14:22:10 -06:00
|
|
|
|
2017-04-03 15:45:21 -05:00
|
|
|
# gtk configuration files
|
2017-05-05 01:47:33 -05:00
|
|
|
"$dfp/de/gtk2rc" "$HOME/.gtkrc-2.0"
|
|
|
|
"$dfp/de/gtk2rc" "$HOME/.gtkrc"
|
2017-07-27 13:00:48 -05:00
|
|
|
"$dfp/de/gtk3settings.ini" "$XDG_CONFIG_HOME/gtk-3.0/settings.ini"
|
2017-04-03 15:45:21 -05:00
|
|
|
|
2017-02-10 12:06:59 -06:00
|
|
|
# irc files
|
2017-05-05 01:47:33 -05:00
|
|
|
"$dfp/apps/irssi/" "$HOME/.irssi"
|
|
|
|
"$dfp/apps/weechat/" "$HOME/.weechat"
|
|
|
|
|
|
|
|
# qutebrowser config files
|
|
|
|
"$dfp/apps/qutebrowser/qutebrowser.conf" "$XDG_CONFIG_HOME/qutebrowser/qutebrowser.conf"
|
|
|
|
"$dfp/apps/qutebrowser/keys.conf" "$XDG_CONFIG_HOME/qutebrowser/keys.conf"
|
2017-04-03 14:38:53 -05:00
|
|
|
|
2017-04-27 15:49:57 -05:00
|
|
|
# terminal emulator
|
2017-05-05 01:47:33 -05:00
|
|
|
"$dfp/apps/alacritty/" "$XDG_CONFIG_HOME/alacritty"
|
2017-04-27 15:49:57 -05:00
|
|
|
|
2017-04-27 17:22:57 -05:00
|
|
|
# rofi config
|
2017-05-05 01:47:33 -05:00
|
|
|
"$dfp/apps/rofi/config" "$XDG_CONFIG_HOME/rofi/config"
|
2017-04-27 17:22:57 -05:00
|
|
|
|
2017-04-03 14:38:53 -05:00
|
|
|
# bar files
|
2017-05-05 01:47:33 -05:00
|
|
|
"$dfp/de/bar/polybar-config" "$XDG_CONFIG_HOME/polybar/config"
|
2017-02-10 12:06:59 -06:00
|
|
|
|
2017-11-14 17:31:30 -06:00
|
|
|
# ranger config
|
2017-12-21 12:18:17 -06:00
|
|
|
"$dfp/apps/ranger/" "$XDG_CONFIG_HOME/ranger/"
|
|
|
|
|
|
|
|
# mutt config
|
|
|
|
"$dfp/apps/mutt/muttrc" "$XDG_CONFIG_HOME/.muttrc"
|
|
|
|
"$dfp/apps/mutt/muttrc" "$HOME/.muttrc"
|
2017-07-27 13:00:48 -05:00
|
|
|
|
|
|
|
# neofetch config
|
|
|
|
"$dfp/apps/neofetch/config" "$XDG_CONFIG_HOME/neofetch/config"
|
2017-02-28 10:56:23 -06:00
|
|
|
|
|
|
|
# git config
|
2017-05-05 01:47:33 -05:00
|
|
|
"$dfp/apps/git/config" "$HOME/.gitconfig"
|
2017-04-27 15:49:57 -05:00
|
|
|
|
|
|
|
# fontconfig
|
2017-05-05 01:47:33 -05:00
|
|
|
"$dfp/de/fontconfig/" "$XDG_CONFIG_HOME/fontconfig"
|
2017-06-05 22:15:32 -05:00
|
|
|
|
|
|
|
# XDG user directories
|
|
|
|
"$dfp/shell/user-dirs" "$XDG_CONFIG_HOME/user-dirs.dirs"
|
2017-02-07 16:16:45 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
source=""
|
|
|
|
for i in "${links[@]}"; do
|
2017-02-10 12:06:59 -06:00
|
|
|
if [ -n "$source" ]; then
|
|
|
|
if [ -L "$i" ]; then # if symlink exists, delete it
|
|
|
|
rm -rf "$i"
|
|
|
|
fi
|
|
|
|
if [ -f "$i" ]; then # if file exists, delete it
|
|
|
|
rm -rf "$i"
|
|
|
|
fi
|
|
|
|
if [ -d "$i" ]; then # if directory exists, delete it
|
|
|
|
rm -rf "$i"
|
|
|
|
fi
|
|
|
|
# check if the directory that will contain the link exists
|
|
|
|
DIR_TO_LINK=$(dirname "$i")
|
|
|
|
if [ -d "$DIR_TO_LINK" ]; then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
mkdir -p "$DIR_TO_LINK"
|
|
|
|
fi
|
|
|
|
ln -s "$source" "$i"
|
|
|
|
echo "Linked $(basename $source) to $i."
|
|
|
|
source=""
|
|
|
|
else
|
|
|
|
source="$i"
|
|
|
|
fi
|
2017-02-07 16:16:45 -06:00
|
|
|
done
|
|
|
|
|
|
|
|
echo "Done."
|