-
Notifications
You must be signed in to change notification settings - Fork 17
/
setup.sh
executable file
·58 lines (50 loc) · 1.37 KB
/
setup.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
#!/bin/bash
# DETECT OS
# Shamelessly copied from stackoverflow:
# https://stackoverflow.com/questions/394230/how-to-detect-the-os-from-a-bash-script
# =================================================================================
lowercase() {
echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
}
OS="$(lowercase "$(uname)")"
KERNEL="$(uname -r)"
MACH="$(uname -m)"
if [ "${OS}" = "darwin" ]; then
OS='mac'
else
OS="$(uname)"
if [ "${OS}" = "Linux" ]; then
if [ -f /etc/debian_version ]; then
DISTRO_BASE='debian'
DIST=$(grep '^DISTRIB_ID' </etc/lsb-release | awk -F= '{ print $2 }')
fi
if [ -f /etc/UnitedLinux-release ]; then
DIST="${DIST}[$(tr "\n" ' ' </etc/UnitedLinux-release | sed s/VERSION.*//)]"
fi
OS="$(lowercase "$OS")"
readonly OS
readonly DIST
readonly DISTRO_BASE
readonly KERNEL
readonly MACH
fi
fi
echo
echo "==========================================="
echo "$OS"
echo "$DISTRO_BASE"
echo "$DIST"
echo "$KERNEL"
echo "$MACH"
echo "==========================================="
echo
echo 'Installing shared steps...'
./installer/shared.sh
if [[ $DISTRO_BASE = 'debian' ]]; then
echo "Debian based distro detected, getting required packages..."
./installer/debian-setup.sh
elif [[ $OS = 'mac' ]]; then
echo 'macOS detected'
./installer/mac-setup.sh
fi
ruby installer.rb "$@"