From e3acfe914469cae1521603f3615e82e5652a03b9 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Sat, 3 May 2025 23:05:01 +0200 Subject: [PATCH] Update documentation and remove old installer scripts --- dist/install-windows.bat | 1 - dist/install.sh | 142 --------------------------------------- installer/src/tplink.rs | 2 +- tools/install-dev.sh | 18 ----- 4 files changed, 1 insertion(+), 162 deletions(-) delete mode 100644 dist/install-windows.bat delete mode 100755 dist/install.sh delete mode 100755 tools/install-dev.sh diff --git a/dist/install-windows.bat b/dist/install-windows.bat deleted file mode 100644 index 05276bc..0000000 --- a/dist/install-windows.bat +++ /dev/null @@ -1 +0,0 @@ -ECHO TODO diff --git a/dist/install.sh b/dist/install.sh deleted file mode 100755 index b0e848f..0000000 --- a/dist/install.sh +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/env bash -set -e - -force_debug_mode() { - echo "Using adb at $ADB" - echo "Force a switch into the debug mode to enable ADB" - "$SERIAL_PATH" --root - echo -n "adb enabled, waiting for reboot..." - wait_for_adb_shell - echo " it's alive!" - echo -n "waiting for atfwd_daemon to startup..." - wait_for_atfwd_daemon - echo " done!" -} - -wait_for_atfwd_daemon() { - until [ -n "$(_adb_shell 'pgrep atfwd_daemon')" ] - do - sleep 1 - done -} - -wait_for_adb_shell() { - until _adb_shell true 2> /dev/null - do - sleep 1 - done -} - -setup_rootshell() { - _adb_push rootshell /tmp/ - _at_syscmd "cp /tmp/rootshell /bin/rootshell" - sleep 1 - _at_syscmd "chown root /bin/rootshell" - sleep 1 - _at_syscmd "chmod 4755 /bin/rootshell" - _adb_shell '/bin/rootshell -c id' - echo "we have root!" -} - -_adb_push() { - "$ADB" push "$(dirname "$0")/$1" "$2" -} - -_adb_shell() { - "$ADB" shell "$1" -} - -_at_syscmd() { - "$SERIAL_PATH" "AT+SYSCMD=$1" -} - -setup_rayhunter() { - _at_syscmd "mkdir -p /data/rayhunter" - _adb_push config.toml.example /tmp/config.toml - _at_syscmd "mv /tmp/config.toml /data/rayhunter" - _adb_push rayhunter-daemon-orbic/rayhunter-daemon /tmp/rayhunter-daemon - _at_syscmd "mv /tmp/rayhunter-daemon /data/rayhunter" - _adb_push scripts/rayhunter_daemon /tmp/rayhunter_daemon - _at_syscmd "mv /tmp/rayhunter_daemon /etc/init.d/rayhunter_daemon" - _adb_push scripts/misc-daemon /tmp/misc-daemon - _at_syscmd "mv /tmp/misc-daemon /etc/init.d/misc-daemon" - - _at_syscmd "chmod 755 /etc/init.d/rayhunter_daemon" - _at_syscmd "chmod 755 /etc/init.d/misc-daemon" - - echo -n "waiting for reboot..." - _at_syscmd "shutdown -r -t 1 now" - - # first wait for shutdown (it can take ~10s) - until ! _adb_shell true 2> /dev/null - do - sleep 1 - done - - # now wait for boot to finish - wait_for_adb_shell - - echo " done!" -} - -test_rayhunter() { - URL="http://localhost:8080" - "$ADB" forward tcp:8080 tcp:8080 > /dev/null - echo -n "checking for rayhunter server..." - - SECONDS=0 - while (( SECONDS < 30 )); do - if curl -L --fail-with-body "$URL" -o /dev/null -s; then - echo "success!" - echo "you can access rayhunter at $URL" - return - fi - sleep 1 - done - echo "timeout reached! failed to reach rayhunter url $URL, something went wrong :(" -} - -##### ##### ##### -##### Main ##### -##### ##### ##### -if [[ `uname -s` == "Linux" ]]; then - if [[ `uname -m` == "arm64" ]]; then - export SERIAL_PATH="./serial-ubuntu-24-aarch64/serial" - elif [[ `uname -m` == "x86_64" ]]; then - export SERIAL_PATH="./serial-ubuntu-24/serial" - fi - export PLATFORM_TOOLS="platform-tools-latest-linux.zip" -elif [[ `uname -s` == "Darwin" ]]; then - if [[ `uname -m` == "arm64" ]]; then - export SERIAL_PATH="./serial-macos-arm/serial" - elif [[ `uname -m` == "x86_64" ]]; then - export SERIAL_PATH="./serial-macos-intel/serial" - fi - export PLATFORM_TOOLS="platform-tools-latest-darwin.zip" - # if we've already deleted this attribute, xattr errors out - xattr -d com.apple.quarantine "$SERIAL_PATH" || echo -else - echo "This script only supports Linux or macOS" - exit 1 -fi - -if [ ! -x "$SERIAL_PATH" ]; then - echo "The serial binary cannot be found at $SERIAL_PATH. If you are running this from the git tree please instead run it from the latest release bundle https://github.com/EFForg/rayhunter/releases" - exit 1 -fi - -if ! command -v adb &> /dev/null; then - if [ ! -d ./platform-tools ] ; then - echo "adb not found, downloading local copy" - curl -O "https://dl.google.com/android/repository/${PLATFORM_TOOLS}" - unzip $PLATFORM_TOOLS - fi - export ADB="./platform-tools/adb" -else - export ADB=`which adb` -fi - -force_debug_mode -setup_rootshell -setup_rayhunter -test_rayhunter diff --git a/installer/src/tplink.rs b/installer/src/tplink.rs index 82ba135..d527324 100644 --- a/installer/src/tplink.rs +++ b/installer/src/tplink.rs @@ -86,7 +86,7 @@ async fn tplink_run_install(skip_sdcard: bool, admin_ip: String) -> Result<(), E #[cfg(not(feature = "vendor"))] let rayhunter_daemon_bin = - &tokio::fs::read("target/armv7-unknown-linux-gnueabihf/release/rayhunter-daemon").await?; + &tokio::fs::read("target/armv7-unknown-linux-musleabihf/release/rayhunter-daemon").await?; telnet_send_file(addr, "/media/card/rayhunter-daemon", rayhunter_daemon_bin).await?; telnet_send_file( diff --git a/tools/install-dev.sh b/tools/install-dev.sh deleted file mode 100755 index 2233817..0000000 --- a/tools/install-dev.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/env bash - -set -e - -mkdir build -cd build -curl -LOs "https://github.com/EFForg/rayhunter/releases/latest/download/release.tar" -curl -LOs "https://github.com/EFForg/rayhunter/releases/latest/download/release.tar.sha256" -if ! sha256sum -c --quiet release.tar.sha256; then - echo "Download corrupted! (╯°□°)╯︵ ┻━┻" - exit 1 -fi - -tar -xf release.tar -./install.sh - -cd .. -rm -rf build