-
Notifications
You must be signed in to change notification settings - Fork 0
/
easybutton.sh
59 lines (53 loc) · 1.42 KB
/
easybutton.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
#!/bin/bash
set -e
if [ "$(whoami)" != 'root' ]; then
echo "must be run as root"
exit 1
fi
# Check for an Internet Connection as it is required during installation
HTTP_HOST=http://github.com
if [ -x "$(which wget)" ]; then
echo "Checking for an Internet connection"
if [[ "$(wget -q --tries=3 --timeout=10 --spider $HTTP_HOST)" -eq 0 ]]; then
echo "$HTTP_HOST appears to be available via HTTP"
else
echo "$HTTP_HOST does not appear to be available via HTTP"
echo "Exiting installation"
exit 1
fi
else
echo "/usr/bin/wget does not exist, skipping Internet connection test"
fi
# archive old versions
bash archive_old_versions.sh
if [ -f /etc/lsb-release ]; then
# shellcheck disable=SC1091
. /etc/lsb-release
OS=$DISTRIB_ID
VER=$DISTRIB_RELEASE
elif [ -f /etc/debian_version ]; then
OS=Debian # XXX or Ubuntu??
VER=$(cat /etc/debian_version)
elif [ -f /etc/centos-release ]; then
# shellcheck disable=SC1091
. /etc/os-release
OS=$NAME
VER=$VERSION_ID
elif [ -f /etc/redhat-release ]; then
# shellcheck disable=SC1091
. /etc/os-release
OS=$NAME
VER=$VERSION_ID
else
OS=$(uname -s)
VER=$(uname -r)
fi
case $OS in
"Ubuntu" )
if [ "$VER" == "22.04" ]; then
cd ./Ansible/ubuntu22
bash bootstrap.sh
else
echo "Currently only 22.04 LTS (Server) is supported"
fi;;
esac