@@ -2,17 +2,71 @@ MODDIR=${0%/*}
22PORT=$( sed -n ' s/^PORT="\([^"]*\)"/\1/p' " $MODDIR /config.conf" )
33PID=$( $MODDIR /bin/fuser " $PORT /tcp" 2> /dev/null)
44
5+ DEV () {
6+ local PREFIX=/data/user/0/com.termux/files/usr
7+ local TBIN=$PREFIX /bin
8+ local BASH=$TBIN /bash
9+ local TMPDIR=$PREFIX /tmp
10+ local BATE=$TMPDIR /asl.sh
11+
12+ if [ ! -d $PREFIX ]; then
13+ echo " - TThe environment of Termux is abnormal"
14+ return
15+ fi
16+
17+ cp -f $MODDIR /bate.sh $BATE
18+ chmod 755 $BATE
19+
20+ echo " - It will run in Termux soon. Please make sure the network is working properly"
21+ echo " - Check whether Termux is running in the background"
22+ echo " !Friendly reminder: If it doesn't jump to the Termux page, please pull down the notification bar and click on Termux to enter the Termux application"
23+
24+ pidof com.termux & > /dev/null
25+ if [[ $? = 0 ]]; then
26+ echo " - It's already running"
27+ sleep 3
28+ else
29+ echo " - Opening Termux"
30+ sleep 1
31+ $TBIN /am start -n com.termux/com.termux.app.TermuxActivity > /dev/null
32+ sleep 3
33+ pidof com.termux & > /dev/null || echo " !Failed to open the Termux app. Please open it manually"
34+ fi
35+
36+ $TBIN /am startservice \
37+ -n com.termux/com.termux.app.TermuxService \
38+ -a com.termux.service_execute \
39+ -d com.termux.file:$BATE \
40+ -e com.termux.execute.background true > /dev/null
41+
42+ echo " - Waiting for Termux to finish installing..."
43+ }
44+
45+ update_ssh () {
46+ local rootfs=" /data/$( sed -n ' s/^RURIMA_LXC_OS="\([^"]*\)"/\1/p' " $MODDIR /config.conf" ) "
47+
48+ sleep 2
49+ if lsof | grep " $rootfs " | awk ' {print $2}' | uniq | grep -q " sshd" ; then
50+ sed -i ' s|^description=.*|description=\[ running😉 \] Android Subsystem for GNU/Linux Powered by ruri|' " $MODDIR /module.prop"
51+ else
52+ sed -i ' s|^description=.*|description=\[ running⚠️ \] Android Subsystem for GNU/Linux Powered by ruri|' " $MODDIR /module.prop"
53+ fi
54+ }
55+
556if [ -n " $PID " ]; then
657 printf " - Stopping container...\n\n"
758 " $MODDIR " /container_ctrl.sh stop
859 sed -i ' s|^description=.*|description=\[ stopped🙁 \] Android Subsystem for GNU/Linux Powered by ruri|' " $MODDIR /module.prop"
60+
61+ DEV
962else
1063 printf " - Starting up container...\n\n"
1164 " $MODDIR " /container_ctrl.sh start
12- sed -i ' s|^description=.*|description=\[ running😉 \] Android Subsystem for GNU/Linux Powered by ruri|' " $MODDIR /module.prop"
65+
66+ update_ssh
1367fi
1468
15- countdown=5
69+ countdown=3
1670while [ $countdown -gt 0 ]; do
1771 printf " \r- %d" " $countdown "
1872 sleep 1
0 commit comments