Commit 82cece71 authored by Ian Johnson's avatar Ian Johnson Committed by Ian Johnson

snapcraft.yaml: add device-virtual-go to snap

Signed-off-by: default avatarIan Johnson <ian.johnson@canonical.com>
parent ce229c95
......@@ -30,6 +30,7 @@ ALL_SERVICES="$ALL_SERVICES export-client"
ALL_SERVICES="$ALL_SERVICES device-modbus"
ALL_SERVICES="$ALL_SERVICES device-mqtt"
ALL_SERVICES="$ALL_SERVICES device-random"
ALL_SERVICES="$ALL_SERVICES device-virtual"
# security services
ALL_SERVICES="$ALL_SERVICES security-secret-store"
......
......@@ -9,7 +9,7 @@ SNAP_CURRENT=${SNAP/%$SNAP_REVISION/current}
# install all the config files from $SNAP/config/SERVICE/res/configuration.toml
# into $SNAP_DATA/config
mkdir -p ${SNAP_DATA}/config
for service in security-api-gateway security-secret-store core-command config-seed core-data core-metadata export-client export-distro support-logging support-notifications support-scheduler sys-mgmt-agent device-modbus device-mqtt device-random; do
for service in security-api-gateway security-secret-store core-command config-seed core-data core-metadata export-client export-distro support-logging support-notifications support-scheduler sys-mgmt-agent device-modbus device-mqtt device-random device-virtual; do
if [ ! -f "${SNAP_DATA}/config/${service}/res/configuration.toml" ]; then
mkdir -p "${SNAP_DATA}/config/${service}/res"
cp ${SNAP}/config/${service}/res/configuration.toml "${SNAP_DATA}/config/${service}/res/configuration.toml"
......@@ -24,6 +24,11 @@ done
# handle device-random device profile
cp ${SNAP}/config/device-random/res/device.random.yaml "${SNAP_DATA}/config/device-random/res/device.random.yaml"
# handle device-virtual device profiles
for profileType in bool float int uint; do
cp "$SNAP/config/device-virtual/res/device.virtual.$profileType.yaml" "$SNAP_DATA/config/device-virtual/res/device.virtual.$profileType.yaml"
done
# also handle java services' application.properties
for jsvc in edgex-support-rulesengine; do
if [ ! -f "${SNAP_DATA}/config/config-seed/res/properties/$jsvc/application.properties" ]; then
......@@ -137,7 +142,7 @@ fi
# finally, disable and turn off non-default services
# by default, we want the export-*, support-*, device-*, and redis services
# off.
for svc in export-distro export-client support-notifications support-scheduler support-logging support-rulesengine device-modbus device-mqtt device-random redis; do
for svc in export-distro export-client support-notifications support-scheduler support-logging support-rulesengine device-modbus device-mqtt device-random device-virtual redis; do
# set the service as off, so that the setting is persistent after a refresh
# due to snapd bug: https://bugs.launchpad.net/snapd/+bug/1818306
snapctl set $svc=off
......
......@@ -298,6 +298,17 @@ apps:
command: bin/device-random -confdir $SNAP_DATA/config/device-random -profile res --registry
daemon: simple
plugs: [network, network-bind]
device-virtual:
adapter: none
after:
- core-config-seed
- mongo-worker
- edgexproxy
- core-data
- core-metadata
command: bin/device-virtual -confdir $SNAP_DATA/config/device-virtual -profile res --registry
daemon: simple
plugs: [network, network-bind]
# helper commands the snap exposes
redis-cli:
......@@ -1064,6 +1075,38 @@ parts:
install -DT "./LICENSE" \
"$SNAPCRAFT_PART_INSTALL/usr/share/doc/device-mqtt/LICENSE"
device-virtual-go:
source: https://github.com/edgexfoundry/device-virtual-go.git
source-depth: 1
source-branch: master
plugin: make
after: [go]
override-build: |
cd $SNAPCRAFT_PART_SRC
make build
install -DT "./cmd/device-virtual" "$SNAPCRAFT_PART_INSTALL/bin/device-virtual"
# FIXME: settings can't be overridden from the cmd-line!
# Override 'LogFile'
install -d "$SNAPCRAFT_PART_INSTALL/config/device-virtual/res/"
# install configuration & default device profile
cat "./cmd/res/configuration.toml" | \
sed -e s:\"./device-virtual.log\":\'\$SNAP_COMMON/device-virtual.log\': \
-e s:'ProfilesDir = \"./res\"':'ProfilesDir = \"\$SNAP_DATA/config/device-virtual/res\"': > \
"$SNAPCRAFT_PART_INSTALL/config/device-virtual/res/configuration.toml"
for profileType in bool float int uint; do
install -T "./cmd/res/device.virtual.$profileType.yaml" \
"$SNAPCRAFT_PART_INSTALL/config/device-virtual/res/device.virtual.$profileType.yaml"
done
install -DT "./cmd/Attribution.txt" \
"$SNAPCRAFT_PART_INSTALL/usr/share/doc/device-virtual/Attribution.txt"
install -DT "./LICENSE" \
"$SNAPCRAFT_PART_INSTALL/usr/share/doc/device-virtual/LICENSE"
device-random:
source: https://github.com/edgexfoundry/device-random.git
source-depth: 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment