Skip to content

Commit a23df84

Browse files
authored
workaround for root not being root permissions issue (#72)
* workaround for root not being root permissions issue * update setup_rootshell()
1 parent 4e86284 commit a23df84

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

Diff for: dist/install-common.sh

+13-9
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ wait_for_adb_shell() {
4242

4343
setup_rootshell() {
4444
_adb_push rootshell /tmp/
45-
"$SERIAL_PATH" "AT+SYSCMD=cp /tmp/rootshell /bin/rootshell"
45+
_at_syscmd "cp /tmp/rootshell /bin/rootshell"
4646
sleep 1
47-
"$SERIAL_PATH" "AT+SYSCMD=chown root /bin/rootshell"
47+
_at_syscmd "chown root /bin/rootshell"
4848
sleep 1
49-
"$SERIAL_PATH" "AT+SYSCMD=chmod 4755 /bin/rootshell"
49+
_at_syscmd "chmod 4755 /bin/rootshell"
5050
_adb_shell '/bin/rootshell -c id'
5151
echo "we have root!"
5252
}
@@ -59,18 +59,22 @@ _adb_shell() {
5959
"$ADB" shell "$1"
6060
}
6161

62+
_at_syscmd() {
63+
"$SERIAL_PATH" "AT+SYSCMD=$1"
64+
}
65+
6266
setup_rayhunter() {
63-
_adb_shell '/bin/rootshell -c "mkdir -p /data/rayhunter"'
67+
_at_syscmd "mkdir -p /data/rayhunter"
6468
_adb_push config.toml.example /data/rayhunter/config.toml
6569
_adb_push rayhunter-daemon /data/rayhunter/
6670
_adb_push scripts/rayhunter_daemon /tmp/rayhunter_daemon
6771
_adb_push scripts/misc-daemon /tmp/misc-daemon
68-
_adb_shell '/bin/rootshell -c "cp /tmp/rayhunter_daemon /etc/init.d/rayhunter_daemon"'
69-
_adb_shell '/bin/rootshell -c "cp /tmp/misc-daemon /etc/init.d/misc-daemon"'
70-
_adb_shell '/bin/rootshell -c "chmod 755 /etc/init.d/rayhunter_daemon"'
71-
_adb_shell '/bin/rootshell -c "chmod 755 /etc/init.d/misc-daemon"'
72+
_at_syscmd "cp /tmp/rayhunter_daemon /etc/init.d/rayhunter_daemon"
73+
_at_syscmd "cp /tmp/misc-daemon /etc/init.d/misc-daemon"
74+
_at_syscmd "chmod 755 /etc/init.d/rayhunter_daemon"
75+
_at_syscmd "chmod 755 /etc/init.d/misc-daemon"
7276
echo -n "waiting for reboot..."
73-
_adb_shell '/bin/rootshell -c reboot'
77+
_at_syscmd reboot
7478

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

0 commit comments

Comments
 (0)