Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install using adb rootshell on arm64 macos #95

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion dist/install-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ install() {
fi
force_debug_mode
setup_rootshell
setup_rayhunter
if [[ "$(uname)" == "Darwin" && "$(uname -m)" == "arm64" ]]; then
setup_rayhunter_adb
else
setup_rayhunter
fi
test_rayhunter
}

Expand Down Expand Up @@ -92,6 +96,35 @@ setup_rayhunter() {
echo " done!"
}

setup_rayhunter_adb() {
echo "setting up rayhunter with ADB rootshell..."
_adb_shell "/bin/rootshell -c 'mkdir -p /data/rayhunter'"
_adb_push config.toml.example /tmp/config.toml
_adb_shell "/bin/rootshell -c 'mv /tmp/config.toml /data/rayhunter'"
_adb_push rayhunter-daemon /tmp/rayhunter-daemon
_adb_shell "/bin/rootshell -c 'mv /tmp/rayhunter-daemon /data/rayhunter'"
_adb_push scripts/rayhunter_daemon /tmp/rayhunter_daemon
_adb_shell "/bin/rootshell -c 'mv /tmp/rayhunter_daemon /etc/init.d/rayhunter_daemon'"
_adb_push scripts/misc-daemon /tmp/misc-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'"

echo -n "waiting for reboot..."
_adb_shell "/bin/rootshell -c '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
Expand Down