-
Notifications
You must be signed in to change notification settings - Fork 462
/
.f12
executable file
·58 lines (50 loc) · 1.45 KB
/
.f12
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
#!/bin/bash
set -e
SITE=${SITE:-$(until [ $PWD == / ]; do if [ -e .site ]; then cat .site; break; else cd ..; fi; done)}
SITE=${SITE:-$(omd sites --bare | head -n 1)}
ROOT=/omd/sites/$SITE
CMK_VERSION=$(basename $(readlink $ROOT/version))
CMK_VERSION=${CMK_VERSION%.*}
echo "Update site $SITE..."
echo "Copy CRE files..."
sudo rsync \
--exclude=cee \
--exclude=cee.py \
--exclude=cme \
--exclude=cme.py \
-aR \
cee \
gui \
__init__.py \
notification_plugins \
special_agents \
update_config.py \
utils \
ec/__init__.py \
ec/export.py \
ec/settings.py \
ec/defaults.py \
$ROOT/lib/python/cmk/
# TODO: Enable python3 compatible parts step by step
sudo rsync \
--exclude=cee \
--exclude=cee.py \
--exclude=cme \
--exclude=cme.py \
-a __init__.py utils ec $ROOT/lib/python3/cmk/
# Restore site version after .f12
sudo sed -i "s|^__version__.*$|__version__ = \"$CMK_VERSION\"|g" $ROOT/lib/python/cmk/__init__.py
sudo sed -i "s|^__version__.*$|__version__ = \"$CMK_VERSION\"|g" $ROOT/lib/python3/cmk/__init__.py
sudo pycompile -q $ROOT/lib/python/cmk/
sudo py3compile -q $ROOT/lib/python3/cmk/
# Also deploy all other directories of same type
if [ ${ALL_EDITIONS:-1} != 0 ]; then
for WHAT in enterprise managed; do
if [ -e ../$WHAT/cmk/.f12 ]; then
(
cd ../$WHAT/cmk
ONLY_COPY=1 ALL_EDITIONS=0 bash .f12
)
fi
done
fi