-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·75 lines (68 loc) · 2.16 KB
/
install
File metadata and controls
executable file
·75 lines (68 loc) · 2.16 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
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
verbose=false
# Usage help
while getopts ":hv" OPTION; do
case ${OPTION} in
h) echo "Enabled options are '-h' for this message and '-v' for for verbose mode"; exit 0 ;;
v) verbose=true ;;
esac
done
shift $(( OPTIND - 1 ))
#Include functions
source scripts/functions
# OS detection
UNAME=$(uname -a | sed -E 's/ .*//')
if [[ ${UNAME} == 'Darwin' ]]; then
run echo "Machine type is Mac..."
source scripts/mac
if [[ $? -ne 0 ]]; then
echo "Error while executing Mac installer, aborting..."
exit 1
fi
ZSH_PATH="/usr/local/bin/zsh"
# Fix for font cache reset failure due to fontconfig error
FONTCONFIG_PATH=/opt/X11/lib/X11/fontconfig
elif [[ ${UNAME} == 'Linux' ]]; then
run echo "Machine type is Linux..."
source scripts/linux
if [[ $? -ne 0 ]]; then
echo "Error while executing Linux installer, aborting..."
exit 1
fi
ZSH_PATH="/bin/zsh"
else
echo "Could not detect Operating System. Aborting."
exit 1
fi
# Start OS agnostic configuration
run echo "Executing OS agnostic configuration"
source scripts/agnostic
# Change shell to zsh
if [[ $SHELL != ${ZSH_PATH} ]]; then
if [[ ! -e ${ZSH_PATH} ]]; then
echo "Couldn't find zsh at $ZSH_PATH, please install..."
else
run grep ${ZSH_PATH} /etc/shells
if [[ $? -ne 0 ]]
then
run echo "Adding $ZSH_PATH to /etc/shells, password may be requested..."
echo ${ZSH_PATH} | sudo tee -a /etc/shells
fi
run echo "Changing shell to zsh..."
if [[ $UID == 0 ]]; then
USER="root"
fi
run sudo chsh -s "$ZSH_PATH" "$USER"
fi
else
run echo "Shell already set up to zsh"
fi
# Update .zshrc according to environment
# TODO: Need to rearrange this function's location
if [[ ${UNAME} == 'Darwin' ]]; then
sed -i -e "s/^plugins=.*/plugins=\(aws brew cp fabric gitfast knife osx pip ruby rvm sudo\)/g" ~/.zshrc
elif [[ -e /etc/arch-release ]]; then
sed -i -e "s/^plugins=.*/plugins=\(archlinux docker docker-compose gitfast pip sudo\)/g" ~/.zshrc
else
sed -i -e "s/^plugins=.*/plugins=\(gitfast pip sudo\)/g" ~/.zshrc
fi