-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap
executable file
·42 lines (33 loc) · 1.16 KB
/
bootstrap
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
#!/bin/bash
if ! hash git &> /dev/null; then
echo "Error: This script requires git! Please install git, then try running this script again." 1>&2;
exit 1
fi
echo ""
echo "This script will automatically install dotfiles on your system."
echo ""
echo "Press [ENTER] to proceed, or [CTRL+C] to cancel installation."
read
default_path="$HOME/.dotfiles"
read -p "Where should the dotfiles repository be cloned to? [$default_path] " -e path
if [ -z "$path" ]; then
path="$default_path"
fi
git clone https://github.com/gardart/minidot.git "$path"
if [ $? -ne 0 ]; then
echo "Error: There was a problem cloning the dotfiles repository! Try running this script again." 1>&2;
exit 1
fi
read -p "Use SSH remote for the dotfiles repository? [y/n] " -e USE_SSH_REMOTE
if [[ $USE_SSH_REMOTE =~ ^[Yy]$ ]]; then
git -C "$path" remote set-url origin [email protected]:gardart/minidot.git
fi
"$path"/install.sh
install_exit_code=$?
echo "================================================================================"
if [ $install_exit_code -ne 0 ]; then
echo "An error occurred during dotfiles installation." 1>&2;
exit 1
else
echo "The dotfiles were successfully installed! Enjoy!"
fi