2020-05-02 00:00:17 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# set -o xtrace ## To debug scripts
|
|
|
|
# set -o errexit ## To exit on error
|
|
|
|
# set -o errunset ## To exit if a variable is referenced but not set
|
|
|
|
|
|
|
|
|
|
|
|
. CONFIG.sh
|
|
|
|
|
|
|
|
function main() {
|
2020-05-02 06:51:54 +00:00
|
|
|
clear;
|
2020-05-02 01:10:29 +00:00
|
|
|
if [[ $(sanity_check) -eq 1 ]]; then echo "\nExiting..."; return; fi
|
2020-05-02 00:00:17 +00:00
|
|
|
|
2020-05-02 08:48:38 +00:00
|
|
|
start_menu_mesage
|
|
|
|
read -p "--> : " ANSR
|
|
|
|
while [[ $ANSR != "0" ]] && [[ $ANSR != "1" ]] && \
|
|
|
|
[[ $ANSR != "2" ]] && [[ $ANSR != "3" ]] && \
|
|
|
|
[[ $ANSR != "4" ]] && [[ $ANSR != "5" ]] && \
|
|
|
|
[[ $ANSR != "6" ]]; do
|
|
|
|
read -p "--> : " ANSR
|
|
|
|
done
|
|
|
|
case $ANSR in
|
|
|
|
"0" ) do_all_run; break;;
|
|
|
|
# First setup the debootstrap env...
|
|
|
|
"1" ) ./step_1_debootstrap.sh; break;;
|
|
|
|
# Then setup and run chroot...
|
|
|
|
"2" ) ./step_2_chroot.sh; break;;
|
|
|
|
# Create the boot structure data...
|
|
|
|
"3" ) ./step_3_create_boot_structure.sh; break;;
|
|
|
|
# Create the CD...
|
|
|
|
"4" ) ./step_4_create_CD.sh; break;;
|
|
|
|
# Purge everythin and start fresh...
|
|
|
|
"5" ) ./cleanup.sh; break;;
|
|
|
|
"6" ) exit; break;;
|
|
|
|
* ) echo "Don't know how you got here but that's a bad sign..."; break;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
function do_all_run() {
|
|
|
|
# Starting with a clean slate
|
|
|
|
./cleanup.sh;
|
2020-05-02 00:00:17 +00:00
|
|
|
# First setup the debootstrap env...
|
2020-05-02 08:48:38 +00:00
|
|
|
./step_1_debootstrap.sh;
|
2020-05-02 06:30:03 +00:00
|
|
|
# Then setup and run chroot...
|
2020-05-02 08:48:38 +00:00
|
|
|
./step_2_chroot.sh;
|
2020-05-02 07:49:09 +00:00
|
|
|
# Create the boot structure data...
|
2020-05-02 08:48:38 +00:00
|
|
|
./step_3_create_boot_structure.sh;
|
2020-05-02 06:30:03 +00:00
|
|
|
# Create the CD...
|
2020-05-02 08:48:38 +00:00
|
|
|
./step_4_create_CD.sh;
|
2020-05-02 00:00:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function sanity_check() {
|
|
|
|
# Check for debootstrap command and then install from downloaded deb if not present.
|
2020-05-02 01:10:29 +00:00
|
|
|
# We could install from current apt but I want the user and myself to be fully aware
|
2020-05-02 07:11:56 +00:00
|
|
|
# of what they are chosing. IE, we could just run the install command itself...
|
2020-05-02 00:00:17 +00:00
|
|
|
debootstrap_comm=$(which debootstrap)
|
|
|
|
if [[ "${debootstrap_comm}" == "" ]]; then
|
|
|
|
echo "No deboostrap command found so will try installing from local directory...\n"
|
|
|
|
if [[ ! -f "debootstrap.deb" ]]; then
|
|
|
|
echo "No debootstrap deb file found in current directory...";
|
|
|
|
echo "Please download one from:\n\thttps://packages.ubuntu.com/search?keywords=debootstrap&searchon=names&suite=all§ion=all";
|
|
|
|
echo "After download rename it to: debootstrap.deb\n";
|
|
|
|
echo "OR\n"
|
|
|
|
echo "Run: sudo apt install debootstrap"
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
sudo dpkg -i ./deboostrap.deb
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
xyphr=$(which Xephyr) ## Chroot view window || alt desktop window
|
|
|
|
sysLnx=$(which syslinux) ## Casper stuff
|
2020-05-02 06:30:03 +00:00
|
|
|
sysTools=$(which ppmtolss16) ## Part of syslinux-utils
|
2020-05-02 00:00:17 +00:00
|
|
|
squash=$(which unsquashfs) ## Squashfs-tools
|
|
|
|
genIso=$(which genisoimage) ## Iso maker
|
2020-05-02 06:30:03 +00:00
|
|
|
netpbm=$(which bmptoppm) ## Boot splash maker part
|
2020-05-02 00:00:17 +00:00
|
|
|
if [[ $xyphr == "" ]] || [[ $sysLnx == "" ]] || \
|
|
|
|
[[ $squash == "" ]] || [[ $genIso == "" ]]; then
|
|
|
|
echo "# ---- Missing Some Packages ---- #\n" \
|
|
|
|
"Xephyr :" "${xyphr}\n" \
|
|
|
|
"Syslinux :" "${sysLnx}\n" \
|
|
|
|
"Squashfs-tools :" "${squash}\n" \
|
|
|
|
"Genisoimage :" "${genIso}\n" \
|
2020-05-02 06:30:03 +00:00
|
|
|
"Netpbm :" "${netpbm}\n" \
|
2020-05-02 00:00:17 +00:00
|
|
|
"Going to run :\n" \
|
2020-05-02 06:30:03 +00:00
|
|
|
"\tapt-get install xserver-xephyr syslinux squashfs-tools genisoimage netpbm syslinux-utils -y"
|
2020-05-02 00:00:17 +00:00
|
|
|
sleep 2
|
2020-05-02 06:51:54 +00:00
|
|
|
sudo apt-get install xserver-xephyr syslinux squashfs-tools genisoimage netpbm syslinux-utils -y
|
2020-05-02 00:00:17 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${ARCH}" == "" ]] || [[ "${RELEASE}" == "" ]]; then
|
|
|
|
echo "Please check CONFIG.sh and set the ARCH and RELEASE data...";
|
|
|
|
return 1;
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${OS_NAME}" == "" ]] || [[ "${LIVE_USER}" == "" ]]; then
|
|
|
|
echo "Please check CONFIG.sh and set the OS_NAME and LIVE_USER data...";
|
|
|
|
return 1;
|
|
|
|
fi
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
main $@;
|