-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·61 lines (49 loc) · 1.46 KB
/
Copy pathbootstrap.sh
File metadata and controls
executable file
·61 lines (49 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
58
59
60
61
#!/usr/bin/env bash
cd "$(dirname "${BASH_SOURCE}")";
git pull origin master;
function install() {
setupHomeDirectory
installDotFiles
updateVim
}
setupHomeDirectory() {
mkdir -p ${HOME}/{bin,code,etc,notes,tmp}
mkdir -p ${HOME}/etc/shellrc.d
if [ ! -f ${HOME}/etc/shellrc.d/999-host.sh ]; then
echo "# Host-specific shell settings here" >> ${HOME}/etc/shellrc.d/999-host.sh
fi
if [ ! -f ${HOME}/.ssh/id_rsa ]; then
ssh-keygen -b 2048 -t rsa -f ${HOME}/.ssh/id_rsa -q -N ""
echo "New ssh key created at ${HOME}/.ssh/id_rsa"
echo "Be sure to register it with whatever services are needed"
echo
fi
}
function installDotFiles() {
rsync --exclude ".git/" \
--exclude ".gitmodules" \
--exclude "bootstrap.sh" \
--exclude "README.md" \
--exclude "CHANGELOG.md" \
--exclude "etc" \
--exclude ".vim" \
--exclude ".pre-commit-config.yaml" \
-avh --no-perms . ~;
# These are copied separately to maintain them as symlinks
rsync -avh --no-perms etc/* ~/etc/
rsync -avh --no-perms .vim/* ~/.vim/
echo "Dotfiles installed. Open a new terminal (or run 'source ~/.zprofile') to apply changes."
}
function updateVim() {
vim +PluginInstall +qall
}
if [ "$1" == "--force" -o "$1" == "-f" ]; then
install
else
read -p "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1;
echo "";
if [[ $REPLY =~ ^[Yy]$ ]]; then
install
fi
fi;
unset install;