forked from bartonski/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinkfiles.sh
executable file
·38 lines (32 loc) · 907 Bytes
/
linkfiles.sh
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
#! /bin/sh
# A quick deployment script for deploying dotfiles and
# bin/ from ~/User/. This could probably be better done
# using ansible.
# Steps have been taken to back up files so
# the script doesn't overwrite anything, but
# this hasn't been extensively tested. The backups
# should be versioned, for instance, and
# an existing ~/bin directory won't get
# symlinked. I would suggest backing up
# then moving ~/bin before running this,
# then tar-balling ~/.user_dotfiles_backup
# with a versioned file name.
cd $HOME
DOTFILES_BACKUP="$HOME/.user_dotfiles_backup"
if [ ! -d $DOTFILES_BACKUP ]
then
mkdir $DOTFILES_BACKUP
fi
for dotfile in $(find User/ -maxdepth 1 -type f -name '.*' )
do
BASE=$(basename $dotfile)
if [ -e "$BASE" ]
then
mv "$BASE" $DOTFILES_BACKUP
fi
ln -s $(realpath $dotfile) $HOME
done
if [ ! -d ./bin ]
then
ln -s $HOME/User/bin $HOME
fi