Skip to content

Commit

Permalink
Refactor: App
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed May 23, 2021
1 parent bba18b1 commit 706b356
Show file tree
Hide file tree
Showing 21 changed files with 57 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/src/main/assets/app_xbin/bin/cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ fi
. $CLI_RES/backup_rootfs.sh
. $CLI_RES/deploy_linux.sh
. $CLI_RES/bind_main.sh
. $CLI_RES/starter_fullns.sh
. $CLI_RES/starter_proot.sh
. $CLI_RES/starter_unshare.sh
. $CLI_RES/starter_auto.sh
. $CLI_RES/exec_fullns.sh
. $CLI_RES/exec_unshare.sh
. $CLI_RES/exec_auto.sh
. $CLI_RES/exec_local-shell.sh
Expand Down
31 changes: 31 additions & 0 deletions app/src/main/assets/app_xbin/bin/include/exec_fullns.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
exec_fullns(){
echo "progress:[1/1]"
check_rootfs
set_env
export unshare="exec $TOOLKIT/bin/unshare $addcmd --mount --uts --ipc --net --pid --cgroup --mount-proc -R $rootfs "
if [ -f "$rootfs/bin/su" ];then
$unshare /bin/su -c $cmd2
else
if [ -f "$rootfs/bin/sh" ];then
$unshare /bin/sh $cmd2
else
if [ -f "$rootfs/bin/ash" ];then
$unshare /bin/ash $cmd2
else
if [ -f "$rootfs/bin/bash" ];then
$unshare /bin/bash $cmd2
else
if [ -f "$rootfs/bin/fish" ];then
$unshare /bin/fish $cmd2
else
$unshare $cmd2
fi
echo "">/dev/null
fi
echo "">/dev/null
fi
echo "">/dev/null
fi
echo "">/dev/null
fi
}
16 changes: 16 additions & 0 deletions app/src/main/assets/app_xbin/bin/include/starter_fullns.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
start_fullns(){
echo "progress:[1/1]"
check_rootfs
# Check RunStatus
if [[ "$(cat $rootfs/boot/dogeland/status)" != "Stop" ]]
then
# if Run,Then Stop
stop_rootfs
else
# Start Process
echo "Starting"
set_env
echo "Run">$rootfs/boot/dogeland/status
exec $TOOLKIT/bin/unshare $addcmd --mount --uts --ipc --net --pid --cgroup --mount-proc -R $rootfs $cmd
fi
}
6 changes: 4 additions & 2 deletions app/src/main/assets/app_xbin/bin/include/stop_rootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ pkill dropbear
pkill sshd
echo "Stop">$rootfs/boot/dogeland/status
pkill proot
pkill systemd
pkill unshare
if [ -d "/apex" ];then
$TOOLKIT/bin/proot -r $TOOLKIT -b /system -b /proc -b /sys -b /dev -b /vendor -b /apex /busybox pkill $PACKAGE_NAME
$TOOLKIT/bin/proot -r $TOOLKIT -b /system -b /proc -b /sys -b /dev -b /vendor -b /apex /bin/busybox pkill $PACKAGE_NAME
else
$TOOLKIT/bin/proot -r $TOOLKIT -b /system -b /proc -b /sys -b /dev -b /vendor /busybox pkill $PACKAGE_NAME
$TOOLKIT/bin/proot -r $TOOLKIT -b /system -b /proc -b /sys -b /dev -b /vendor /bin/busybox pkill $PACKAGE_NAME
fi
pkill $PACKAGE_NAME
pkill sh # for chroot
Expand Down
Binary file modified app/src/main/assets/app_xbin/preload_res/bin/busybox_arm
Binary file not shown.
Binary file modified app/src/main/assets/app_xbin/preload_res/bin/busybox_arm64
Binary file not shown.
Binary file not shown.
Binary file modified app/src/main/assets/app_xbin/preload_res/bin/busybox_x86_64
Binary file not shown.
Binary file modified app/src/main/assets/app_xbin/preload_res/bin/proot_arm
Binary file not shown.
Binary file modified app/src/main/assets/app_xbin/preload_res/bin/proot_arm64
Binary file not shown.
Binary file not shown.
Binary file modified app/src/main/assets/app_xbin/preload_res/bin/proot_x86_64
Binary file not shown.
Binary file modified app/src/main/assets/app_xbin/preload_res/bin/unshare_arm
Binary file not shown.
Binary file modified app/src/main/assets/app_xbin/preload_res/bin/unshare_arm64
Binary file not shown.
Binary file not shown.
Binary file modified app/src/main/assets/app_xbin/preload_res/bin/unshare_x86_64
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions app/src/main/assets/pages/vwox9icd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<option value="start_auto">[自动选择]</option>
<option value="start_proot">[proot]</option>
<option value="start_unshare">[unshare]</option>
<option value="start_fullns">[fullns]</option>
</param>
<param name="addcmd" label="AddonCmd" title="" placeholder="" type="text" />
<set> $TOOLKIT/bin/cli.sh $start</set>
Expand All @@ -23,6 +24,7 @@
<option value="exec_auto">[自动选择]</option>
<option value="exec_proot">[proot]</option>
<option value="exec_unshare">[unshare]</option>
<option value="exec_fullns">[fullns]</option>
<option value="exec_localshell">[sh]</option>
</param>
<set> $TOOLKIT/bin/cli.sh $exec</set>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/assets/pages/wyr1nmlc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<param name="type">
<option value="/bin/sh /boot/dogeland/cli.sh sshd_start">启动openssh-sshd</option>
<option value="/bin/sh /boot/dogeland/cli.sh dropbear_start">启动dropbear</option>
<option value="/lib/systemd --system">[fullns]systemd</option>
<option value="/sbin/init">[fullns]init</option>
</param>
<set>
rm -rf $CONFIG_DIR/cmdline.config
Expand Down

0 comments on commit 706b356

Please sign in to comment.