From 01af92c19673d7c7d3f4a6daccc38410006fdf6e Mon Sep 17 00:00:00 2001 From: Mengyi Wang Date: Thu, 21 Jul 2022 10:36:05 +0200 Subject: [PATCH 1/2] refactor(snap): edgex-snap-hooks related upgrade Signed-off-by: Mengyi Wang --- snap/hooks/configure | 3 + snap/hooks/install | 3 + snap/hooks/pre-refresh | 6 - snap/local/.gitkeep | 0 .../source-env-file.sh} | 13 +- snap/local/helper-go/Makefile | 10 ++ .../const.go => helper-go/configure.go} | 41 ++++++- snap/local/helper-go/go.mod | 5 + snap/local/{hooks => helper-go}/go.sum | 13 +- snap/local/helper-go/install.go | 47 +++++++ snap/local/helper-go/main.go | 32 +++++ snap/local/hooks/Makefile | 17 --- snap/local/hooks/cmd/configure/configure.go | 110 ----------------- snap/local/hooks/cmd/install/install.go | 115 ------------------ snap/local/hooks/go.mod | 11 -- snap/snapcraft.yaml | 39 +++--- 16 files changed, 175 insertions(+), 290 deletions(-) create mode 100644 snap/hooks/configure create mode 100644 snap/hooks/install delete mode 100755 snap/hooks/pre-refresh delete mode 100644 snap/local/.gitkeep rename snap/local/{runtime-helpers/bin/startup-env-var.sh => bin/source-env-file.sh} (65%) create mode 100644 snap/local/helper-go/Makefile rename snap/local/{hooks/const.go => helper-go/configure.go} (67%) create mode 100644 snap/local/helper-go/go.mod rename snap/local/{hooks => helper-go}/go.sum (57%) create mode 100644 snap/local/helper-go/install.go create mode 100644 snap/local/helper-go/main.go delete mode 100644 snap/local/hooks/Makefile delete mode 100644 snap/local/hooks/cmd/configure/configure.go delete mode 100644 snap/local/hooks/cmd/install/install.go delete mode 100644 snap/local/hooks/go.mod diff --git a/snap/hooks/configure b/snap/hooks/configure new file mode 100644 index 00000000..074e47e4 --- /dev/null +++ b/snap/hooks/configure @@ -0,0 +1,3 @@ +#!/bin/bash -e + +exec $SNAP/bin/helper-go configure diff --git a/snap/hooks/install b/snap/hooks/install new file mode 100644 index 00000000..76761239 --- /dev/null +++ b/snap/hooks/install @@ -0,0 +1,3 @@ +#!/bin/bash -e + +exec $SNAP/bin/helper-go install \ No newline at end of file diff --git a/snap/hooks/pre-refresh b/snap/hooks/pre-refresh deleted file mode 100755 index 9e9848de..00000000 --- a/snap/hooks/pre-refresh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -e - -# save this revision for when we run again in the post-refresh -snapctl set lastrev="$SNAP_REVISION" - -snapctl set release="ireland" diff --git a/snap/local/.gitkeep b/snap/local/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/snap/local/runtime-helpers/bin/startup-env-var.sh b/snap/local/bin/source-env-file.sh similarity index 65% rename from snap/local/runtime-helpers/bin/startup-env-var.sh rename to snap/local/bin/source-env-file.sh index 8b2d4af1..43c13a67 100755 --- a/snap/local/runtime-helpers/bin/startup-env-var.sh +++ b/snap/local/bin/source-env-file.sh @@ -20,11 +20,14 @@ BINPATH="${ARGV[0]}" # binary name == service name/key SERVICE=$(basename "$BINPATH") -SERVICE_ENV="$SNAP_DATA/config/$SERVICE/res/$SERVICE.env" - -if [ -f "$SERVICE_ENV" ]; then - logger "edgex service override: : sourcing $SERVICE_ENV" - source "$SERVICE_ENV" +ENV_FILE="$SNAP_DATA/config/$SERVICE/res/$SERVICE.env" +TAG="edgex-$SERVICE."$(basename "$0") + +if [ -f "$ENV_FILE" ]; then + logger --tag=$TAG "sourcing $ENV_FILE" + set -o allexport + source "$ENV_FILE" set + set +o allexport fi exec "$@" diff --git a/snap/local/helper-go/Makefile b/snap/local/helper-go/Makefile new file mode 100644 index 00000000..5706aa07 --- /dev/null +++ b/snap/local/helper-go/Makefile @@ -0,0 +1,10 @@ + +build: + go build -ldflags="-s -w" -o helper-go + +tidy: + go mod tidy + +clean: + rm -f helper-go + diff --git a/snap/local/hooks/const.go b/snap/local/helper-go/configure.go similarity index 67% rename from snap/local/hooks/const.go rename to snap/local/helper-go/configure.go index 3ec4c8ea..5d519496 100644 --- a/snap/local/hooks/const.go +++ b/snap/local/helper-go/configure.go @@ -16,7 +16,13 @@ * SPDX-License-Identifier: Apache-2.0' */ -package hooks +package main + +import ( + hooks "github.com/canonical/edgex-snap-hooks/v2" + "github.com/canonical/edgex-snap-hooks/v2/log" + "github.com/canonical/edgex-snap-hooks/v2/options" +) // ConfToEnv defines mappings from snap config keys to EdgeX environment variable // names that are used to override individual device-rfid-llrp's [Device] configuration @@ -50,3 +56,36 @@ var ConfToEnv = map[string]string{ // It is especially important to have this configured in the case of larger subnets such as /16 and /8 "app-custom.max-discover-duration-seconds": "APPCUSTOM_MAXDISCOVERDURATIONSECONDS", } + +// configure is called by the main function +func configure() { + + const service = "device-rfid-llrp" + + log.SetComponentName("configure") + + log.Info("Processing legacy env options") + envJSON, err := hooks.NewSnapCtl().Config(hooks.EnvConfig) + if err != nil { + log.Fatalf("Reading config 'env' failed: %v", err) + } + if envJSON != "" { + log.Debugf("envJSON: %s", envJSON) + err = hooks.HandleEdgeXConfig(service, envJSON, ConfToEnv) + if err != nil { + log.Fatalf("HandleEdgeXConfig failed: %v", err) + } + } + + log.Info("Processing config options") + err = options.ProcessConfig(service) + if err != nil { + log.Fatalf("could not process config options: %v", err) + } + + log.Info("Processing autostart options") + err = options.ProcessAutostart(service) + if err != nil { + log.Fatalf("could not process autostart options: %v", err) + } +} diff --git a/snap/local/helper-go/go.mod b/snap/local/helper-go/go.mod new file mode 100644 index 00000000..74f8137a --- /dev/null +++ b/snap/local/helper-go/go.mod @@ -0,0 +1,5 @@ +module github.com/edgexfoundry/device-rfid-llrp-go/snap/local/helper-go + +require github.com/canonical/edgex-snap-hooks/v2 v2.4.1 + +go 1.18 diff --git a/snap/local/hooks/go.sum b/snap/local/helper-go/go.sum similarity index 57% rename from snap/local/hooks/go.sum rename to snap/local/helper-go/go.sum index c0bdb1f1..dcfb3359 100644 --- a/snap/local/hooks/go.sum +++ b/snap/local/helper-go/go.sum @@ -1,15 +1,16 @@ -github.com/canonical/edgex-snap-hooks/v2 v2.2.0 h1:4pDnikrtyrxiynTM49+ppH7hXBx5C7dWUOjEEisCXmI= -github.com/canonical/edgex-snap-hooks/v2 v2.2.0/go.mod h1:rOxrwdYL7hJDhxFH3uV+nVgLPjWOhJWgM5PRD5YG1jI= +github.com/canonical/edgex-snap-hooks/v2 v2.4.1 h1:TFFF/mHkYTmUd040N8S4q/mp78CUZr1W3Cxx4uRpfOg= +github.com/canonical/edgex-snap-hooks/v2 v2.4.1/go.mod h1:8mjUKSAFNsXYvV0fcfOoYue1dSjTVeJYdaQYtA6pb6Y= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/snap/local/helper-go/install.go b/snap/local/helper-go/install.go new file mode 100644 index 00000000..3aa701ac --- /dev/null +++ b/snap/local/helper-go/install.go @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2022 Canonical Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + * SPDX-License-Identifier: Apache-2.0' + */ + +package main + +import ( + hooks "github.com/canonical/edgex-snap-hooks/v2" + "github.com/canonical/edgex-snap-hooks/v2/env" + "github.com/canonical/edgex-snap-hooks/v2/log" +) + +// installConfig copies all config files from $SNAP to $SNAP_DATA +func installConfig() error { + path := "/config/device-rfid-llrp/res" + + err := hooks.CopyDir( + env.Snap+path, + env.SnapData+path) + if err != nil { + return err + } + + return nil +} + +// install is called by the main function +func install() { + log.SetComponentName("install") + + err := installConfig() + if err != nil { + log.Fatalf("error installing config file: %s", err) + } +} diff --git a/snap/local/helper-go/main.go b/snap/local/helper-go/main.go new file mode 100644 index 00000000..86c43088 --- /dev/null +++ b/snap/local/helper-go/main.go @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2022 Canonical Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * SPDX-License-Identifier: Apache-2.0' + */ + +package main + +import ( + "os" +) + +func main() { + subCommand := os.Args[1] + switch subCommand { + case "install": + install() + case "configure": + configure() + default: + panic("Unknown subcommand: " + subCommand) + } +} diff --git a/snap/local/hooks/Makefile b/snap/local/hooks/Makefile deleted file mode 100644 index ff5c19f8..00000000 --- a/snap/local/hooks/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -GO=GO111MODULE=on go -HOOKS=cmd/configure/configure cmd/install/install - -build: tidy $(HOOKS) - -tidy: - go mod tidy - -cmd/configure/configure: - $(GO) build -o $@ ./cmd/configure - -cmd/install/install: - $(GO) build -o $@ ./cmd/install - -clean: - rm -f $(HOOKS) - diff --git a/snap/local/hooks/cmd/configure/configure.go b/snap/local/hooks/cmd/configure/configure.go deleted file mode 100644 index a0f283b4..00000000 --- a/snap/local/hooks/cmd/configure/configure.go +++ /dev/null @@ -1,110 +0,0 @@ -// -*- Mode: Go; indent-tabs-mode: t -*- - -/* - * Copyright (C) 2021 Canonical Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * - * SPDX-License-Identifier: Apache-2.0' - */ - -package main - -import ( - "fmt" - "os" - "strings" - - hooks "github.com/canonical/edgex-snap-hooks/v2" - "github.com/canonical/edgex-snap-hooks/v2/log" - "github.com/canonical/edgex-snap-hooks/v2/options" - local "github.com/edgexfoundry/device-rfid-llrp-go/hooks" -) - -var cli *hooks.CtlCli = hooks.NewSnapCtl() - -func main() { - var debug = false - var err error - var envJSON string - - status, err := cli.Config("debug") - if err != nil { - fmt.Println(fmt.Sprintf("edgex-device-rfid-llrp:configure: can't read value of 'debug': %v", err)) - os.Exit(1) - } - if status == "true" { - debug = true - } - - if err = hooks.Init(debug, "edgex-device-rfid-llrp"); err != nil { - fmt.Println(fmt.Sprintf("edgex-device-rfid-llrp:configure: initialization failure: %v", err)) - os.Exit(1) - - } - - log.SetComponentName("configure") - if err := options.ProcessAppConfig("device-rfid-llrp"); err != nil { - hooks.Error(fmt.Sprintf("could not process options: %v", err)) - os.Exit(1) - } - - cli := hooks.NewSnapCtl() - envJSON, err = cli.Config(hooks.EnvConfig) - if err != nil { - hooks.Error(fmt.Sprintf("Reading config 'env' failed: %v", err)) - os.Exit(1) - } - - if envJSON != "" { - hooks.Debug(fmt.Sprintf("edgex-device-rfid-llrp:configure: envJSON: %s", envJSON)) - err = hooks.HandleEdgeXConfig("device-rfid-llrp", envJSON, local.ConfToEnv) - if err != nil { - hooks.Error(fmt.Sprintf("HandleEdgeXConfig failed: %v", err)) - os.Exit(1) - } - } - - // If autostart is not explicitly set, default to "no" - // as only example service configuration and profiles - // are provided by default. - autostart, err := cli.Config(hooks.AutostartConfig) - if err != nil { - hooks.Error(fmt.Sprintf("Reading config 'autostart' failed: %v", err)) - os.Exit(1) - } - if autostart == "" { - hooks.Debug("edgex-device-rfid-llrp autostart is NOT set, initializing to 'no'") - autostart = "no" - } - autostart = strings.ToLower(autostart) - - hooks.Debug(fmt.Sprintf("edgex-device-rfid-llrp autostart is %s", autostart)) - - // service is stopped/disabled by default in the install hook - switch autostart { - case "true": - fallthrough - case "yes": - err = cli.Start("device-rfid-llrp", true) - if err != nil { - hooks.Error(fmt.Sprintf("Can't start service - %v", err)) - os.Exit(1) - } - case "false": - // no action necessary - case "no": - // no action necessary - default: - hooks.Error(fmt.Sprintf("Invalid value for 'autostart' : %s", autostart)) - os.Exit(1) - } -} diff --git a/snap/local/hooks/cmd/install/install.go b/snap/local/hooks/cmd/install/install.go deleted file mode 100644 index 01b4812e..00000000 --- a/snap/local/hooks/cmd/install/install.go +++ /dev/null @@ -1,115 +0,0 @@ -// -*- Mode: Go; indent-tabs-mode: t -*- - -/* - * Copyright (C) 2021 Canonical Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * - * SPDX-License-Identifier: Apache-2.0' - */ - -package main - -import ( - "fmt" - "os" - "path/filepath" - - hooks "github.com/canonical/edgex-snap-hooks/v2" -) - -var cli *hooks.CtlCli = hooks.NewSnapCtl() - -const LLRP_RES = "/config/device-rfid-llrp/res" - -func installFile(path string) error { - destFile := hooks.SnapData + LLRP_RES + path - srcFile := hooks.Snap + LLRP_RES + path - - err := os.MkdirAll(filepath.Dir(destFile), 0755) - if err != nil { - return err - } - err = hooks.CopyFile(srcFile, destFile) - - return err - -} - -// installProfiles copies the profile configuration.toml files from $SNAP to $SNAP_DATA. -func installConfig() error { - return installFile("/configuration.toml") -} - -func installProvisionWatchers() error { - - profs := [...]string{"impinj", "llrp"} - - for _, v := range profs { - path := fmt.Sprintf("/provision_watchers/%s.provision.watcher.json", v) - err := installFile(path) - if err != nil { - return err - } - } - return nil -} - -func installDevices() error { - //No device files - return os.MkdirAll(hooks.SnapData+LLRP_RES+"/devices", 0755) -} - -func installDevProfiles() error { - - profs := [...]string{"device", "impinj"} - for _, v := range profs { - path := fmt.Sprintf("/profiles/llrp.%s.profile.yaml", v) - err := installFile(path) - if err != nil { - return err - } - } - return nil -} - -func main() { - var err error - - if err = hooks.Init(false, "edgex-device-rfid-llrp"); err != nil { - fmt.Printf("edgex-device-rfid-llrp::install: initialization failure: %v\n", err) - os.Exit(1) - } - - err = installConfig() - if err != nil { - hooks.Error(fmt.Sprintf("edgex-device-rfid-llrp:install: %v", err)) - os.Exit(1) - } - - err = installDevices() - if err != nil { - hooks.Error(fmt.Sprintf("edgex-device-rfid-llrp:install: %v", err)) - os.Exit(1) - } - - err = installDevProfiles() - if err != nil { - hooks.Error(fmt.Sprintf("edgex-device-rfid-llrp:install: %v", err)) - os.Exit(1) - } - - err = installProvisionWatchers() - if err != nil { - hooks.Error(fmt.Sprintf("edgex-device-rfid-llrp:install: %v", err)) - os.Exit(1) - } -} diff --git a/snap/local/hooks/go.mod b/snap/local/hooks/go.mod deleted file mode 100644 index c9b9c93e..00000000 --- a/snap/local/hooks/go.mod +++ /dev/null @@ -1,11 +0,0 @@ -module github.com/edgexfoundry/device-rfid-llrp-go/hooks - -go 1.18 - -require github.com/canonical/edgex-snap-hooks/v2 v2.2.0 - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/stretchr/testify v1.7.1 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect -) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 99a2f770..a7ce5562 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,4 +1,4 @@ -name: edgex-device-rfid-llrp +name: edgex-device-rfid-llrp base: core20 adopt-info: metadata license: Apache-2.0 @@ -19,7 +19,6 @@ epoch: 4 slots: edgex-secretstore-token: interface: content - content: edgex-secretstore-token source: write: [$SNAP_DATA/device-rfid-llrp] @@ -38,7 +37,7 @@ apps: adapter: full command: bin/device-rfid-llrp $CONFIG_PRO_ARG $CONF_ARG $REGISTRY_ARG command-chain: - - bin/startup-env-var.sh + - bin/source-env-file.sh environment: CONFIG_PRO_ARG: "--cp=consul://localhost:8500" CONF_ARG: "--confdir=$SNAP_DATA/config/device-rfid-llrp/res" @@ -57,16 +56,15 @@ plugs: target: $SNAP_DATA/config/device-rfid-llrp parts: - hooks: - source: snap/local/hooks + helper-go: + source: snap/local/helper-go plugin: make build-snaps: - go/1.18/stable override-build: | cd $SNAPCRAFT_PART_SRC make build - install -DT ./cmd/configure/configure "$SNAPCRAFT_PART_INSTALL/snap/hooks/configure" - install -DT ./cmd/install/install "$SNAPCRAFT_PART_INSTALL/snap/hooks/install" + install -DT ./helper-go $SNAPCRAFT_PART_INSTALL/bin/helper-go device-rfid-llrp: after: [metadata] @@ -86,21 +84,24 @@ parts: make build install -DT ./cmd/device-rfid-llrp "$SNAPCRAFT_PART_INSTALL/bin/device-rfid-llrp" - install -DT ./Attribution.txt "$SNAPCRAFT_PART_INSTALL/usr/share/doc/device-rfid-llrp/Attribution.txt" - install -DT ./LICENSE "$SNAPCRAFT_PART_INSTALL/usr/share/doc/device-rfid-llrp/LICENSE" - - LLRP_RES_DIR="$SNAPCRAFT_PART_INSTALL/config/device-rfid-llrp/res/" - mkdir -p "$LLRP_RES_DIR/profiles" - mkdir -p "$LLRP_RES_DIR/devices" - mkdir -p "$LLRP_RES_DIR/provision_watchers" - cp ./cmd/res/configuration.toml "$LLRP_RES_DIR/" - cp ./cmd/res/profiles/*.yaml "$LLRP_RES_DIR/profiles/" - cp ./cmd/res/provision_watchers/*.json "$LLRP_RES_DIR/provision_watchers/" + RES=$SNAPCRAFT_PART_INSTALL/config/device-rfid-llrp/res/ + mkdir -p $RES + cp cmd/res/configuration.toml $RES + mkdir -p cmd/res/devices + cp -r cmd/res/profiles $RES + cp -r cmd/res/provision_watchers $RES + + DOC=$SNAPCRAFT_PART_INSTALL/usr/share/doc/device-rfid-llrp + mkdir -p $DOC + cp Attribution.txt $DOC/Attribution.txt + cp LICENSE $DOC/LICENSE - runtime-helpers: + local-bin: plugin: dump - source: snap/local/runtime-helpers + source: snap/local/bin + organize: + source-env-file.sh: bin/source-env-file.sh metadata: plugin: nil From 1e887eb43530cd453eb27616b163b144236ba774 Mon Sep 17 00:00:00 2001 From: Mengyi Wang Date: Thu, 21 Jul 2022 10:59:23 +0200 Subject: [PATCH 2/2] fix(snap): Add empty devices directory Signed-off-by: Mengyi Wang --- snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index a7ce5562..e3f614bb 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -87,8 +87,8 @@ parts: RES=$SNAPCRAFT_PART_INSTALL/config/device-rfid-llrp/res/ mkdir -p $RES + mkdir -p $RES/devices cp cmd/res/configuration.toml $RES - mkdir -p cmd/res/devices cp -r cmd/res/profiles $RES cp -r cmd/res/provision_watchers $RES