Skip to content

Commit 47e7c3b

Browse files
committed
v1.7 update
1 parent f40c010 commit 47e7c3b

File tree

7 files changed

+132
-26
lines changed

7 files changed

+132
-26
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Systemless Linux chroot installer and Linux chroot boot script
44

55
## Require
66
- Rooted with Magisk
7-
- Busybox installed
8-
- Coreutils for make_image
9-
- Mke2fs for make_image
7+
- busybox installed
8+
- coreutils for make_image
9+
- mke2fs for make_image
1010
- This module
1111

1212
![Alpine-Linux-Android](https://i.ibb.co/HPpBCGn/alpine-linux.jpg)
@@ -42,7 +42,9 @@ mount_image <path to img> <path to linux directory>
4242
- Alpine Linux, Installed on /data/alpine
4343
- Arch Linux, Installed on /data/arch
4444
- Debian, Installed on /data/debian
45+
- Fedora, Installed on /data/fedora
4546
- Kali Linux, Installed on /data/kali
47+
- Parrot, Installed on /data/parrot
4648
- Ubuntu, Installed on /data/ubuntu
4749

4850
...more distro added soon

mod-util.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
##########################################################################################
77

88
# Versions
9-
MODUTILVER=v2.6
10-
MODUTILVCODE=260
9+
MODUTILVER=v2.6.1
10+
MODUTILVCODE=261
1111

1212
# Check A/B slot
1313
if [ -d /system_root ]; then
@@ -250,9 +250,18 @@ e_spinner() {
250250
# test_connection
251251
# tests if there's internet connection
252252
test_connection() {
253-
(ping -q -c 1 -W 1 google.com >/dev/null 2>&1 & e_spinner "Testing internet connection") && echo " - OK" || { echo " - Error"; false; }
253+
(
254+
if ping -q -c 1 -W 1 google.com >/dev/null 2>&1; then
255+
true
256+
elif ping -q -c 1 -W 1 baidu.com >/dev/null 2>&1; then
257+
true
258+
else
259+
false
260+
fi & e_spinner "Testing internet connection"
261+
) && echo " - OK" || { echo " - Error"; false; }
254262
}
255263

264+
256265
# Log files will be uploaded to termbin.com
257266
# Logs included: VERLOG LOG oldVERLOG oldLOG
258267
upload_logs() {

module.prop

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
id=lhroot
22
name=Linux Chroot Installer
3-
version=v1.4
4-
versionCode=3
3+
version=v1.7
4+
versionCode=1
55
author=FerryAr
66
description=Systemless linux chroot installer and chroot boot script

system/bin/bootlinux_init

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ elif [ -d "/data/arch" ]; then
4040
mnt=/data/arch
4141
elif [ -d "/data/kali" ]; then
4242
mnt=/data/kali
43+
elif [ -d "/data/parrot" ]; then
44+
mnt=/data/parrot
45+
elif [ -d "/data/fedora" ]; then
46+
mnt=/data/fedora
4347
else
4448
echo "No chroot installed";
4549
exit 1

system/bin/bootlinux_log

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/system/bin/sh
22

33
######### Log function for bootlinux* script #########
4-
bklog() {
4+
bllog() {
55
## normal output to terminal
66
echo "$1"
7-
## log it into logcat so that we can run "logcat | grep bklog" to see only the log messages from bootlinux script
8-
log -t "bklog" "$(basename $0) -> $1"
7+
## log it into logcat so that we can run "logcat | grep bllog" to see only the log messages from bootlinux script
8+
log -t "bllog" "$(basename $0) -> $1"
99
}
1010

system/bin/killlinux

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#!/system/bin/sh
22

3-
if [ -x /system/xbin/busybox_nh ]; then
4-
busybox=/system/xbin/busybox_nh
5-
elif [ -x /sbin/busybox_nh ]; then
6-
busybox=/sbin/busybox_nh
7-
elif [ -x /system/xbin/busybox ]; then
3+
if [ -x /system/xbin/busybox ]; then
84
busybox=/system/xbin/busybox
95
elif [ -x /data/local/bin/busybox ]; then
106
busybox=/data/local/bin/busybox
@@ -25,8 +21,17 @@ elif [ -d "/data/debian" ]; then
2521
export mnt=/data/debian
2622
elif [ -d "/data/ubuntu" ]; then
2723
export mnt=/data/ubuntu
24+
elif [ -d "/data/kali" ]; then
25+
export mnt=/data/kali
26+
elif [ -d "/data/parrot" ]; then
27+
export mnt=/data/parrot
28+
elif [ -d "/data/fedora" ]; then
29+
export mnt=/data/fedora
30+
elif [ -d "/data/arch" ]; then
31+
export mnt=/data/arch
2832
else
29-
:
33+
echo "No chroot installed"
34+
exit 1
3035
fi
3136
PRESERVED_PATH=$PATH
3237
export PATH=/usr/bin:/usr/sbin:/bin:/usr/local/bin:/usr/local/sbin:$PATH
@@ -62,3 +67,4 @@ $busybox umount $mnt/sdcard && echo "unmounted sdcard"
6267
$busybox umount $mnt/external_sd && echo "unmounted external_sd"
6368

6469
export PATH=$PRESERVED_PATH
70+

system/bin/lhroot

Lines changed: 94 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ _name=$(basename $0)
1111
ls /data >/dev/null 2>&1 || { echo "$ID needs to run as root!"; echo "type 'su' then '$_name'"; exit 1; }
1212

1313
# Magisk Mod Directory
14-
MOUNTPATH="/sbin/.magisk/modules"
14+
[ -d "/sbin/.magisk" ] && MOUNTPATH="/sbin/.magisk/modules" || MOUNTPATH="$(find /dev -mindepth 2 -maxdepth 2 -type d -name ".magisk")/modules"
1515
MODDIR="$MOUNTPATH/$ID"
1616
[ ! -d $MODDIR ] && { echo "Module not detected!"; exit 1; }
1717

@@ -35,8 +35,8 @@ oldstdoutLOG=$MODDIR/logs/$ID-STDOUT-old.log
3535

3636
# Start Logging verbosely
3737
mv -f $VERLOG $oldVERLOG 2>/dev/null; mv -f $LOG $oldLOG 2>/dev/null; mv -f $stdoutLOG $oldstdoutLOG 2>/dev/null
38-
exec 3>&1
39-
exec 1>$stdoutLOG
38+
# exec 3>&1
39+
# exec 1>$stdoutLOG
4040
set -x 2>$VERLOG
4141

4242
# Main
@@ -175,7 +175,7 @@ arch_arm () {
175175
*)
176176
abort "unknow arch, maybe your arch is x64?"
177177
esac
178-
wget "https://os.archlinuxarm.org/os/ArchLinuxARM-${archurl}-latest.tar.gz" -qO $tarball & e_spinner
178+
wget "https://ca.us.mirror.archlinuxarm.org/os/ArchLinuxARM-${archurl}-latest.tar.gz" -qO $tarball & e_spinner
179179
fi
180180
mkdir -p "$folder"
181181
cd "$folder"
@@ -206,7 +206,7 @@ arch_64 () {
206206
*)
207207
abort "Unknown arch, maybe your arch is x86 or arm?" ;;
208208
esac
209-
wget "https://mirrors.evowise.com/archlinux/iso/2020.08.01/archlinux-bootstrap-2020.08.01-${archurl}.tar.gz" -qO $tarball & e_spinner
209+
wget "https://mirrors.evowise.com/archlinux/iso/2020.11.01/archlinux-bootstrap-2020.11.01-${archurl}.tar.gz" -qO $tarball & e_spinner
210210
fi
211211
mkdir -p "$folder"
212212
cd "$folder"
@@ -256,6 +256,72 @@ kali () {
256256
echo "You can now launch Kali with bootlinux script"
257257
}
258258

259+
parrot () {
260+
folder="/data/parrot"
261+
if [ -d "$folder" ]; then
262+
first=1
263+
echo "skipping downloading"
264+
fi
265+
tmp="/data/local/tmp"
266+
tarball="$tmp/parrot.tar.xz"
267+
if [ "$first" != 1 ]; then
268+
if [ ! -f $tarball ]; then
269+
echo "Downloading Rootfs, please wait..."
270+
case $ARCH in
271+
x64)
272+
archurl="amd64" ;;
273+
x86)
274+
archurl="i386" ;;
275+
*)
276+
abort "unknown/unsupported arch" ;;
277+
esac
278+
wget "https://raw.githubusercontent.com/EXALAB/AnLinux-Resources/master/Rootfs/Parrot/${archurl}/parrot-rootfs-${archurl}.tar.xz" -qO $tarball & e_spinner
279+
fi
280+
mkdir -p "$folder"
281+
cd "$folder"
282+
echo "Decompressing Rootfs..."
283+
tar xfJ ${tarball} 2> /dev/null||:
284+
cd $HOME
285+
fi
286+
echo "Removing rootfs tarball for some space..."
287+
rm $tarball
288+
echo "You can now launch Parrot with bootlinux script"
289+
}
290+
291+
fedora () {
292+
folder="/data/fedora"
293+
if [ -d "$folder" ]; then
294+
first=1
295+
echo "skipping downloading"
296+
fi
297+
tmp="/data/local/tmp"
298+
tarball="$tmp/fedora.tar.xz"
299+
if [ "$first" != 1 ]; then
300+
if [ ! -f $tarball ]; then
301+
echo "Downloading Rootfs, please wait..."
302+
case $ARCH in
303+
arm)
304+
archurl="armhf" ;;
305+
arm64)
306+
archurl="arm64" ;;
307+
x64)
308+
archurl="amd64" ;;
309+
*)
310+
abort "unknown/unsupported arch" ;;
311+
esac
312+
wget "https://raw.githubusercontent.com/EXALAB/AnLinux-Resources/master/Rootfs/Fedora/${archurl}/fedora-rootfs-${archurl}.tar.xz" -qO $tarball & e_spinner
313+
fi
314+
mkdir -p "$folder"
315+
cd "$folder"
316+
echo "Decompressing Rootfs..."
317+
tar xfJ ${tarball} 2> /dev/null||:
318+
cd $HOME
319+
fi
320+
echo "Removing rootfs tarball for some space..."
321+
rm $tarball
322+
echo "You can now launch Fedora with bootlinux script"
323+
}
324+
259325
install_chroot () {
260326
clear
261327
while true; do
@@ -267,8 +333,10 @@ install_chroot () {
267333
echo "2. Arch Linux x64"
268334
echo "3. Alpine Linux"
269335
echo "4. Debian"
270-
echo "5. Kali Linux"
271-
echo "6. Ubuntu"
336+
echo "5. Fedora"
337+
echo "6. Kali Linux"
338+
echo "7. Parrot"
339+
echo "8. Ubuntu"
272340
read -r choice?'--> '
273341
echo " "
274342
case $choice in
@@ -277,8 +345,10 @@ install_chroot () {
277345
2) arch_64 ;;
278346
3) alpine ;;
279347
4) debian ;;
280-
5) kali ;;
281-
6) ubuntu ;;
348+
5) fedora ;;
349+
6) kali ;;
350+
7) parrot ;;
351+
8) ubuntu ;;
282352
esac
283353
done
284354
}
@@ -290,6 +360,8 @@ remove_chroot () {
290360
ubuntu="/data/ubuntu"
291361
arch="/data/arch"
292362
kali="/data/kali"
363+
parrot="/data/parrot"
364+
fedora="/data/fedora"
293365
if [ -d "$alpine" ]; then
294366
installed=true
295367
lmount=$alpine
@@ -305,11 +377,23 @@ remove_chroot () {
305377
elif [ -d "$kali" ]; then
306378
installed=true
307379
lmount=$kali
380+
elif [ -d "$parrot" ]; then
381+
installed=true
382+
lmount=$parrot
383+
elif [ -d "$fedora" ]; then
384+
installed=true
385+
lmount=$fedora
308386
else
309387
:
310388
fi
311389
if [ $installed ]; then
312390
killlinux
391+
echo "If dev is not successfully unmounted, please reboot your device or your device will be freezed."
392+
sleep 1
393+
echo "I give you 15 seconds to reboot your device if dev is not successfully unmounted."
394+
sleep 1
395+
echo "After reboot, you can rerun this script or remove chroot yourself with 'rm -rf /data/<chroot folder>' command"
396+
sleep 15
313397
rm -rf $lmount
314398
else
315399
echo "No chroot installed"
@@ -344,3 +428,4 @@ while true; do
344428
esac
345429
done
346430

431+

0 commit comments

Comments
 (0)