-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sh
70 lines (60 loc) · 1.52 KB
/
init.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
69
70
#!/bin/sh
#
# installer.init.sh
#
# Quickstart repo for setup and configurations
#
# Inspired from https://github.com/kevinelliott/.dotfiles/blob/master/install.sh
# Die on failures
set -e
# Check if package exists or not
is_installed () {
type "$1" &> /dev/null ;
}
function yes_or_no {
while true; do
read -p "$* [y/n]: " yn
case $yn in
[Yy]*) return 0 ;;
[Nn]*) echo -e "Aborted. Edit $brewFile and install using ./installer.sh" ; return 1;
esac
done
}
# Install or update homebrew
if is_installed brew; then
brew update
brew doctor
else
echo "Installing brew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
echo "brew installed"
fi
# Install CLI Mac App store
# if is_installed mas; then
# read -p 'Mac App store email: ' email
# # mas signin $email
# echo "Signed in ($email)"
# else
# echo "Installing mas"
# brew install mas
# echo "mas installed"
# read -p 'Mac App store email: ' email
# fi
DIR="$(cd "$(dirname "$0")" && pwd)"
echo "Removing Bloatware apps:"
sh $DIR/scripts/remove-bloat.sh
echo "Applying preferences:"
sh $DIR/scripts/preferences.sh
# Install brew bundle
brewFile="Brewfile"
if [ -f "$brewFile" ]
then
echo "$brewFile found, .$brewFile will be ignored."
sh ./installer.sh
else
echo "$brewFile not found, Creating a new $brewFile from .$brewFile."
cp ".$brewFile" "$brewFile"
echo "$brewFile will install the following packages:"
cat ".$brewFile"
yes_or_no "Continue installation?" && sh ./installer.sh
fi