-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·69 lines (57 loc) · 1.62 KB
/
setup.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
# Get the name of this folder
thisdir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
# Folder containing new dotfiles
dotfiles="${thisdir}/files"
# Folder containing old dotfiles
olddir="${thisdir}.old"
# Folder containing system specific files
specificfiles="${thisdir}/system-specific"
echo "Running preliminary setup..."
# Initialize vim plugin submodules
echo "Initialize vim plugin submodules..."
git submodule init
git submodule update
echo "Done."
# Create backup and swap folders for vim
echo "Creating backup and swap folders for vim..."
mkdir -p ~/.vim-backup
mkdir -p ~/.vim-swap
echo "Done."
echo "Setup done."
echo ""
echo "Installing new dotfiles..."
echo "Creating folder to contain old dotfiles..."
mkdir -p $olddir
echo "Done."
for df in $(ls $dotfiles/) ; do
dotname=".$df"
sourcename="${dotfiles}/${df}"
destname="${HOME}/${dotname}"
if [ -e $destname ] ; then
backupname="${olddir}/${df}"
echo "Backing up ${destname}..."
mv $destname $backupname
fi
echo "Symlinking ${df}..."
ln -s $sourcename $destname
echo "Done."
done
echo "Dotfiles installed."
# Create empty source files for system-specific configurations if none exist
echo "Spawning system specific config files..."
touch ${specificfiles}/vimrc-specific
touch ${specificfiles}/bashrc-specific
echo "Done."
for sf in $(ls $specificfiles/) ; do
if [ ! $sf == "README.md" ] ; then
dotname=".${sf}"
sourcename="${specificfiles}/${sf}"
destname="${HOME}/${dotname}"
if [ ! -e $destname ] ; then
echo "Symlinking specific ${sf}..."
ln -s $sourcename $destname
echo "Done."
fi
fi
done