Skip to content

Commit

Permalink
Merge pull request #3 from jackra1n/armv7l-binary
Browse files Browse the repository at this point in the history
Add 32bit binary, improve install script
  • Loading branch information
jackra1n authored Dec 1, 2023
2 parents c609966 + c31b591 commit feb7fee
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 14 deletions.
5 changes: 4 additions & 1 deletion .cargo/config
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
linker = "aarch64-linux-gnu-gcc"

[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"
20 changes: 11 additions & 9 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ jobs:

build:
runs-on: ubuntu-latest
strategy:
matrix:
target: [aarch64-unknown-linux-gnu, armv7-unknown-linux-gnueabihf]
steps:
- uses: actions/checkout@v3
- name: Install cross
run: cargo install cross
- name: Build
run: cross build --target aarch64-unknown-linux-gnu --release
- name: Archive
- name: Install dependencies
run: |
cargo install cross
- name: Build binaries
run: cross build --target ${{ matrix.target }} --release
- name: Archive binaries
uses: actions/upload-artifact@v3
with:
name: rustberry-poe-monitor
path: target/aarch64-unknown-linux-gnu/release/rustberry-poe-monitor


name: rustberry-poe-monitor-${{ matrix.target == 'aarch64-unknown-linux-gnu' && 'aarch64' || 'armv7l' }}
path: target/${{ matrix.target }}/release/rustberry-poe-monitor
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rustberry-poe-monitor"
version = "1.0.1"
version = "1.0.2"
edition = "2021"
authors = ["jackra1n"]
description = "A simple PoE Monitor for Raspberry Pi Waveshare PoE HAT (B)"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ This tool provides real-time monitoring of your Raspberry Pi's system statistics

Run the following command to install:
```bash
curl -sSL https://raw.githubusercontent.com/jackra1n/RustBerry-PoE-Monitor/main/install.sh | sudo bash
curl -sSL https://rustberry.jackra1n.com/install | sudo bash
```

And that's it!
Expand Down
24 changes: 22 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
#!/bin/bash
LATEST_RELEAST_URL="https://github.com/jackra1n/RustBerry-PoE-Monitor/releases/latest/download/rustberry-poe-monitor"

# Check if script is run as root
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi

# Only run on aarch64 or armv7l
ARCH=$(uname -m)
echo "Architecture: $ARCH"
if [ "$ARCH" != "aarch64" ] && [ "$ARCH" != "armv7l" ]; then
echo "This script is only intended to run on aarch64 or armv7l"
exit 1
fi

# Check if running on a Raspberry Pi
if ! grep -q "Raspberry Pi" /proc/device-tree/model; then
echo "This script is only intended to run on a Raspberry Pi"
exit 1
fi

# Enable I2C
echo "Enabling I2C"
sudo raspi-config nonint do_i2c 0

# Set download url based on architecture
LATEST_RELEAST_URL="https://github.com/jackra1n/RustBerry-PoE-Monitor/releases/latest/download/rustberry-poe-monitor-$ARCH"

# Download latest binary from github and place it in /usr/local/bin
echo "Downloading latest binary from github"
echo "Downloading latest $ARCH binary from github"
curl -sSL $LATEST_RELEAST_URL -o /usr/local/bin/rustberry-poe-monitor

# Make binary executable
Expand Down

0 comments on commit feb7fee

Please sign in to comment.