diff --git a/tools/onboard/README.md b/tools/onboard/README.md index 2ee4d2a..c0e48ee 100644 --- a/tools/onboard/README.md +++ b/tools/onboard/README.md @@ -20,6 +20,20 @@ You need: - **This computer on the Wi-Fi network** the device should use. Most devices only use 2.4 GHz networks. +## Install with go-c8y-cli + +The tool is also a go-c8y-cli extension. Install it with: + +```sh +c8y extensions install thin-edge/tiny-edge +``` + +Then start it with `c8y tinyedge onboard` instead of `./tedge-onboard`. It +takes the same options, and it uses your active go-c8y-cli session. Run +`c8y extensions upgrade tinyedge` to get a newer version. + +The rest of this section, apart from the download itself, still applies. + ## Download Download the file for your computer from the diff --git a/tools/onboard/build.sh b/tools/onboard/build.sh index 2062a46..74bd544 100755 --- a/tools/onboard/build.sh +++ b/tools/onboard/build.sh @@ -25,11 +25,12 @@ for target in "$@"; do CGO_ENABLED=$cgo GOOS=$goos GOARCH=$goarch \ go build -trimpath -ldflags "-s -w -X main.version=$version" \ -o "$out/$name" . - cp README.md "$out/" + cp README.md extension.yaml "$out/" if [ "$goos" = windows ]; then (cd dist && zip -qr "$(basename "$out").zip" "$(basename "$out")") else - tar -C dist -czf "$out.tar.gz" "$(basename "$out")" + # No macOS AppleDouble (._*) files: go-c8y-cli expects one top-level folder + COPYFILE_DISABLE=1 tar -C dist -czf "$out.tar.gz" "$(basename "$out")" fi rm -rf "$out" echo "built $out" diff --git a/tools/onboard/extension.yaml b/tools/onboard/extension.yaml new file mode 100644 index 0000000..aee001d --- /dev/null +++ b/tools/onboard/extension.yaml @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# go-c8y-cli extension manifest. build.sh puts it in each release archive, +# so the tool installs with: +# +# c8y extensions install thin-edge/tiny-edge +# +# and runs as "c8y tinyedge onboard". Add other tiny-edge host commands +# under "commands". +version: v1 +name: tinyedge +binary: + path: tedge-onboard +commands: + - name: onboard + description: Set up a device for Cumulocity over a USB cable + # tedge-onboard has no subcommands, so pass only the user's arguments + exec: []