-
Notifications
You must be signed in to change notification settings - Fork 0
/
post_install.sh
executable file
·48 lines (41 loc) · 1.18 KB
/
post_install.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
#!/bin/bash
#
# Copyright 2019 6WIND S.A.
#
CONTAINER=0
# check runtime env is a container
if cat /proc/1/sched | egrep 'docker|lxc' 2>&1 > /dev/null; then
CONTAINER=1
elif [ -n "$container" ]; then
CONTAINER=1
else
for path in "/.dockerenv" "/.dockerinit"; do
if [ -f "$path" ]; then
CONTAINER=1
fi
done
fi
if [ $CONTAINER -eq 1 ]; then
FILE='/usr/bin/neutron-fastpath-agent-launcher.sh'
cat << EOF > $FILE
#!/bin/bash
set -xe
sudo -u neutron /usr/bin/python3 /usr/bin/neutron-fastpath-agent --config-file /etc/neutron/rootwrap.conf --config-file /etc/neutron/neutron.conf --config-dir /etc/neutron/conf.d/common --log-file /var/log/neutron/fastpath-agent.log &
EOF
chmod +x $FILE
else
cat << EOF > /etc/systemd/system/neutron-fastpath-agent.service
[Unit]
Description=6WIND Neutron Fast Path agent
After=virtual-accelerator.service
[Service]
User=neutron
PermissionsStartOnly=true
Type=simple
ExecStart=/usr/bin/neutron-fastpath-agent --config-file /etc/neutron/rootwrap.conf --config-file /etc/neutron/neutron.conf --config-dir /etc/neutron/conf.d/common --log-file /var/log/neutron/fastpath-agent.log
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
fi