Skip to content

Commit

Permalink
Add new files
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanways committed Dec 13, 2023
1 parent 47bb6a5 commit 5fb387a
Show file tree
Hide file tree
Showing 9 changed files with 345 additions and 100 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ If you want to have a chroot directory instead of /var/pandoras make sure you ed
#!/bin/env bash
export dir=#your custom directory, or just leave it if you want to use /var/chroot
```
Keep in mind that the availability and functionality of Bash may vary based on the specific device, Android version, or Chromebook model you are using.

## Install Debootstrap

Expand Down
52 changes: 52 additions & 0 deletions includes/create_box.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/env bash
################################################################################
# Pandoras #
# #
# Universal Chroot environment that can be deployed to most Linux distros #
# #
# Change History #
# 12/11/2023 Esteban Herrera Original code. #
# Add new history entries as needed. #
# #
# #
################################################################################
################################################################################
################################################################################
# #
# Copyright (c) 2023-present Esteban Herrera C. #
# [email protected] #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #

# Creates chroot
create_box() {

export dir=/var/pandoras/

read -r -p "Type your new chroot name: " chroot
read -r -p "Type your new chroot size (in GB): " size
dd if=/dev/zero of=$dir/images/"$chroot".img bs=1G count="$size"
mke2fs -t ext4 $dir/images/"$chroot".img
mount $dir/images/"$chroot".img $dir/environment
rm -rf $dir/environment/*
read -r -p "Type your architecture: " arch
read -r -p "Type your distro codename: " distro
read -r -p "Type your mirror url (leave blank for default mirror): " mirror
debootstrap --arch "$arch" "$distro" $dir/environment/ "$mirror" &&
chroot $dir/environment /bin/su -c 'echo "#!/bin/sh" > /boot/boot.sh' &&
chroot $dir/environment /bin/su -c 'echo "" > /etc/resolv.conf'
umount $dir/environment
}

44 changes: 44 additions & 0 deletions includes/delete_box.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/env bash
################################################################################
# Pandoras #
# #
# Universal Chroot environment that can be deployed to most Linux distros #
# #
# Change History #
# 12/11/2023 Esteban Herrera Original code. #
# Add new history entries as needed. #
# #
# #
################################################################################
################################################################################
################################################################################
# #
# Copyright (c) 2023-present Esteban Herrera C. #
# [email protected] #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #

# Deletes chroot
delete_box() {

export dir=/var/pandoras/

echo "Your chroot images:
$(ls $dir/images/ | sed 's/.img//g')
"
read -r -p "Type your image name for deletion: " image
rm $dir/images/"$image".img
}

45 changes: 45 additions & 0 deletions includes/duplicate_box.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/env bash
################################################################################
# Pandoras #
# #
# Universal Chroot environment that can be deployed to most Linux distros #
# #
# Change History #
# 12/11/2023 Esteban Herrera Original code. #
# Add new history entries as needed. #
# #
# #
################################################################################
################################################################################
################################################################################
# #
# Copyright (c) 2023-present Esteban Herrera C. #
# [email protected] #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #

# Duplicates chroot
duplicate_box() {

export dir=/var/pandoras/

echo "Your chroot images:
$(ls $dir/images/ | sed 's/.img//g')
"
read -r -p "Type your old image name: " old
read -r -p "Type your new image name: " new
cp $dir/images/"$old".img $dir/images/"$new".img
}

40 changes: 40 additions & 0 deletions includes/enter_box.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/env bash
################################################################################
# Pandoras #
# #
# Universal Chroot environment that can be deployed to most Linux distros #
# #
# Change History #
# 12/11/2023 Esteban Herrera Original code. #
# Add new history entries as needed. #
# #
# #
################################################################################
################################################################################
################################################################################
# #
# Copyright (c) 2023-present Esteban Herrera C. #
# [email protected] #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #

# Enters the chroot
enter-box() {

export dir=/var/pandoras/

chroot $dir/environment /bin/su -
}

42 changes: 42 additions & 0 deletions includes/list_boxes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/env bash
################################################################################
# Pandoras #
# #
# Universal Chroot environment that can be deployed to most Linux distros #
# #
# Change History #
# 12/11/2023 Esteban Herrera Original code. #
# Add new history entries as needed. #
# #
# #
################################################################################
################################################################################
################################################################################
# #
# Copyright (c) 2023-present Esteban Herrera C. #
# [email protected] #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #

# Lists all the chroots
list_boxes() {

export dir=/var/pandoras/

echo "Your chroot images:
$(ls $dir/images/ | sed 's/.img//g')
"
}

49 changes: 49 additions & 0 deletions includes/start_box.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/env bash
################################################################################
# Pandoras #
# #
# Universal Chroot environment that can be deployed to most Linux distros #
# #
# Change History #
# 12/11/2023 Esteban Herrera Original code. #
# Add new history entries as needed. #
# #
# #
################################################################################
################################################################################
################################################################################
# #
# Copyright (c) 2023-present Esteban Herrera C. #
# [email protected] #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #

# Starts chroot
start_box() {

export dir=/var/pandoras/

echo "Your chroot images:
$(ls $dir/images/ | sed 's/.img//g')
"
read -r -p "Type your image name: " image
mount $dir/images/"$image".img $dir/environment
mount -o bind /etc/resolv.conf $dir/environment/etc/resolv.conf
mount -o bind /dev $dir/environment/dev
mount -o bind /proc $dir/environment/proc
mount -o bind /sys $dir/environment/sys
chroot $dir/environment /bin/su -c 'sh /boot/boot.sh'
}

Loading

0 comments on commit 5fb387a

Please sign in to comment.