-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·58 lines (48 loc) · 1.46 KB
/
install.sh
File metadata and controls
executable file
·58 lines (48 loc) · 1.46 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
############################
# .make.sh
# This script creates symlinks from the home directory to any desired dotfiles in ~/dotfiles
############################
########## Variables
dir="$(pwd)" # dotfiles directory
backupDir="$HOME/.dotfiles_backup/$(date)" # old dotfiles backup directory
ifiles="gitconfig gitignore" # list of files/folders to symlink in homedir
if command -v vim > /dev/null 2>&1; then
ifiles="${ifiles} vimrc"
#ifiles="${ifiles} vim" Need to include vundle submodule and call submodule inti in this script
fi
##########
# Skip any that are already symlinks
files=""
for file in $ifiles; do
if [[ ! -L "${HOME}/.${file}" ]]; then
files="${files} ${file}"
break
fi
done
if [[ $files == "" ]]; then
echo "Nothing to do"
exit 0
fi
# create dotfiles_old in homedir
echo "Creating '$backupDir' for backup of any existing dotfiles in ~/ in list:"
echo "${files}"
mkdir -p "$backupDir"
# move any existing dotfiles in homedir to dotfiles_old directory, then create symlinks
cd "$dir"
for file in $files; do
mv "$HOME/.$file" "$backupDir/$file" 2>/dev/null
if [ -e "$HOME/.$file" ]
then
rm "$HOME/.$file"
fi
ln -s "$dir/$file" "$HOME/.$file"
done
echo done
# Post install setup
if command -v vim > /dev/null 2>&1; then
echo "Still need to setup vundle"
#vim +PluginInstall +qall Need to have vundle setup
else
git config --global core.editor vi
fi