-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·39 lines (35 loc) · 914 Bytes
/
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
35
36
37
38
39
#!/bin/bash
dir=~/dotfiles
olddir=~/dotfiles_old
files=$(ls $dir | grep -E -v install | grep -E -v config)
config_files=$(ls -d $dir/config/*)
echo "Creating $olddir for backup of any existing dotfiles in ~"
mkdir -p $olddir
echo "...done"
echo "Changing to the $dir directory"
cd $dir
echo "...done"
for file in $files; do
if [ -a ~/.$file ]; then
echo "Moving .$file from ~ to $olddir"
mv ~/.$file ~/dotfiles_old/
fi
if [ -a ~/.$file ]; then
echo "Symlink already exists"
else
echo "Creating symlink to $file in home directory."
ln -s $dir/$file ~/.$file
fi
done
for file in $config_files; do
if [ -a ~/.$file ]; then
echo "Moving .$file from ~ to $olddir"
mv ~/.$file ~/dotfiles_old/
fi
if [ -a ~/.$file ]; then
echo "Symlink already exists"
else
echo "Creating symlink to $file in home directory."
ln -s $file ~/.config/$(basename $file)
fi
done