Setting up chroot logic

This commit is contained in:
Maxim Stewart 2020-05-01 20:10:29 -05:00
parent 069ef7b55a
commit 6071fba20e
5 changed files with 45 additions and 19 deletions

View File

@ -6,14 +6,6 @@ shopt -s expand_aliases
alias echo="echo -e"
# The system release version working from
function set_system_release() {
IN=$(cat /etc/os-release | grep "VERSION_CODENAME")
ARRY=(${IN//=/ })
SYSTEM_RELEASE="${ARRY[1]}"
}
# ---- Setup Variables ---- #
SCRIPT_PATH="$( cd "$(dirname "")" >/dev/null 2>&1 ; pwd -P )";
@ -52,9 +44,41 @@ LIVE_USER=""
# ---- Call CONFIG Methods Here As Needed ---- #
set_system_release;
cd "${SCRIPT_PATH}";
echo "Base Dir: " $(pwd) "\n";
# Make work structure
mkdir -p "${CHROOT_PTH}"
mkdir -p image/{casper,isolinux,install}
# ---- DO NOT CHANGE OR REMOVE UNLESS YOU KNOW WHAT YOU ARE DOING ---- #
# Clean manifest-desktop file of unneeded parts
REMOVE='ubiquity ubiquity-frontend-gtk ubiquity-frontend-kde casper lupin-casper live-initramfs user-setup discover1 xresprobe os-prober libdebian-installer4'
# The system release version working from
function set_system_release() {
IN=$(cat /etc/os-release | grep "VERSION_CODENAME")
ARRY=(${IN//=/ })
SYSTEM_RELEASE="${ARRY[1]}"
}
function confirm_dialouge() {
echo $1
read -p "(yY/Nn) --> " ANSR
while [[ $ANSR != "y" ]] && [[ $ANSR != "Y" ]] && \
[[ $ANSR != "n" ]] && [[ $ANSR != "N" ]]
do
read -p "(yY/Nn) --> " ANSR
done
if [[ $ANSR == "n" ]] || [[ $ANSR == "N" ]]; then
return 1
fi
return 0
}

Binary file not shown.

View File

@ -8,26 +8,20 @@
. CONFIG.sh
function main() {
sanity_check
if [[ $? -eq 1 ]]; then echo "\nExiting..."; return; fi
if [[ $(sanity_check) -eq 1 ]]; then echo "\nExiting..."; return; fi
# First setup the debootstrap env...
./step_1_debootstrap.sh
# Then setup and run chroot
# ./step_2_chroot.sh
./step_2_chroot.sh
}
function sanity_check() {
clear;
echo "Working Dir: " $(pwd) "\n";
# Make work structure
mkdir -p work/chroot ;
# Check for debootstrap command and then install from downloaded deb if not present.
# we could install from current apt buti want the user and myself to be fully aware
# of what they are chosing. IE, they could just run the install command themselves...
# We could install from current apt but I want the user and myself to be fully aware
# of what they are chosing. IE, we could just run the install command themselves...
debootstrap_comm=$(which debootstrap)
if [[ "${debootstrap_comm}" == "" ]]; then
echo "No deboostrap command found so will try installing from local directory...\n"

View File

@ -9,6 +9,6 @@
# Debootstrap process
function main() {
sudo debootstrap --arch=$ARCH $RELEASE chroot
sudo debootstrap --arch=$ARCH $RELEASE "${CHROOT_PTH}"
}
main $@;

View File

@ -9,6 +9,11 @@
# Debootstrap process
function main() {
ansr=$(confirm_dialouge "Launch Xephyr preview window?\n Resolution: ${RES} Window ID: ${ID}")
if [[ $ansr -eq 0 ]]; then
Xephyr -resizeable -screen "${RES}" "${ID}" &
fi
sudo mount --bind /dev "${CHROOT_PTH}"/dev
sudo cp /etc/hosts "${CHROOT_PTH}"/etc/hosts
@ -17,6 +22,9 @@ function main() {
sudo chroot "${CHROOT_PTH}"
# cleanup
sudo umount "${CHROOT_PTH}"/dev
# ---- OLD SETUP ---- #
# ## Set Xephyr and set chrooting mounts