Skip to content

Commit 273aae5

Browse files
authored
feat: aws greengrass integration (#22)
1 parent 4129b1f commit 273aae5

13 files changed

Lines changed: 162 additions & 13 deletions

File tree

.github/workflows/build-app-nightly.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,18 @@ jobs:
8888
path: |
8989
usbproxy/*.deb
9090
91+
- name: Create greengrass deployment package
92+
working-directory: usbproxy/src/build/greengrass/
93+
run: |
94+
zip usb-mitm.zip usb-mitm-gg
95+
96+
- name: Upload Release Asset - Greengrass Deployment Package
97+
uses: actions/upload-artifact@v2
98+
with:
99+
name: greengrass-deployment-package
100+
path: |
101+
usbproxy/src/build/greengrass/usb-mitm.zip
102+
91103
upload-package:
92104
name: Upload nesto-usbproxy debian package into nesto repository in S3
93105
runs-on: ubuntu-latest
@@ -129,4 +141,4 @@ jobs:
129141
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
130142
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
131143
run: |
132-
aptly publish repo -batch=true -passphrase-file="./key_passwd" -gpg-key="$GPG_KEY_ID" -component=aws -distribution=nightly nesto-pos-adapter-devel s3:nesto-debian-repo-devel:
144+
aptly publish repo -batch=true -passphrase-file="./key_passwd" -gpg-key="$GPG_KEY_ID" -component=aws -distribution=nightly nesto-pos-adapter-devel s3:nesto-debian-repo-devel:

.github/workflows/build-aptly.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
paths:
44
- 'aptly/Dockerfile'
55
branches: master
6+
workflow_dispatch:
67

78
jobs:
89
build-aptly:

.github/workflows/build-deps.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
paths:
44
- 'docker-crosstool-ng-arm/docker/deps.Dockerfile'
55
branches: master
6+
workflow_dispatch:
67

78
jobs:
89
build-deps:

.github/workflows/build-toolchain.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
paths:
44
- 'docker-crosstool-ng-arm/docker/toolchain.Dockerfile'
55
branches: master
6+
workflow_dispatch:
67

78
jobs:
89
build-toolchain:

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ obj-x86_64-linux-gnu
3131
# nesto-specific
3232
src/build
3333
cppzmq
34-
usb-mitm.tar
34+
usb-mitm.tar
35+
src/lib/usbproxy.pc

.vscode/tasks.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
"label": "cmake",
3030
"type": "shell",
3131
"options": {
32-
"cwd": "${workspaceRoot}/src"
32+
"cwd": "${workspaceRoot}/src/build"
3333
},
34-
"command": "/usr/bin/cmake --build ${workspaceRoot}/src/build --config Debug --target all -- -j 6",
34+
"command": "/usr/bin/cmake -Daws-greengrass-core-sdk-c_DIR=/usr/local/lib/ --build ${workspaceRoot}/src/build --config Debug --target all -- -j 6 ..",
3535
"problemMatcher": []
3636
}
3737
],

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ Please note that you must run the application with root privileges. The launch c
152152

153153
If you want to run the script on your own, make sure to run the install task before (i.e. Ctrl+P -> *task install* -> Enter -> Enter). This is needed to copy shared libraries into appropriate system folders. You can run the binary from the repository root by doing: `./src/build/tools/usb-mitm --help`. Do not forget to use **sudo** when running anything other than the help menu view. We need root permissions to access the usb subsystem and read from devices.
154154

155+
> :warning: **Linking Libraries**: If you want to run the globally installed executable, you must make sure that your dynamic linker is up-to-date. Please run `sudo ldconfig` to ensure libraries can be linked correctly at runtime.
156+
155157
Usage
156158
---------
157159
```
@@ -230,4 +232,4 @@ Building a Release (for Maintainers)
230232
4. Create a PR into master and describe the changes; Make sure to squash the commits.
231233

232234
Use a commit message like: `chore: prepare release for vx.y.z`.
233-
Use a PR title like: `chore: release vx.y.z`.
235+
Use a PR title like: `chore: release vx.y.z`.

docker-crosstool-ng-arm/docker/deps.Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,10 @@ RUN LDFLAGS="-L$STAGING_DIR/usr/lib" make
106106
RUN make install DESTDIR=${STAGING_DIR}
107107

108108
# install dep for debian build
109-
RUN apt-get install -y dh-make
109+
RUN apt-get install -y dh-make
110+
111+
112+
# install aws-greengrass-sdk
113+
114+
COPY ./rpi-scripts/install-aws-greengrass-sdk.sh ./install-aws-greengrass-sdk.sh
115+
RUN ./install-aws-greengrass-sdk.sh

rpi-scripts/install-all-dependencies.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,30 @@ set -o pipefail
55
echo -e "[0/7] Updating package list\n"
66
sudo apt-get update
77

8-
echo -e "[1/7] Installing cmake"
8+
echo -e "[1/8] Installing cmake"
99
sudo apt-get install -y cmake
1010

11-
echo -e "[2/7] Installing libusb\n"
11+
echo -e "[2/8] Installing libusb\n"
1212
sudo apt-get install -y libusb-1.0.0-dev
1313

14-
echo -e "[3/7] Installing boost libs: chrono, timer, system\n"
14+
echo -e "[3/8] Installing boost libs: chrono, timer, system\n"
1515
sudo apt-get install -y libboost-chrono-dev libboost-timer-dev libboost-system-dev
1616

17-
echo -e "[4/7] Installing libzmq\n"
17+
echo -e "[4/8] Installing libzmq\n"
1818
sudo apt-get install -y libzmq3-dev
1919

20-
echo -e "[5/7] Installing cppzmq\n"
20+
echo -e "[5/8] Installing cppzmq\n"
2121
git clone https://github.com/zeromq/cppzmq.git /tmp/cppzmq || echo "Skipped clone."
2222
(cd /tmp/cppzmq && mkdir -p build && cd build && cmake -DCPPZMQ_BUILD_TESTS=off .. && sudo make -j4 install)
2323

24-
echo -e "[6/7] Installing msgpack\n"
24+
echo -e "[6/8] Installing msgpack\n"
2525
git clone https://github.com/msgpack/msgpack-c.git /tmp/msgpack-c || echo "Skipped clone."
2626
(cd /tmp/msgpack-c && git checkout cpp_master && cmake -DMSGPACK_CXX17=ON . && sudo make install)
2727

28-
echo -e "[7/7] Put RPi USB into client mode"
28+
echo -e "[7/8] Installing aws-greengrass-sdk\n"
29+
./install-aws-greengrass-sdk.sh
30+
31+
echo -e "[8/8] Put RPi USB into client mode"
2932
set +e
3033
set +o pipefail
3134

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
git clone https://github.com/aws/aws-greengrass-core-sdk-c.git /tmp/aws-sdk
4+
(cd /tmp/aws-sdk/aws-greengrass-core-sdk-c && mkdir -p build && cd build && cmake .. && cmake --build . && sudo make install)

0 commit comments

Comments
 (0)