forked from adobe-platform/mesos-systemd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit
More file actions
executable file
·61 lines (48 loc) · 1.72 KB
/
init
File metadata and controls
executable file
·61 lines (48 loc) · 1.72 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
#!/usr/bin/bash
echo "-------Beginning bootstrap script-------"
if [ -z "$1" ]; then
VERSION="v2"
else
VERSION="$1"
fi
echo "Using version: $VERSION"
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
HOMEDIR=$(eval echo "~`whoami`")
bash ${SCRIPTDIR}/$VERSION/util/setup-credentials.sh
if [ -f /etc/environment ]; then
source /etc/environment
fi
if [ "$NODE_ROLE" = "control" ]; then
sudo bash ${SCRIPTDIR}/$VERSION/util/etcd2-setup.sh $SCRIPTDIR
fi
if [ "$NODE_ROLE" = "it-hybrid" ]; then
sudo bash ${SCRIPTDIR}/itv1/util/etcd2-setup.sh $SCRIPTDIR
fi
# 4 == 404 - key not found
etcdctl get /environment/SCRIPTS-FORK
if [[ $? = 4 ]]; then
etcdctl set /environment/SCRIPTS-FORK adobe-platform
etcdctl set /environment/SCRIPTS-REV $(cd $SCRIPTDIR && git branch|grep '\*'|cut -d' ' -f2 && cd -)
fi
if [ ! -d /etc/profile.d ]; then
sudo mkdir /etc/profile.d
fi
# copy over files first, ignore errors thrown from directories
sudo cp ${SCRIPTDIR}/$VERSION/profile.d/* /etc/profile.d/. 2>/dev/null || :
sudo cp --dereference ${SCRIPTDIR}/$VERSION/profile.d/${NODE_ROLE}/* /etc/profile.d/.
for script in $(ls ${SCRIPTDIR}/$VERSION/setup|grep -e '.sh$')
do
sudo /bin/bash ${SCRIPTDIR}/$VERSION/setup/${script}
done
# fleet units specific to this node
for unit in $(ls ${SCRIPTDIR}/$VERSION/fleet-local/${NODE_ROLE}|grep -e '.service$')
do
sudo fleetctl submit "${SCRIPTDIR}/$VERSION/fleet-local/${NODE_ROLE}/${unit}"
sudo fleetctl start "${unit%.service}${COREOS_PRIVATE_IPV4}"
done
# general-purpose units
for unit in $(ls ${SCRIPTDIR}/$VERSION/fleet|grep -e '.service$\|.timer$')
do
sudo fleetctl submit ${SCRIPTDIR}/$VERSION/fleet/${unit}
sudo fleetctl start ${SCRIPTDIR}/$VERSION/fleet/${unit}
done