-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbootstrap-appliance.sh
executable file
·53 lines (44 loc) · 1.43 KB
/
bootstrap-appliance.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
#!/bin/bash
usage(){
cat << EOF
Usage: $0 [--branch branchname] --yes [optional salt-call parameter]
install the appliance from scratch.
EOF
exit 1
}
branch=master
if test "$1" = "--branch"; then
branch="$2"
shift 2
fi
if test "$1" != "--yes"; then usage; fi
shift
cd /tmp
export DEBIAN_FRONTEND=noninteractive
export LANG=en_US.UTF-8
timedatectl set-timezone "Europe/Vienna"
printf "LANG=en_US.UTF-8\nLANGUAGE=en_US:en\nLC_MESSAGES=POSIX\n" > /etc/default/locale
for i in apt-daily.service apt-daily.timer unattended-upgrades.service; do
systemctl disable $i
systemctl stop $i
ln -sf /dev/null /etc/systemd/system/$i
done
systemctl daemon-reload
apt-get -y update
apt-get -y install software-properties-common locales git gosu curl
locale-gen en_US.UTF-8 de_DE.UTF-8 && dpkg-reconfigure locales
export HOME=/app
adduser --disabled-password --gecos ",,," --home "/app" app
cp -r /etc/skel/. /app/.
if test ! -f /app/appliance; then
gosu app git clone https://github.com/ecs-org/ecs-appliance /app/appliance
fi
gosu app git -C /app/appliance fetch -a -p
gosu app git -C /app/appliance checkout -f $branch
gosu app git -C /app/appliance reset --hard origin/$branch
mkdir -p /etc/salt
cp /app/appliance/salt/minion /etc/salt/minion
curl -o /tmp/bootstrap_salt.sh -L https://bootstrap.saltstack.com
chmod +x /tmp/bootstrap_salt.sh
/tmp/bootstrap_salt.sh -X
salt-call state.highstate pillar='{"appliance": {"enabled": true}}' "$@"