#!/usr/bin/env bash # Debian ISO Remastering for DanOS - https://github.com/ITmail-dk/qmade/ # sudo apt install -y wget git xorriso isolinux p7zip-full fakeroot binutils # DVD ISO Base offline #DEBIAN_ISO_URL=https://cdimage.debian.org/debian-cd/current/amd64/iso-dvd/ #GET_ISO_NAME=$(curl -s https://cdimage.debian.org/debian-cd/current/amd64/iso-dvd/ | grep -oP 'debian-\d+(?:\.\d+)+-amd64-DVD-1\.iso' | head -n 1) # KDE Live DVD ISO Base offline #DEBIAN_ISO_URL=https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/ #GET_ISO_NAME=$(curl -s https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/ | grep -oP 'debian-live-\d+(?:\.\d+)+-amd64-kde\.iso' | head -n 1) # Standard Live DVD ISO Base offline DEBIAN_ISO_URL=https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/ GET_ISO_NAME=$(curl -s https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/ | grep -oP 'debian-live-\d+(?:\.\d+)+-amd64-standard\.iso' | head -n 1) # NetInstall ISO #DEBIAN_ISO_URL=https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/ #GET_ISO_NAME=$(curl -s https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/ | grep -oP 'debian-\d+(?:\.\d+)+-amd64-netinst\.iso' | head -n 1) # PRESEED_ISO_NAME=DanOS-Debian ISO_WORK_TMP=iso-offline-extract # Setup the environment for creating the new ISO version. function setup() { echo "Starting the setup process..." sudo apt update && sudo apt install -y curl wget git xorriso isolinux p7zip-full fakeroot binutils apt-utils dpkg-dev debootstrap if [ -f source-debian.iso ]; then rm source-debian.iso fi if [ ! -f source-debian.iso ]; then wget -O source-debian.iso $DEBIAN_ISO_URL/"$GET_ISO_NAME" fi xorriso -osirrox on -indev source-debian.iso -extract / $ISO_WORK_TMP sudo chmod -R +w $ISO_WORK_TMP sudo cp -fu preseed-user.cfg $ISO_WORK_TMP/preseed.cfg || exit 1 sudo rm -rf $ISO_WORK_TMP/src || true sudo cp -rfup src/ $ISO_WORK_TMP/ || exit 1 sudo cp -fu src/grub/splash.png $ISO_WORK_TMP/boot/grub/splash.png || exit 1 sudo cp -fu install-danos.sh $ISO_WORK_TMP/install.sh || exit 1 sudo sed -i 's/append vga/append auto=true vga/' $ISO_WORK_TMP/boot/grub\install.cfg sudo sed -i '/spkgtk\.cfg/d; /spk\.cfg/d' $ISO_WORK_TMP/isolinux/menu.cfg sudo sed -i 's/--- quiet/--- quiet file=\/cdrom\/preseed.cfg/' $ISO_WORK_TMP/isolinux/gtk.cfg # vga=788 to vga=794 in /boot/grub/grub.cfg "see more on https://pierre.baudu.in/other/grub.vga.modes.html" sudo sed -i 's/vga=788/vga=794/g' $ISO_WORK_TMP/boot/grub/grub.cfg sudo sed -i 's/gfxmode=800x600/gfxmode=1280x1024/g' $ISO_WORK_TMP/boot/grub/config.cfg sudo sed -i 's/set default=0/set default=3/g' $ISO_WORK_TMP/boot/grub/config.cfg sudo sed -i '0,/--- quiet/ s/--- quiet/auto=true file=\/cdrom\/preseed.cfg --- quiet/' $ISO_WORK_TMP/boot/grub/grub.cfg #sudo sed -i '0,/788 --- quiet/ s/788 --- quiet/788 auto=true file=\/cdrom\/preseed.cfg --- quiet/' $ISO_WORK_TMP/boot/grub/grub.cfg #sudo sed -i '0,/--- quiet/ s/--- quiet/auto=true priority=high file=\/cdrom\/preseed.cfg --- quiet/' $ISO_WORK_TMP/boot/grub/grub.cfg #sudo sed -i '42,46d' $ISO_WORK_TMP/boot/grub/grub.cfg # Removing items and the boot menu #sudo sed -i '64,83d' $ISO_WORK_TMP/boot/grub/grub.cfg #sudo sed -i '/set theme=\/boot\/grub\/theme\/1/a set default=0' $ISO_WORK_TMP/boot/grub/grub.cfg #sudo sed -i '/set theme=\/boot\/grub\/theme\/1/a set timeout=7' $ISO_WORK_TMP/boot/grub/grub.cfg if [ -f source-debian.iso ]; then rm source-debian.iso fi #sudo mkdir -p $ISO_WORK_TMP/var/cache/apt/archives #sudo apt reinstall --download-only -y -o Dir::Cache="./" -o Dir::Cache::archives="iso-extract/src/packages/" \ # wget curl git xdg-utils xdg-user-dirs build-essential htop dkms cmake plymouth plymouth-themes power-profiles-daemon wayland-protocols wayland-utils wlr-randr libwlroots-0.18 #sudo chmod -R +r iso-extract/src/packages/ make } # Make a new ISO file after removing the old one if it exists. function make() { if [ -d $ISO_WORK_TMP ]; then echo "Starting the make process..." sudo rm -rf $ISO_WORK_TMP/src sudo cp -rfup src/ $ISO_WORK_TMP/ || exit 1 sudo rm -f $ISO_WORK_TMP/install.sh sudo cp -fu install-danos.sh $ISO_WORK_TMP/install.sh || exit 1 sudo rm -f $ISO_WORK_TMP/preseed.cfg sudo cp preseed-user.cfg $ISO_WORK_TMP/preseed.cfg || exit 1 if [ -f $PRESEED_ISO_NAME.iso ]; then rm $PRESEED_ISO_NAME.iso; fi xorriso -as mkisofs -o $PRESEED_ISO_NAME.iso -V "DANOS_DEBIAN" -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -c isolinux/boot.cat -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot -isohybrid-gpt-basdat $ISO_WORK_TMP ls -lah ./*.iso else echo "$ISO_WORK_TMP does not exist, runing setup..." setup fi } function usb() { lsblk echo -en "Enter the name of the USB Disk so sda, sdb etc..: " read -r USB_DISK clear sudo dd bs=4M status=progress conv=fsync oflag=direct if="$(pwd)"/$PRESEED_ISO_NAME.iso of=/dev/"$USB_DISK" echo "ISO to USB All done." } # Run the function by, function_name "$@" make