File tree Expand file tree Collapse file tree 7 files changed +19
-157
lines changed
Expand file tree Collapse file tree 7 files changed +19
-157
lines changed Original file line number Diff line number Diff line change 1- # DEB PACKAGES
1+ # Linux PACKAGES
22* .deb
3+ * .rpm
4+ dist /
35
46# Test files
57/output
Original file line number Diff line number Diff line change 2626 .venv/ bin/ python3 -m pylint operations
2727 .venv/ bin/ python3 -m pylint tedge_modbus
2828
29+ # Build linux packages
30+ build :
31+ mkdir -p dist/
32+ nfpm package --packager deb --target dist/
33+ nfpm package --packager rpm --target dist/
34+
2935# Build deb package
3036setup :
3137 @ mkdir -p ./ tests/ data
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ contents:
5858overrides :
5959 deb :
6060 depends :
61+ - tedge (>= 1.2.0)
6162 - python (>= 3.8.0) | python3 (>= 3.8.0)
6263 - python3-paho-mqtt
6364 - python3-pymodbus
@@ -72,6 +73,7 @@ overrides:
7273 postremove : ./scripts/deb/postrm
7374 rpm :
7475 depends :
76+ - tedge >= 1.2.0
7577 - python3
7678 - python3-paho-mqtt
7779 - python3-pymodbus
Original file line number Diff line number Diff line change 11#! /bin/sh
22set -e
33
4- add_smartrest_template () {
5- # Add a new Cumulocity IoT SmartRest template to the thin-edge.io settings
6- template_name=" $1 "
7- EXISTING_TEMPLATES=$( tedge config get c8y.smartrest.templates | tr -d ' \\[]" ' )
8- UPDATED_TEMPLATES=
9-
10- if [ -z " $template_name " ]; then
11- echo " Invalid template name given. Template name must not be empty." >&2
12- return 1
13- fi
14-
15- EXISTS=0
16- if [ -n " $EXISTING_TEMPLATES " ]; then
17- for value in $( echo " $EXISTING_TEMPLATES " | tr ' ,' ' \n ' ) ; do
18- if [ " $value " = " $template_name " ]; then
19- EXISTS=1
20- break
21- fi
22- done
23- fi
24-
25- if [ " $EXISTS " -eq 1 ]; then
26- echo " c8y.smartrest.template has already been added. name=$template_name " >&2
27- return
28- fi
29-
30- if [ -n " $EXISTING_TEMPLATES " ]; then
31- UPDATED_TEMPLATES=" ${EXISTING_TEMPLATES} ,$template_name "
32- else
33- UPDATED_TEMPLATES=" $template_name "
34- fi
35-
36- if [ -n " $UPDATED_TEMPLATES " ]; then
37- tedge config set c8y.smartrest.templates " $UPDATED_TEMPLATES "
38- tedge refresh-bridges
39- fi
40- }
41-
42- add_smartrest_template modbus
4+ tedge config add c8y.smartrest.templates modbus
5+ tedge refresh-bridges
436
447# Automatically added by thin-edge.io
458if [ " $1 " = " configure" ] || [ " $1 " = " abort-upgrade" ] || [ " $1 " = " abort-deconfigure" ] || [ " $1 " = " abort-remove" ] ; then
Original file line number Diff line number Diff line change @@ -20,44 +20,7 @@ if [ "$1" = "purge" ]; then
2020fi
2121# End automatically added section
2222
23- remove_smartrest_template () {
24- # Add a new Cumulocity IoT SmartRest template to the thin-edge.io settings
25- template_name=" $1 "
26- EXISTING_TEMPLATES=$( tedge config get c8y.smartrest.templates | tr -d ' \\[]" ' )
27- UPDATED_TEMPLATES=
28-
29- if [ -z " $template_name " ]; then
30- echo " Invalid template name given. Template name must not be empty." >&2
31- return 1
32- fi
33-
34- UPDATE_TEMPLATES=
35- if [ -n " $EXISTING_TEMPLATES " ]; then
36- for value in $( echo " $EXISTING_TEMPLATES " | tr ' ,' ' \n ' ) ; do
37- if [ " $value " != " $template_name " ]; then
38- if [ -n " $UPDATE_TEMPLATES " ]; then
39- UPDATE_TEMPLATES=" ${UPDATE_TEMPLATES} ,${value} "
40- else
41- UPDATE_TEMPLATES=" ${value} "
42- fi
43- fi
44- done
45- fi
46-
47- if [ " $UPDATE_TEMPLATES " = " $EXISTING_TEMPLATES " ]; then
48- echo " c8y.smartrest.template does not contain the template. name=$template_name " >&2
49- return
50- fi
51-
52- echo " Removing c8y.smartrest.template. name=$template_name " >&2
53- if [ -n " $UPDATED_TEMPLATES " ]; then
54- tedge config set c8y.smartrest.templates " $UPDATED_TEMPLATES "
55- else
56- tedge config unset c8y.smartrest.templates
57- fi
58- tedge refresh-bridges
59- }
60-
6123if [ " $1 " = " remove" ]; then
62- remove_smartrest_template modbus
24+ tedge config remove c8y.smartrest.templates modbus
25+ tedge refresh-bridges
6326fi
Original file line number Diff line number Diff line change 11#! /bin/sh
22set -e
33
4- add_smartrest_template () {
5- # Add a new Cumulocity IoT SmartRest template to the thin-edge.io settings
6- template_name=" $1 "
7- EXISTING_TEMPLATES=$( tedge config get c8y.smartrest.templates | tr -d ' \\[]" ' )
8- UPDATED_TEMPLATES=
9-
10- if [ -z " $template_name " ]; then
11- echo " Invalid template name given. Template name must not be empty." >&2
12- return 1
13- fi
14-
15- EXISTS=0
16- if [ -n " $EXISTING_TEMPLATES " ]; then
17- for value in $( echo " $EXISTING_TEMPLATES " | tr ' ,' ' \n ' ) ; do
18- if [ " $value " = " $template_name " ]; then
19- EXISTS=1
20- break
21- fi
22- done
23- fi
24-
25- if [ " $EXISTS " -eq 1 ]; then
26- echo " c8y.smartrest.template has already been added. name=$template_name " >&2
27- return
28- fi
29-
30- if [ -n " $EXISTING_TEMPLATES " ]; then
31- UPDATED_TEMPLATES=" ${EXISTING_TEMPLATES} ,$template_name "
32- else
33- UPDATED_TEMPLATES=" $template_name "
34- fi
35-
36- if [ -n " $UPDATED_TEMPLATES " ]; then
37- tedge config set c8y.smartrest.templates " $UPDATED_TEMPLATES "
38- tedge refresh-bridges
39- fi
40- }
41-
42- add_smartrest_template modbus
4+ tedge config add c8y.smartrest.templates modbus
5+ tedge refresh-bridges
436
447# Automatically added by thin-edge.io
458if [ $1 -eq 1 ] && [ -x " /usr/lib/systemd/systemd-update-helper" ]; then
Original file line number Diff line number Diff line change 1313
1414# End automatically added section
1515
16- remove_smartrest_template () {
17- # Add a new Cumulocity IoT SmartRest template to the thin-edge.io settings
18- template_name=" $1 "
19- EXISTING_TEMPLATES=$( tedge config get c8y.smartrest.templates | tr -d ' \\[]" ' )
20- UPDATED_TEMPLATES=
21-
22- if [ -z " $template_name " ]; then
23- echo " Invalid template name given. Template name must not be empty." >&2
24- return 1
25- fi
26-
27- UPDATE_TEMPLATES=
28- if [ -n " $EXISTING_TEMPLATES " ]; then
29- for value in $( echo " $EXISTING_TEMPLATES " | tr ' ,' ' \n ' ) ; do
30- if [ " $value " != " $template_name " ]; then
31- if [ -n " $UPDATE_TEMPLATES " ]; then
32- UPDATE_TEMPLATES=" ${UPDATE_TEMPLATES} ,${value} "
33- else
34- UPDATE_TEMPLATES=" ${value} "
35- fi
36- fi
37- done
38- fi
39-
40- if [ " $UPDATE_TEMPLATES " = " $EXISTING_TEMPLATES " ]; then
41- echo " c8y.smartrest.template does not contain the template. name=$template_name " >&2
42- return
43- fi
44-
45- echo " Removing c8y.smartrest.template. name=$template_name " >&2
46- if [ -n " $UPDATED_TEMPLATES " ]; then
47- tedge config set c8y.smartrest.templates " $UPDATED_TEMPLATES "
48- else
49- tedge config unset c8y.smartrest.templates
50- fi
51- tedge refresh-bridges
52- }
53-
5416if [ " $1 " = " 0" ]; then
55- remove_smartrest_template modbus
17+ tedge config remove c8y.smartrest.templates modbus
18+ tedge refresh-bridges
5619fi
You can’t perform that action at this time.
0 commit comments