diff --git a/.cargo/config b/.cargo/config index ff7f758..84d4cf3 100644 --- a/.cargo/config +++ b/.cargo/config @@ -1,2 +1,5 @@ [target.aarch64-unknown-linux-gnu] -linker = "aarch64-linux-gnu-gcc" \ No newline at end of file +linker = "aarch64-linux-gnu-gcc" + +[target.armv7-unknown-linux-gnueabihf] +linker = "arm-linux-gnueabihf-gcc" \ No newline at end of file diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0217e33..e238e96 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -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 - - \ No newline at end of file + name: rustberry-poe-monitor-${{ matrix.target == 'aarch64-unknown-linux-gnu' && 'aarch64' || 'armv7l' }} + path: target/${{ matrix.target }}/release/rustberry-poe-monitor diff --git a/Cargo.toml b/Cargo.toml index 3530d9f..b036aec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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)" diff --git a/README.md b/README.md index ced6f50..b61141d 100644 --- a/README.md +++ b/README.md @@ -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! diff --git a/install.sh b/install.sh index b1e9002..f4df72e 100644 --- a/install.sh +++ b/install.sh @@ -1,5 +1,4 @@ #!/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 ] @@ -7,8 +6,29 @@ if [ "$EUID" -ne 0 ] 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