Setting up chroot logic
This commit is contained in:
parent
069ef7b55a
commit
6071fba20e
40
CONFIG.sh
40
CONFIG.sh
|
@ -6,14 +6,6 @@ shopt -s expand_aliases
|
||||||
alias echo="echo -e"
|
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 ---- #
|
# ---- Setup Variables ---- #
|
||||||
|
|
||||||
SCRIPT_PATH="$( cd "$(dirname "")" >/dev/null 2>&1 ; pwd -P )";
|
SCRIPT_PATH="$( cd "$(dirname "")" >/dev/null 2>&1 ; pwd -P )";
|
||||||
|
@ -52,9 +44,41 @@ LIVE_USER=""
|
||||||
# ---- Call CONFIG Methods Here As Needed ---- #
|
# ---- Call CONFIG Methods Here As Needed ---- #
|
||||||
set_system_release;
|
set_system_release;
|
||||||
cd "${SCRIPT_PATH}";
|
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 ---- #
|
# ---- DO NOT CHANGE OR REMOVE UNLESS YOU KNOW WHAT YOU ARE DOING ---- #
|
||||||
|
|
||||||
# Clean manifest-desktop file of unneeded parts
|
# 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'
|
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.
14
start.sh
14
start.sh
|
@ -8,26 +8,20 @@
|
||||||
. CONFIG.sh
|
. CONFIG.sh
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
sanity_check
|
if [[ $(sanity_check) -eq 1 ]]; then echo "\nExiting..."; return; fi
|
||||||
if [[ $? -eq 1 ]]; then echo "\nExiting..."; return; fi
|
|
||||||
|
|
||||||
# First setup the debootstrap env...
|
# First setup the debootstrap env...
|
||||||
./step_1_debootstrap.sh
|
./step_1_debootstrap.sh
|
||||||
# Then setup and run chroot
|
# Then setup and run chroot
|
||||||
# ./step_2_chroot.sh
|
./step_2_chroot.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function sanity_check() {
|
function sanity_check() {
|
||||||
clear;
|
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.
|
# 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
|
# We could install from current apt but I want the user and myself to be fully aware
|
||||||
# of what they are chosing. IE, they could just run the install command themselves...
|
# of what they are chosing. IE, we could just run the install command themselves...
|
||||||
debootstrap_comm=$(which debootstrap)
|
debootstrap_comm=$(which debootstrap)
|
||||||
if [[ "${debootstrap_comm}" == "" ]]; then
|
if [[ "${debootstrap_comm}" == "" ]]; then
|
||||||
echo "No deboostrap command found so will try installing from local directory...\n"
|
echo "No deboostrap command found so will try installing from local directory...\n"
|
||||||
|
|
|
@ -9,6 +9,6 @@
|
||||||
|
|
||||||
# Debootstrap process
|
# Debootstrap process
|
||||||
function main() {
|
function main() {
|
||||||
sudo debootstrap --arch=$ARCH $RELEASE chroot
|
sudo debootstrap --arch=$ARCH $RELEASE "${CHROOT_PTH}"
|
||||||
}
|
}
|
||||||
main $@;
|
main $@;
|
||||||
|
|
|
@ -9,6 +9,11 @@
|
||||||
|
|
||||||
# Debootstrap process
|
# Debootstrap process
|
||||||
function main() {
|
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 mount --bind /dev "${CHROOT_PTH}"/dev
|
||||||
|
|
||||||
sudo cp /etc/hosts "${CHROOT_PTH}"/etc/hosts
|
sudo cp /etc/hosts "${CHROOT_PTH}"/etc/hosts
|
||||||
|
@ -17,6 +22,9 @@ function main() {
|
||||||
|
|
||||||
sudo chroot "${CHROOT_PTH}"
|
sudo chroot "${CHROOT_PTH}"
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
sudo umount "${CHROOT_PTH}"/dev
|
||||||
|
|
||||||
|
|
||||||
# ---- OLD SETUP ---- #
|
# ---- OLD SETUP ---- #
|
||||||
# ## Set Xephyr and set chrooting mounts
|
# ## Set Xephyr and set chrooting mounts
|
||||||
|
|
Loading…
Reference in New Issue