Skip to content

Commit feb7fee

Browse files
authored
Merge pull request #3 from jackra1n/armv7l-binary
Add 32bit binary, improve install script
2 parents c609966 + c31b591 commit feb7fee

File tree

5 files changed

+39
-14
lines changed

5 files changed

+39
-14
lines changed

.cargo/config

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
[target.aarch64-unknown-linux-gnu]
2-
linker = "aarch64-linux-gnu-gcc"
2+
linker = "aarch64-linux-gnu-gcc"
3+
4+
[target.armv7-unknown-linux-gnueabihf]
5+
linker = "arm-linux-gnueabihf-gcc"

.github/workflows/build.yaml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,18 @@ jobs:
1515

1616
build:
1717
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
target: [aarch64-unknown-linux-gnu, armv7-unknown-linux-gnueabihf]
1821
steps:
1922
- uses: actions/checkout@v3
20-
- name: Install cross
21-
run: cargo install cross
22-
- name: Build
23-
run: cross build --target aarch64-unknown-linux-gnu --release
24-
- name: Archive
23+
- name: Install dependencies
24+
run: |
25+
cargo install cross
26+
- name: Build binaries
27+
run: cross build --target ${{ matrix.target }} --release
28+
- name: Archive binaries
2529
uses: actions/upload-artifact@v3
2630
with:
27-
name: rustberry-poe-monitor
28-
path: target/aarch64-unknown-linux-gnu/release/rustberry-poe-monitor
29-
30-
31+
name: rustberry-poe-monitor-${{ matrix.target == 'aarch64-unknown-linux-gnu' && 'aarch64' || 'armv7l' }}
32+
path: target/${{ matrix.target }}/release/rustberry-poe-monitor

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rustberry-poe-monitor"
3-
version = "1.0.1"
3+
version = "1.0.2"
44
edition = "2021"
55
authors = ["jackra1n"]
66
description = "A simple PoE Monitor for Raspberry Pi Waveshare PoE HAT (B)"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ This tool provides real-time monitoring of your Raspberry Pi's system statistics
3939

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

4545
And that's it!

install.sh

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,34 @@
11
#!/bin/bash
2-
LATEST_RELEAST_URL="https://github.com/jackra1n/RustBerry-PoE-Monitor/releases/latest/download/rustberry-poe-monitor"
32

43
# Check if script is run as root
54
if [ "$EUID" -ne 0 ]
65
then echo "Please run as root"
76
exit
87
fi
98

9+
# Only run on aarch64 or armv7l
10+
ARCH=$(uname -m)
11+
echo "Architecture: $ARCH"
12+
if [ "$ARCH" != "aarch64" ] && [ "$ARCH" != "armv7l" ]; then
13+
echo "This script is only intended to run on aarch64 or armv7l"
14+
exit 1
15+
fi
16+
17+
# Check if running on a Raspberry Pi
18+
if ! grep -q "Raspberry Pi" /proc/device-tree/model; then
19+
echo "This script is only intended to run on a Raspberry Pi"
20+
exit 1
21+
fi
22+
23+
# Enable I2C
24+
echo "Enabling I2C"
25+
sudo raspi-config nonint do_i2c 0
26+
27+
# Set download url based on architecture
28+
LATEST_RELEAST_URL="https://github.com/jackra1n/RustBerry-PoE-Monitor/releases/latest/download/rustberry-poe-monitor-$ARCH"
29+
1030
# Download latest binary from github and place it in /usr/local/bin
11-
echo "Downloading latest binary from github"
31+
echo "Downloading latest $ARCH binary from github"
1232
curl -sSL $LATEST_RELEAST_URL -o /usr/local/bin/rustberry-poe-monitor
1333

1434
# Make binary executable

0 commit comments

Comments
 (0)