This repository has been archived by the owner on Mar 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
94 lines (79 loc) · 2.5 KB
/
Makefile
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#
# Makefile
#
ITEMS=src/items/*.items
RULES=src/rules/*.rules
SITEMAPS=src/sitemaps/*.sitemap
DOCKER_IMAGE="openhab/openhab:amd64-online"
#DOCKER_IMAGE="cyberkov/openhab:amd64-offline"
CONTAINER_NAME="openhab2"
#VOLUMES=-v /opt/openhab/config/keystore/keystore:/openhab/userdata/etc/keystore:ro -v /opt/openhab/userdata:/openhab/userdata -v /opt/openhab/config:/openhab/conf:ro
#VOLUMES=-v /opt/openhab/config:/openhab/conf:ro
VOLUMES=-v /opt/openhab/userdata:/openhab/userdata \
-v /opt/openhab/config:/openhab/conf \
-v /opt/openhab/addons:/openhab/addons
#VOLUMES=-v /opt/openhab/config/keystore/keystore:/openhab/userdata/etc/keystore:ro -v /opt/openhab/config:/openhab/conf:ro
.PHONY: all update pull run clean purgelogs config
all: update pull purge run
config: items sitemaps rules
items: items/all.items
items/all.items: $(ITEMS)
for ITEM in src/items/*.items; do \
echo "// FILE: $$ITEM" >> [email protected]; \
cat $$ITEM | egrep -v '^//|^$$' >> [email protected]; \
done
mv [email protected] $@
sitemaps: sitemaps/default.sitemap
sitemaps/default.sitemap: $(SITEMAPS)
for ITEM in src/sitemaps/*.sitemap; do \
echo "// FILE: $$ITEM" >> [email protected]; \
cat $$ITEM | egrep -v '^//|^$$' >> [email protected]; \
done
mv [email protected] $@
rules: rules-override
#rules/all.rules: $(RULES)
# for ITEM in src/rules/*.rules; do \
# echo "// FILE: $$ITEM" >> [email protected]; \
# cat $$ITEM | egrep -v '^//|^$$' >> [email protected]; \
# done
# mv [email protected] $@
rules-override:
rsync -a --delete src/rules/*.rules rules/
update:
git pull
blackbox_postdeploy
make rules items sitemaps
pull:
docker pull $(DOCKER_IMAGE)
run: config
/usr/bin/docker run \
--rm \
--net host \
-m 2048m \
-p 8080:8080 -p 5555:5555 -p 9123:9123 \
-e EXTRA_JAVA_OPTS='-Xmx2048m' \
-v '/etc/localtime:/etc/localtime:ro' \
-v '/etc/timezone:/etc/timezone:ro' \
-it \
$(VOLUMES) \
--device=$(shell realpath /dev/ttyUSBrfxcom0) \
--device=$(shell realpath /dev/ttyUSBzwave0) \
--name $(CONTAINER_NAME) \
$(DOCKER_IMAGE) \
debug
# -u root \
clean:
-rm items/*.items
-rm sitemaps/*.sitemap
-rm rules/*.rules
-rm -Rf /opt/openhab/userdata
make phoenix
purge:
rm -Rf /opt/openhab/userdata/logs/*
chown cyberkov:cyberkov -R /opt/openhab/userdata/
phoenix:
mkdir -p /opt/openhab/userdata/logs
mkdir -p /opt/openhab/userdata/persistence/mapdb
chown cyberkov:cyberkov -R /opt/openhab/userdata/
habmin:
curl -Lo /opt/openhab/addons/org.openhab.ui.habmin_2.0.0.SNAPSHOT-0.1.2.jar https://github.com/cdjackson/HABmin2/raw/master/output/org.openhab.ui.habmin_2.0.0.SNAPSHOT-0.1.2.jar