-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'workflows' into documentation
- Loading branch information
Showing
10 changed files
with
192 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Build Release | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
build_serial: | ||
strategy: | ||
matrix: | ||
platform: | ||
- os: ubuntu-latest | ||
build_name: serial | ||
- os: windows-latest | ||
build_name: serial.exe | ||
- os: macos-latest | ||
build_name: serial | ||
runs-on: ${{ matrix.platform.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build serial | ||
run: cargo build --bin serial --release | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: serial-${{ matrix.platform.os }} | ||
path: ./target/release/${{ matrix.platform.build_name }} | ||
if-no-files-found: error | ||
build_rootshell_and_rayhunter: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
targets: armv7-unknown-linux-gnueabihf | ||
- name: Install cross-compilation dependencies | ||
uses: awalsh128/cache-apt-pkgs-action@latest | ||
with: | ||
packages: build-essential libc6-armhf-cross libc6-dev-armhf-cross gcc-arm-linux-gnueabihf | ||
version: 1.0 | ||
- name: Build rootshell (arm32) | ||
run: cargo build --bin rootshell --target armv7-unknown-linux-gnueabihf --release | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: rootshell | ||
path: target/armv7-unknown-linux-gnueabihf/release/rootshell | ||
if-no-files-found: error | ||
- name: Build rayhunter-daemon (arm32) | ||
run: cargo build --bin rayhunter-daemon --target armv7-unknown-linux-gnueabihf --release | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: rayhunter-daemon | ||
path: target/armv7-unknown-linux-gnueabihf/release/rayhunter-daemon | ||
if-no-files-found: error | ||
build_release_zip: | ||
needs: | ||
- build_serial | ||
- build_rootshell_and_rayhunter | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v4 | ||
- name: Setup release directory | ||
run: mv rayhunter-daemon/rayhunter-daemon rootshell/rootshell serial-* dist | ||
- name: Archive release directory | ||
uses: thedoctor0/[email protected] | ||
with: | ||
type: 'zip' | ||
filename: 'release.zip' | ||
directory: 'dist' | ||
# TODO: have this create a release directly | ||
- name: Upload release | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: release.zip | ||
path: dist/release.zip | ||
if-no-files-found: error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/env bash | ||
|
||
install() { | ||
if [[ -z "${SERIAL_PATH}" ]]; then | ||
echo "SERIAL_PATH not set, did you run this from install-linux.sh or install-mac.sh?" | ||
exit 1 | ||
fi | ||
check_adb | ||
force_debug_mode | ||
setup_rootshell | ||
setup_rayhunter | ||
} | ||
|
||
check_adb() { | ||
if ! command -v adb &> /dev/null | ||
then | ||
echo "adb not found, please ensure it's installed or check the README.md" | ||
exit 1 | ||
fi | ||
} | ||
|
||
force_debug_mode() { | ||
# Force a switch into the debug mode to enable ADB | ||
$(SERIAL_PATH) AT | ||
echo -n "adb enabled, waiting for reboot" | ||
until adb shell true 2> /dev/null | ||
do | ||
echo -n . | ||
sleep 1 | ||
done | ||
echo | ||
echo "it's alive!" | ||
} | ||
|
||
setup_rootshell() { | ||
_adb_push rootshell /tmp/ | ||
$(SERIAL_PATH) "AT+SYSCMD=mv /tmp/rootshell /bin/rootshell" | ||
sleep 1 | ||
$(SERIAL_PATH) "AT+SYSCMD=chown root /bin/rootshell" | ||
sleep 1 | ||
$(SERIAL_PATH) "AT+SYSCMD=chmod 4755 /bin/rootshell" | ||
echo "we have root!" | ||
adb shell /bin/rootshell -c id | ||
} | ||
|
||
_adb_push() { | ||
adb push "$(dirname "$0")/$1" "$2" | ||
} | ||
|
||
setup_rayhunter() { | ||
adb shell '/bin/rootshell -c "mkdir /data/rayhunter"' | ||
_adb_push config.toml.example /data/rayhunter/config.toml | ||
_adb_push rayhunter-daemon /data/rayhunter/ | ||
_adb_push scripts/rayhunter_daemon /tmp/rayhunter_daemon | ||
_adb_push scripts/misc-daemon /tmp/misc-daemon | ||
adb shell '/bin/rootshell -c "mv /tmp/rayhunter_daemon /etc/init.d/rayhunter_daemon"' | ||
adb shell '/bin/rootshell -c "mv /tmp/misc-daemon /etc/init.d/misc-daemon"' | ||
adb shell '/bin/rootshell -c "chmod 755 /etc/init.d/rayhunter_daemon"' | ||
adb shell '/bin/rootshell -c "chmod 755 /etc/init.d/misc-daemon"' | ||
adb shell '/bin/rootshell -c "/etc/init.d/rayhunter_daemon start"' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/env bash | ||
|
||
set -e | ||
export SERIAL_PATH="./serial-ubuntu-latest/serial" | ||
. "$(dirname "$0")"/install-common.sh | ||
install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/env bash | ||
|
||
set -e | ||
export SERIAL_PATH="./serial-mac-latest/serial" | ||
. "$(dirname "$0")"/install-common.sh | ||
install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ECHO TODO |
File renamed without changes.
File renamed without changes.