Distro_Builder/step_2_chroot.sh

40 lines
1.2 KiB
Bash
Raw Normal View History

2020-05-02 00:00:17 +00:00
#!/bin/bash
. CONFIG.sh
# 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
# Debootstrap process
function main() {
2020-05-02 03:03:04 +00:00
confirm_dialouge "Launch Xephyr preview window?\n Resolution: ${RESOLUTION} Window ID: ${ID}"
if [[ $? -eq 0 ]]; then
2020-05-02 01:10:29 +00:00
Xephyr -resizeable -screen "${RES}" "${ID}" &
fi
2020-05-02 03:03:04 +00:00
clear
# Mount stuff
2020-05-02 03:45:23 +00:00
sudo mount --bind /dev "${CHROOT_PTH}"/dev/
sudo mount -t proc proc "${CHROOT_PTH}"/proc/
sudo mount -t sysfs sys "${CHROOT_PTH}"/sys/
2020-05-02 00:00:17 +00:00
2020-05-02 03:03:04 +00:00
# setup some configs stuff for internetz
2020-05-02 00:00:17 +00:00
sudo cp /etc/hosts "${CHROOT_PTH}"/etc/hosts
sudo cp /etc/resolv.conf "${CHROOT_PTH}"/etc/resolv.conf
2020-05-02 03:03:04 +00:00
sudo chown $USER "${CHROOT_PTH}"/etc/apt/sources.list
2020-05-02 00:00:17 +00:00
sudo sed s/$SYSTEM_RELEASE/$RELEASE/ < /etc/apt/sources.list > "${CHROOT_PTH}"/etc/apt/sources.list
2020-05-02 03:03:04 +00:00
sudo chown root "${CHROOT_PTH}"/etc/apt/sources.list
2020-05-02 00:00:17 +00:00
2020-05-02 03:03:04 +00:00
# Enter chroot mode
chroot_big_dump_mesage
2020-05-02 00:00:17 +00:00
sudo chroot "${CHROOT_PTH}"
2020-05-02 01:10:29 +00:00
# cleanup
2020-05-02 03:45:23 +00:00
sudo umount "${CHROOT_PTH}"/dev/
2020-05-02 03:03:04 +00:00
sudo umount -lf "${CHROOT_PTH}"/proc/
sudo umount -lf "${CHROOT_PTH}"/sys/
2020-05-02 00:00:17 +00:00
}
main $@;