-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_configs.sh
More file actions
executable file
·48 lines (38 loc) · 1.42 KB
/
setup_configs.sh
File metadata and controls
executable file
·48 lines (38 loc) · 1.42 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
#!/bin/bash
# Setup symlinks for home directory (if required)
main() {
echo "DEPRECATION WARNING: This script is out-of-date, and may not work correctly."
config_dir=$(dirname $0)
for file in $(ls $config_dir); do
if [[ "$file" == "README.md" || "$file" == "LICENSE" || "$file" == "setup_configs.sh" || "$file" == "archive" ]]; then
# Skip Readme, License, and this script (;
continue
else
link_config_file $file $config_dir
fi
done
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
vim +PluginInstall +qall
}
# Utility function to link each config file
link_config_file() {
local filename=$1
local pathname=$2
local dotfile="$HOME/.$filename"
# Prompt for user input if file already exists
# Must check for symlinks explicitly as dead symlinks don't exist
if [[ -e "$dotfile" || -L "$dotfile" ]]; then
echo -n "Warning: $dotfile already exists, overwrite? (y/n) "
read user_input
if [[ "$user_input" == "y" || "$user_input" == "Y" ]]; then
mv "$dotfile" "$dotfile.bak"
echo "Info: Created backup file: '$dotfile.bak'"
else
echo "Info: Skipping '$dotfile'"
return
fi
fi
echo "Info: Creating link for '$dotfile' -> '$pathname/$filename'"
ln -s "$pathname/$filename" "$HOME/.$filename"
}
main