forked from rafi16jan/universal-chroot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
47bb6a5
commit 5fb387a
Showing
9 changed files
with
345 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 - | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
} | ||
|
Oops, something went wrong.