From 6f6c4b3029d8728922ac017168eef1dbaeb0ab89 Mon Sep 17 00:00:00 2001 From: Maxim Stewart Date: Sun, 3 May 2020 23:31:31 -0500 Subject: [PATCH] added cleanup commands and so logic fixes --- src/CONFIG.sh | 6 +-- src/COPY_OVER_TO_CHROOT/CLEANUP.sh | 18 ++++++++ src/COPY_OVER_TO_CHROOT/CONFIG.sh | 1 - src/COPY_OVER_TO_CHROOT/CONFIG_SCRIPTS.sh | 21 ++++----- src/COPY_OVER_TO_CHROOT/start.sh | 53 +++++++++++++++-------- src/step_4_create_CD.sh | 4 +- 6 files changed, 70 insertions(+), 33 deletions(-) diff --git a/src/CONFIG.sh b/src/CONFIG.sh index f5df519..465024c 100755 --- a/src/CONFIG.sh +++ b/src/CONFIG.sh @@ -21,7 +21,7 @@ SYSTEM_RELEASE="" # $RELEASE is the version of Ubuntu/Debian you intend to build an ISO for. # Some options: xenal, bionic, disco, focal # Versions: xenal (16.0.4), bionic (18.04), disco (19.04), focal (20.04) -RELEASE="focal" +RELEASE="" # $ARCH is the target processor architecture. @@ -29,9 +29,9 @@ RELEASE="focal" # For newer 64-bit x86 systems (also known as x64, x86_64, Intel 64, and AMD64) use amd64. ARCH="" -# the name of your distro and ISO +# The name and version of your distro and ISO OS_NAME="" -OS_VER="1.00" +OS_VER="" # The user of the live boot LIVE_USER="" diff --git a/src/COPY_OVER_TO_CHROOT/CLEANUP.sh b/src/COPY_OVER_TO_CHROOT/CLEANUP.sh index f215cd2..8fed462 100755 --- a/src/COPY_OVER_TO_CHROOT/CLEANUP.sh +++ b/src/COPY_OVER_TO_CHROOT/CLEANUP.sh @@ -13,3 +13,21 @@ dpkg-divert --rename --remove /sbin/initctl # Remove old kernels # dpkg -l 'linux-*' | sed '/^ii/!d;/hwe/d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt -y purge; update-grub + + +# ---- Get rid of some 'unneeded' blob. (Probably doing satans work with how this is aproached....) +# /usr/lib/firmware consumes nearly 550MB!! Ouch.... + +mkdir /usr/lib/me-tmp/ +mv /usr/lib/firmware/RTL8192E /usr/lib/me-tmp/ +mv /usr/lib/firmware/amd /usr/lib/me-tmp/ +mv /usr/lib/firmware/amd-ucode /usr/lib/me-tmp/ +mv /usr/lib/firmware/amdgpu /usr/lib/me-tmp/ +mv /usr/lib/firmware/intel /usr/lib/me-tmp/ +mv /usr/lib/firmware/intel-ucode /usr/lib/me-tmp/ +mv /usr/lib/firmware/nvidia /usr/lib/me-tmp/ +mv /usr/lib/firmware/qcom /usr/lib/me-tmp/ + +rm -rf /usr/lib/firmware/* +mv /usr/lib/me-tmp/* /usr/lib/firmware/ +rmdir /usr/lib/me-tmp diff --git a/src/COPY_OVER_TO_CHROOT/CONFIG.sh b/src/COPY_OVER_TO_CHROOT/CONFIG.sh index c92a2ac..66ceace 100755 --- a/src/COPY_OVER_TO_CHROOT/CONFIG.sh +++ b/src/COPY_OVER_TO_CHROOT/CONFIG.sh @@ -1,7 +1,6 @@ #!/bin/bash . CONFIG_SCRIPTS.sh -. GET_PPA_GPG_KEYS.sh # ---- Setup Variables ---- # diff --git a/src/COPY_OVER_TO_CHROOT/CONFIG_SCRIPTS.sh b/src/COPY_OVER_TO_CHROOT/CONFIG_SCRIPTS.sh index 54c95e5..68e8011 100755 --- a/src/COPY_OVER_TO_CHROOT/CONFIG_SCRIPTS.sh +++ b/src/COPY_OVER_TO_CHROOT/CONFIG_SCRIPTS.sh @@ -47,15 +47,16 @@ function start_menu_mesage() { echo "NOTE: Remember to check the CONFIG.sh and set the variables!" echo "\nWhat do you want to run?" echo "\t1) Update & Upgrade" - echo "\t2) Install Core and Live ISO Dependencies" - echo "\t3) Install Base System Packages" - echo "\t4) Install Gaming Apps" - echo "\t5) Install Media Apps" - echo "\t6) Install Office Apps" - echo "\t7) Install Debs" - echo "\t8) Transfer Setting" - echo "\t9) Add PPA Repos" - echo "\t10) Add PPA Repo Keys" - echo "\t11) Cleanup (Should run before exiting chroot.)" + echo "\t2) Install Core and Live ISO Dependencies (Ubuntu)" + echo "\t3) Install Core and Live ISO Dependencies (Debian)" + echo "\t4) Install Base System Packages" + echo "\t5) Install Gaming Apps" + echo "\t6) Install Media Apps" + echo "\t7) Install Office Apps" + echo "\t8) Install Debs" + echo "\t9) Transfer Setting" + echo "\t10) Add PPA Repo Enteries" + echo "\t11) Add PPA Repo Keys" + echo "\t12) Cleanup (Should run before exiting chroot.)" echo "\t0) EXIT" } diff --git a/src/COPY_OVER_TO_CHROOT/start.sh b/src/COPY_OVER_TO_CHROOT/start.sh index 550c307..0418ce8 100755 --- a/src/COPY_OVER_TO_CHROOT/start.sh +++ b/src/COPY_OVER_TO_CHROOT/start.sh @@ -17,21 +17,23 @@ function main() { [[ $ANSR != "4" ]] && [[ $ANSR != "5" ]] && \ [[ $ANSR != "6" ]] && [[ $ANSR != "7" ]] && \ [[ $ANSR != "8" ]] && [[ $ANSR != "9" ]] && \ - [[ $ANSR != "10" ]] && [[ $ANSR != "11" ]]; do + [[ $ANSR != "10" ]] && [[ $ANSR != "11" ]] && \ + [[ $ANSR != "12" ]]; do read -p "--> : " ANSR done case $ANSR in "1" ) update_and_upgrade;; - "2" ) install_live_iso_dependencies;; - "3" ) install_base;; - "4" ) install_gaming;; - "5" ) install_media;; - "6" ) install_office;; - "7" ) install_debs;; - "8" ) transfer_settings;; - "9" ) ./GET_PPA_REPOSITORIES.sh;; - "10" ) ./GET_PPA_GPG_KEYS.sh;; - "11" ) ./CLEANUP.sh;; + "2" ) install_live_iso_dependencies "ubuntu";; + "3" ) install_live_iso_dependencies "debian";; + "4" ) install_base;; + "5" ) install_gaming;; + "6" ) install_media;; + "7" ) install_office;; + "8" ) install_debs;; + "9" ) transfer_settings;; + "10" ) ./GET_PPA_REPOSITORIES.sh;; + "11" ) ./GET_PPA_GPG_KEYS.sh;; + "12" ) ./CLEANUP.sh;; "0" ) exit;; * ) echo "Don't know how you got here but that's a bad sign...";; esac @@ -51,12 +53,14 @@ function install_live_iso_dependencies() { apt-get install -y casper lupin-casper # Adds ~25MB of stuff apt-get install -y discover laptop-detect os-prober - # Adds ~55MB of stuff - # In keeping with ubuntu-mini-remix structure I've added this here. - # Might be a bad idea. (Actually really is a bad idea... as this should be manually called.) - # This breaks from keeping things generic for it and debian. (Maybe? Could just fail an install.) - apt-get install -y \ - ubuntu-minimal ubuntu-standard + + # Get the generic requsit packages. + case $1 in + "ubuntu" ) install_ubuntu_live_pkgs;; + "debian" ) install_debian_live_pkgs;; + esac + + install_installer # The generic kernel can baloon a system with just the above # from ~130MB to 460+MB. (With good compression of squashfs and cleaning) @@ -64,7 +68,22 @@ function install_live_iso_dependencies() { # I need to look into a kind of menu for the user where they could chose one. # For right now, we'll use this... apt-get install -y linux-generic +} +function install_ubuntu_live_pkgs() { + # Adds ~55MB of stuff + apt-get install -y \ + ubuntu-minimal ubuntu-standard +} + +function install_debian_live_pkgs() { + # Adds ~55MB of stuff {Maybe...I actually haven't checked that these exist} + apt-get install -y \ + debian-minimal debian-standard +} + + +function install_installer() { echo "Do you want to install one of the OS installers?" echo "\t1) ubiquity-frontend-gtk" diff --git a/src/step_4_create_CD.sh b/src/step_4_create_CD.sh index 147c892..2e7897b 100755 --- a/src/step_4_create_CD.sh +++ b/src/step_4_create_CD.sh @@ -12,10 +12,10 @@ function main() { cd image/ # Take note of the ending dot when changing this... - sudo mkisofs -r -V "${OS_NAME}" -cache-inodes -J -l \ + sudo mkisofs -r -V "${OS_NAME}"-"${OS_VER}" -cache-inodes -J -l \ -boot-info-table -no-emul-boot -boot-load-size 4 \ -b isolinux/isolinux.bin -c isolinux/boot.cat \ - -o ../"${OS_NAME}".iso . + -o ../"${OS_NAME}"-"${OS_VER}".iso . cd .. }