Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add acap-ssh-utils bin and lib crate #19

Merged
merged 25 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
de7a820
Add acap-ssh-utils bin and lib crate
apljungquist May 9, 2024
851ca74
feat(acap-ssh-utils)!: Add support for patching non-exe files
apljungquist May 26, 2024
aa70708
Merge remote-tracking branch 'upstream/main' into add_ssh_utils
apljungquist Jun 10, 2024
536d7ca
Use purpose built app for testing
apljungquist Jun 18, 2024
f337375
f: Fix run command which has not kept up with other changes
apljungquist Jun 18, 2024
46f6da3
Specify paths to patch in the order <src>:<dst>
apljungquist Jun 18, 2024
b01ebb8
f: Print info about standard streams
apljungquist Jun 18, 2024
c124fe3
s: Focus interface on `.eap` files.
apljungquist Jul 3, 2024
23d96f8
s: Rename username and password arguments
apljungquist Jul 3, 2024
97bc9b6
f: Read device arguments from env
apljungquist Jul 3, 2024
f8e33d1
f: Document desire to replace external ssh tools
apljungquist Jul 3, 2024
594df5a
Merge remote-tracking branch 'upstream/main' into add_ssh_utils
apljungquist Jul 3, 2024
8d11bb7
f: Improve error reporting
apljungquist Jul 3, 2024
5f57c15
f: Install required packages in dev container
apljungquist Jul 3, 2024
cb85b4e
s: Add .env to gitignore
apljungquist Jul 3, 2024
e4500c8
f: Remove unnecessary path prefixes
apljungquist Jul 3, 2024
f3bf84f
f: Improve docs
apljungquist Jul 3, 2024
abec272
s: export `AXIS_*` variables in the Makefile
apljungquist Jul 4, 2024
970732a
Merge remote-tracking branch 'upstream/main' into HEAD
apljungquist Jul 18, 2024
972fa2c
s: Document planned improvements
apljungquist Jul 18, 2024
179f5d5
f: Include acap-ssh-utils in more checks
apljungquist Jul 18, 2024
459cd44
f: Remove binary section from readme
apljungquist Jul 18, 2024
ab8c96b
f: Sort things
apljungquist Jul 18, 2024
0118f8a
f: Include acap-ssh-utils in docker context
apljungquist Jul 18, 2024
5db2b7e
f: Restore sshpass in docker image
apljungquist Jul 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .devhost/install-system-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ apt-get install \
iputils-ping \
libglib2.0-dev \
pkg-config \
python3-venv
python3-venv \
sshpass
3 changes: 2 additions & 1 deletion .devhost/install-venv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ rm /tmp/node-v18.16.1-linux-x64.tar.gz
# Install `devcontainer` into venv
npm install -g @devcontainers/[email protected]

# Install `cargo-acap-build` into venv
# Install packages from this project into venv
cargo install --root ${VIRTUAL_ENV} --target-dir /tmp/target --path ../crates/acap-ssh-utils
cargo install --root ${VIRTUAL_ENV} --target-dir /tmp/target --path ../crates/cargo-acap-build

rm -r /tmp/target
Expand Down
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*
!/.devhost/
!/crates/acap-ssh-utils
!/crates/cargo-acap-build
!/rust-toolchain.toml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.env
/.idea/
/init_env.sh
/target/
179 changes: 176 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 18 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@
# Name of package containing the app to be built.
# Rust does not enforce that the path to the package matches the package name, but
# this makefile does to keep things simple.
AXIS_PACKAGE ?= hello_world
export AXIS_PACKAGE ?= hello_world

# The architecture that will be assumed when interacting with the device.
AXIS_DEVICE_ARCH ?= aarch64
export AXIS_DEVICE_ARCH ?= aarch64

# The IP address of the device to interact with.
AXIS_DEVICE_IP ?= 192.168.0.90
export AXIS_DEVICE_IP ?= 192.168.0.90

# The username to use when interacting with the device.
export AXIS_DEVICE_USER ?= root

# The password to use when interacting with the device.
AXIS_DEVICE_PASS ?= pass
export AXIS_DEVICE_PASS ?= pass

# Other
# -----
Expand Down Expand Up @@ -91,9 +94,11 @@ stop:
## * The device is added to `knownhosts`.
run:
cargo-acap-build --target $(AXIS_DEVICE_ARCH) -- -p $(AXIS_PACKAGE)
scp target/$(AXIS_DEVICE_ARCH)/$(AXIS_PACKAGE)/$(AXIS_PACKAGE) root@$(AXIS_DEVICE_IP):/usr/local/packages/$(AXIS_PACKAGE)/$(AXIS_PACKAGE)
ssh root@$(AXIS_DEVICE_IP) \
"cd /usr/local/packages/$(AXIS_PACKAGE) && su - acap-$(AXIS_PACKAGE) -s /bin/sh --preserve-environment -c '$(if $(RUST_LOG_STYLE),RUST_LOG_STYLE=$(RUST_LOG_STYLE) )$(if $(RUST_LOG),RUST_LOG=$(RUST_LOG) )./$(AXIS_PACKAGE)'"
acap-ssh-utils patch target/$(AXIS_DEVICE_ARCH)/$(AXIS_PACKAGE)/*.eap
acap-ssh-utils run-app \
--environment RUST_LOG=debug \
--environment RUST_LOG_STYLE=always \
$(AXIS_PACKAGE)

## Build and execute unit tests for <AXIS_PACKAGE> on <AXIS_DEVICE_IP> assuming architecture <AXIS_DEVICE_ARCH>
##
Expand All @@ -113,9 +118,11 @@ test:
# The `scp` command below needs the wildcard to match exactly one file.
rm -r target/$(AXIS_DEVICE_ARCH)/$(AXIS_PACKAGE)-*/$(AXIS_PACKAGE) ||:
cargo-acap-build --target $(AXIS_DEVICE_ARCH) -- -p $(AXIS_PACKAGE) --tests
scp target/$(AXIS_DEVICE_ARCH)/$(AXIS_PACKAGE)-*/$(AXIS_PACKAGE) root@$(AXIS_DEVICE_IP):/usr/local/packages/$(AXIS_PACKAGE)/$(AXIS_PACKAGE)
ssh root@$(AXIS_DEVICE_IP) \
"cd /usr/local/packages/$(AXIS_PACKAGE) && su - acap-$(AXIS_PACKAGE) -s /bin/sh --preserve-environment -c '$(if $(RUST_LOG_STYLE),RUST_LOG_STYLE=$(RUST_LOG_STYLE) )$(if $(RUST_LOG),RUST_LOG=$(RUST_LOG) )./$(AXIS_PACKAGE)'"
acap-ssh-utils patch target/$(AXIS_DEVICE_ARCH)/$(AXIS_PACKAGE)-*/*.eap
acap-ssh-utils run-app \
--environment RUST_LOG=debug \
--environment RUST_LOG_STYLE=always \
$(AXIS_PACKAGE)

## Checks
## ------
Expand All @@ -137,6 +144,7 @@ check_build:
cargo-acap-build \
--target aarch64 \
-- \
--exclude acap-ssh-utils \
--exclude cargo-acap-build \
--workspace

Expand Down
9 changes: 9 additions & 0 deletions apps/inspect_env/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "inspect_env"
version = "1.0.0"
edition.workspace = true

[dependencies]
log = { workspace = true }

acap-logging = { workspace = true }
Loading