Skip to content

Commit

Permalink
workaround for root not being root permissions issue (#72)
Browse files Browse the repository at this point in the history
* workaround for root not being root permissions issue

* update setup_rootshell()
  • Loading branch information
cooperq authored Oct 24, 2024
1 parent 4e86284 commit a23df84
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions dist/install-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ wait_for_adb_shell() {

setup_rootshell() {
_adb_push rootshell /tmp/
"$SERIAL_PATH" "AT+SYSCMD=cp /tmp/rootshell /bin/rootshell"
_at_syscmd "cp /tmp/rootshell /bin/rootshell"
sleep 1
"$SERIAL_PATH" "AT+SYSCMD=chown root /bin/rootshell"
_at_syscmd "chown root /bin/rootshell"
sleep 1
"$SERIAL_PATH" "AT+SYSCMD=chmod 4755 /bin/rootshell"
_at_syscmd "chmod 4755 /bin/rootshell"
_adb_shell '/bin/rootshell -c id'
echo "we have root!"
}
Expand All @@ -59,18 +59,22 @@ _adb_shell() {
"$ADB" shell "$1"
}

_at_syscmd() {
"$SERIAL_PATH" "AT+SYSCMD=$1"
}

setup_rayhunter() {
_adb_shell '/bin/rootshell -c "mkdir -p /data/rayhunter"'
_at_syscmd "mkdir -p /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 "cp /tmp/rayhunter_daemon /etc/init.d/rayhunter_daemon"'
_adb_shell '/bin/rootshell -c "cp /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"'
_at_syscmd "cp /tmp/rayhunter_daemon /etc/init.d/rayhunter_daemon"
_at_syscmd "cp /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..."
_adb_shell '/bin/rootshell -c reboot'
_at_syscmd reboot

# first wait for shutdown (it can take ~10s)
until ! _adb_shell true 2> /dev/null
Expand Down

0 comments on commit a23df84

Please sign in to comment.