-
Notifications
You must be signed in to change notification settings - Fork 35
/
os-setup
executable file
·55 lines (48 loc) · 2.19 KB
/
os-setup
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
#!/usr/bin/env bash
#
# Maintainer: Jorge Morales <jmorales@redhat.com>
#
#
# Functions
. /scripts/base/common_functions
must_run_as_root
load_configuration
OS-Setup(){
if marker_check "os.status"; then
if [ "$(which dnf)" = "" ]
then
# Using centos 7
# Enable go-lang 1.6 until official
curl -skL https://copr.fedorainfracloud.org/coprs/jcajka/golang1.6/repo/epel-7/jcajka-golang1.6-epel-7.repo -o /etc/yum.repos.d/jcajka-golang1.6-epel-7.repo
# Enable epel repository
yum install -y epel-release
# Install additional packages
yum install -y docker${__OS_DOCKER_VERSION:+-${__OS_DOCKER_VERSION}} git golang bind-utils bash-completion htop nfs-utils; yum clean all
# TODO: Maybe update the whole box with: yum update
else
# Using fedora 23+
# Enable go-lang 1.6 until official
dnf copr -y enable jcajka/golang1.6
# Install additional packages
dnf install -y docker${__OS_DOCKER_VERSION:+-${__OS_DOCKER_VERSION}} git golang bind-utils bash-completion htop nfs-utils; dnf clean all
# TODO: Maybe update the whole box with: dnf update
fi
# Install jq for json parsing
curl --fail --silent --location --retry 3 \
https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 \
-o /usr/bin/jq \
&& chmod 755 /usr/bin/jq
# Fail if commands have not been installed
[ "$(which docker)" = "" ] && echo "[ERROR] Docker is not properly installed" && exit 1
[ "$(which git)" = "" ] && echo "[ERROR] Git is not properly installed" && exit 1
[ "$(which go)" = "" ] && echo "[ERROR] Go is not properly installed" && exit 1
[ "$(which jq)" = "" ] && echo "[ERROR] jq is not properly installed" && exit 1
# Update journal size so it doesn't grow forever
sed -i -e "s/.*SystemMaxUse.*/SystemMaxUse=${__OS_JOURNAL_SIZE}/" /etc/systemd/journald.conf
systemctl restart systemd-journald
# Add go environment to be able to build
echo 'export GOPATH=/go' > /etc/profile.d/go.sh
echo 'export PATH=$PATH:$GOROOT/bin:$GOPATH/bin' >> /etc/profile.d/go.sh
marker_create "os.status"
fi
}