-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·33 lines (28 loc) · 794 Bytes
/
setup.sh
File metadata and controls
executable file
·33 lines (28 loc) · 794 Bytes
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
#!/bin/bash
## This script creates symlinks or copies
DIR=~/dotfiles
OLD_DIR=~/dotfiles.old #backup
LN_FILES="emacs.d/init.el gitignore atom/config.cson atom/package.list"
CP_FILES="ssh/config zshrc gitconfig"
echo -n "Creating $OLD_DIR backup of any existing dotfiles in home directory ... "
mkdir -p $OLD_DIR
echo "Done."
cd $DIR
for file in $LN_FILES; do
if [ -f ~/.$file ];
then
echo "Moving existing ~/.$file to $OLD_DIR."
mv ~/.$file $OLD_DIR
fi
echo "Creating symlink from ~/.$file to $DIR/$file.\n"
ln -s $DIR/$file ~/.$file
done
for file in $CP_FILES; do
if [ -f ~/.$file ];
then
echo "Moving existing ~/.$file to $OLD_DIR."
mv ~/.$file $OLD_DIR
fi
echo "Copying file from $DIR/$file to ~/.$file.\n"
cp $DIR/$file ~/.$file
done