-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·58 lines (45 loc) · 1.57 KB
/
install.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
#!/usr/bin/env bash
git clone https://github.com/lassemt/dotfiles.git ~/.dotfiles
cd ~/.dotfiles || exit
# Get the directory of the currently executing script
DIR=~/.dotfiles;
# Check if loader exist
if [[ ! -f "${DIR}/functions.sh" ]] ; then
echo "$(tput setaf 1)File ${DIR}/functions.sh is missing, aborting.$(tput sgr0)";
exit 1;
fi
# Load functions
source "${DIR}/functions.sh";
if ! [ -x "$(command -v stow)" ]; then
read -r -p "Stow is not installed, install it? (y/n)" installStow
if [ "$installStow" != "y" ]; then
echo_red "Aborting since stow is required."
exit 1
fi
fi
read -r -p "Install dependencies? (y/n)" installDependencies
read -r -p "Install applications? (y/n)" installApplications
read -r -p "Configure mac defaults? (y/n)" configureMac
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.macos` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
if [ "$installStow" == "y" ]; then
echo_cyan "Installing stow using brew"
brew install stow
fi
echo_cyan "Linking dotfiles using stow"
source "${DIR}/link.sh";
if [ "$installDependencies" == "y" ]; then
echo_cyan "Installing dependencies..."
source "${DIR}/dependencies.sh";
fi
if [ "$installApplications" == "y" ]; then
echo_cyan "Installing applications..."
source "${DIR}/applications.sh";
fi
if [ "$configureMac" == "y" ]; then
echo_cyan "Setting Macos configuration..."
source "${DIR}/macos.sh";
fi
echo_green "Done. Note that some of these changes require a logout/restart to take effect."