Skip to content

Commit

Permalink
add void linux; feature: now can seamlessly run 2 or more installed c…
Browse files Browse the repository at this point in the history
…hroot by passing argument to folder

Signed-off-by: Azriel Akbar Ferry Ardiansyah Kusumawardhana <ferryakbarardiansyah@gmail.com>
  • Loading branch information
FerryAr committed May 13, 2022
1 parent e660471 commit a0ddd64
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ mount_image <path to img> <path to linux directory>
- Kali Linux, Installed on /data/kali
- Manjaro ARM, Installed on /data/manjaro
- Ubuntu, Installed on /data/ubuntu
- Void Linux, Installed on /data/void

...more distro added soon

Expand Down
2 changes: 1 addition & 1 deletion module.prop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id=lhroot
name=Linux Chroot Installer
version=v2.0.0
version=v2.1.0
versionCode=1
author=FerryAr
description=Systemless linux chroot installer and chroot boot script
4 changes: 1 addition & 3 deletions system/bin/bootlinux
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@
SCRIPT_PATH=$(readlink -f $0)
. ${SCRIPT_PATH%/*}/bootlinux_env

if [ $# -eq 0 ]; then
$busybox chroot $mnt /usr/bin/env su -l
fi
$busybox chroot $mnt /usr/bin/env su -l
11 changes: 10 additions & 1 deletion system/bin/bootlinux_init
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ f_checkforroot(){

######### VARIABLES #########
mnt=
if [ -d "/data/alpine" ]; then
if [ -n "$1" ]; then
if [ -d "$1" ]; then
mnt=$1
else
echo "Directory $1 does not found"
exit 1
fi
elif [ -d "/data/alpine" ]; then
mnt=/data/alpine
elif [ -d "/data/debian" ]; then
mnt=/data/debian
Expand All @@ -35,6 +42,8 @@ elif [ -d "/data/fedora" ]; then
mnt=/data/fedora
elif [ -d "/data/manjaro" ]; then
mnt=/data/manjaro
elif [ -d "/data/void" ]; then
mnt=/data/void
else
echo "No chroot installed";
exit 1
Expand Down
11 changes: 10 additions & 1 deletion system/bin/killlinux
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ else
exit
fi
export bin=/system/bin
if [ -d "/data/alpine" ]; then
if [ -n "$1" ]; then
if [ -d "$1" ]; then
export mnt="$1"
else
echo "Directory $1 not exist"
exit 1
fi
elif [ -d "/data/alpine" ]; then
export mnt=/data/alpine
elif [ -d "/data/debian" ]; then
export mnt=/data/debian
Expand All @@ -24,6 +31,8 @@ elif [ -d "/data/arch" ]; then
export mnt=/data/arch
elif [ -d "/data/manjaro" ]; then
export mnt=/data/manjaro
elif [ -d "/data/void" ]; then
export mnt="/data/void"
else
echo "No chroot installed"
exit 1
Expand Down
45 changes: 44 additions & 1 deletion system/bin/lhroot
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,43 @@ ubuntu () {
echo "You can now launch Ubuntu with the bootlinux script"
}

void () {
folder="/data/void"
if [ -d "$folder" ]; then
first=1
echo "skipping downloading"
fi
tmp="/data/local/tmp"
tarball="$tmp/void.tar.xz"
archurl=
if [ "$first" != 1 ]; then
if [ ! -f $tarball ]; then
echo "Downloading Rootfs, please wait..."
case $ARCH in
arm)
archurl="armhf" ;;
arm64)
archurl="arm64" ;;
x86)
archurl="i386" ;;
x64)
archurl="amd64" ;;
*)
abort "unknown arch" ;;
esac
wget "https://raw.githubusercontent.com/FerryAr/lhroot-repo/main/Rootfs/Void/${archurl}/void-rootfs-${archurl}.tar.xz" -qO $tarball & e_spinner
fi
mkdir -p "$folder"
cd "$folder"
echo "Decompressing Rootfs..."
tar xfJ ${tarball} 2> /dev/null||:
cd $HOME
fi
echo "Removing rootfs tarball for some space"
rm $tarball
echo "You can now launch Void with bootlinux script"
}

arch_arm () {
folder="/data/arch"
if [ -d "$folder" ]; then
Expand All @@ -163,7 +200,7 @@ arch_arm () {
fi
tmp="/data/local/tmp"
tarball="$tmp/arch.tar.gz"
if [ "$first != 1" ]; then
if [ "$first" != 1 ]; then
if [ ! -f $tarball ]; then
echo "Downloading Rootfs, please wait..."
archurl=
Expand Down Expand Up @@ -334,6 +371,7 @@ install_chroot () {
echo "6. Kali Linux"
echo "7. Manjaro"
echo "8. Ubuntu"
echo "9. Void Linux"
read -r choice?'--> '
echo " "
case $choice in
Expand All @@ -346,6 +384,7 @@ install_chroot () {
6) kali ;;
7) manjaro ;;
8) ubuntu ;;
9) void ;;
esac
done
}
Expand All @@ -359,6 +398,7 @@ remove_chroot () {
kali="/data/kali"
fedora="/data/fedora"
manjaro="/data/manjaro"
void="/data/void"
if [ -d "$alpine" ]; then
installed=true
lmount=$alpine
Expand All @@ -380,6 +420,9 @@ remove_chroot () {
elif [ -d "$manjaro" ]; then
installed=true
lmount=$manjaro
elif [ -d "$void" ]; then
installed=true
lmount=$void
else
:
fi
Expand Down

0 comments on commit a0ddd64

Please sign in to comment.