-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·34 lines (28 loc) · 1.13 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
files_in_home_dir="gtkrc-2.0 i3 i3status.conf npmrc psql tmux.conf xbindkeysrc xinitrc zshrc"
files_in_config_dir="chromium-flags.conf cmus gtk-3.0 kitty neofetch nvim picom.conf rofi rofi-pass zathura"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# clean and backup
if [ -d "$HOME/dotfiles_backup" ]; then
echo "Backup directory already generated."
else
mkdir ~/dotfiles_backup
for file in $files_in_home_dir; do
# move file or directory to backup directory only if it exists
if [ -f "$HOME/.$file" ] || [ -d "$HOME/.$file" ] || [ -L "$HOME/.$file" ]; then
mv ~/.$file ~/dotfiles_backup/$file
fi
echo "Creating symlink to $DIR/$file...done!"
# create symlink
ln -s $DIR/$file ~/.$file
done
for file in $files_in_config_dir; do
# move file or directory to backup directory only if it exists
if [ -f "$HOME/.config/$file" ] || [ -d "$HOME/.config/$file" ] || [ -L "$HOME/.config/$file" ]; then
mv ~/.config/$file ~/dotfiles_backup/$file
fi
echo "Creating symlink to $DIR/$file...done!"
# create symlink
ln -s $DIR/$file $HOME/.config/$file
done
fi