From c454f0f66f47f4647913a7b0d650ff9c4c677a8e Mon Sep 17 00:00:00 2001 From: Maxim Stewart Date: Fri, 1 May 2020 19:00:17 -0500 Subject: [PATCH] New structure of project and work flow --- AUTO_INSTALL.sh | 101 ------ CONFIG | 31 -- CONFIG.sh | 60 ++++ .../DEB32/32_BIT_DEBS_GO_HERE.txt | 1 - .../DEB64/64_BIT_DEBS_GO_HERE.txt | 1 - COPY_OVER_TO_CHROOT/PPA_GPG.sh | 2 - COPY_OVER_TO_CHROOT/PPA_LIST.txt | 1 - ...H_SCRIPTS_TO_COPY_MOVE_THEM_TO_THE_SYS.txt | 1 - .../Chroot_Distro_Build.txt | 0 {NOTES_LICENCE => NOTES}/EXAMPLE-ISOLINUX-CFG | 0 {NOTES_LICENCE => NOTES}/Example_Bashrc.txt | 0 {NOTES_LICENCE => NOTES}/Useful_Commands.txt | 0 {NOTES_LICENCE => NOTES}/listInstalledPKGs.sh | 0 NOTES_LICENCE/GPL2_LICENSE.txt | 339 ------------------ cleanup.sh | 2 - dist_Builder.sh | 224 ------------ start.sh | 80 +++++ step_1_debootstrap.sh | 14 + step_2_chroot.sh | 42 +++ 19 files changed, 196 insertions(+), 703 deletions(-) delete mode 100755 AUTO_INSTALL.sh delete mode 100755 CONFIG create mode 100644 CONFIG.sh delete mode 100644 COPY_OVER_TO_CHROOT/DEB32/32_BIT_DEBS_GO_HERE.txt delete mode 100644 COPY_OVER_TO_CHROOT/DEB64/64_BIT_DEBS_GO_HERE.txt delete mode 100644 COPY_OVER_TO_CHROOT/PPA_GPG.sh delete mode 100644 COPY_OVER_TO_CHROOT/PPA_LIST.txt delete mode 100644 COPY_OVER_TO_CHROOT/SETTINGS_THEMES/PLACE_SYSTEM_FILES_HERE_AND_CREATE_SH_SCRIPTS_TO_COPY_MOVE_THEM_TO_THE_SYS.txt rename {NOTES_LICENCE => NOTES}/Chroot_Distro_Build.txt (100%) rename {NOTES_LICENCE => NOTES}/EXAMPLE-ISOLINUX-CFG (100%) rename {NOTES_LICENCE => NOTES}/Example_Bashrc.txt (100%) rename {NOTES_LICENCE => NOTES}/Useful_Commands.txt (100%) rename {NOTES_LICENCE => NOTES}/listInstalledPKGs.sh (100%) delete mode 100644 NOTES_LICENCE/GPL2_LICENSE.txt delete mode 100644 cleanup.sh delete mode 100755 dist_Builder.sh create mode 100755 start.sh create mode 100644 step_1_debootstrap.sh create mode 100644 step_2_chroot.sh diff --git a/AUTO_INSTALL.sh b/AUTO_INSTALL.sh deleted file mode 100755 index 57f9a37..0000000 --- a/AUTO_INSTALL.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/bash - - -setup() { -export HOME=/root -export LC_ALL=C -export DISPLAY=:10 - -cat COPY_OVER_TO_CHROOT/PPA_LIST.txt > /etc/apt/sources.list -bash COPY_OVER_TO_CHROOT/PPA_GPG.sh -apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4B4E7A9523ACD201 ## get MEGA gpg key - -#-------------------------------Bellow adds other PPAs----------------------------------# -apt-get update -apt-get install apt-transport-https software-properties-common -y ## Get add-apt-repository - -## INSERT PPA ADDS HEDRE - -apt-get update && apt-get upgrade -y -main -} -#-------------------------------Bellow Installs the main system------------------------# - -######################## Main Desktop ######################## -main() { -## MOSTLY BASE SYSTEM PROGRAMS | Might wish to use another internet manager -## besides Wicd-gtk and might not want to use Slim as a login manager - apt-get install xserver-xorg xorg xinit slim synaptic aptitude apt-xapian-index \ - gufw wicd-gtk pulseaudio pavucontrol file-roller p7zip-rar arj rar unrar-free \ - xcompmgr tweak lhasa unar p7zip zip terminator stjerm gparted gdebi sox udisks2 \ - iftop htop tree hardinfo libsox-fmt-all onboard mc -y - - apt-get autoremove --purge -y && apt-get autoclean - -gaming -} - -############ Gaming ############ -gaming() { -## INSERT GAMING STUFF HEDRE - -media -} - -################### Multimedia-- Videos- Images- Etc ################### -media() { -## INSERT MEDIA STUFF HEDRE - -office -} - -######################### Office-General Stuff ######################### -office() { -## INSERT OFFICE & OTHER STUFF HEDRE - -debs -} - -################### Looks at DEB32/64 dirs to install software #################### -## INSERT GAMING STUFF HEDRE -debs() { -ARCH=$(uname -m) -touch COPY_OVER_TO_CHROOT/DEBS.sh - - if [[ "${ARCH}" == "i386" ]]; then - ls COPY_OVER_TO_CHROOT/DEB32/ > COPY_OVER_TO_CHROOT/DEBS.sh - ARCH="DEB32/" - elif [[ "${ARCH}" == "x86_64" ]]; then - ls COPY_OVER_TO_CHROOT/DEB64/ > COPY_OVER_TO_CHROOT/DEBS.sh - ARCH="DEB64/" - fi - - sed -i "s|^|dpkg -i ${ARCH}/|" COPY_OVER_TO_CHROOT/DEBS.sh - bash COPY_OVER_TO_CHROOT/DEBS.sh - -setSettings -} - -######################### Copy Settings to their locations ######################### -setSettings() { - -## COPY/REMOVE SETTING FIES HERE -## Fine tune the system - -cleanr -} - -######################### Cleanup System ######################### -cleanr() { - apt-get autoremove --purge -y - apt-get autoclean -y - aptitude keep-all -y - rm -rf COPY_OVER_TO_CHROOT/ - clear - echo "" - echo "" - echo "Please remove this scrit then type exit to continue build..." - echo "" - echo "" -} -setup diff --git a/CONFIG b/CONFIG deleted file mode 100755 index 0501c2c..0000000 --- a/CONFIG +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -## Resolution of Xephyr -## Examples: 1920x1080 or 1600x900, etc -RES="1920x1080" - -## Screen-id of Xephyr -## Examples: :10 or :1.0, etc -## Note: Don't use :0 or :0.0 as they are your system's. -ID=":10" - -## Iso Version -## Examples: 16.04 or 15.04, etc -## Miniremix versions : http://www.ubuntu-mini-remix.org/ -VERSION="16.04" - -## Iso Archatect -## Examples: 32bit i386 or 64bit amd64, etc -ARCH="amd64" - -## Iso boot info -NAME="" ## Set to your distro name - -## Live User -lvUSER="" ## Set to your preference - - -## DO NOT CHANGE OR REMOVE BELOW UNLESS YOU KNOW WHAT YOU ARE DOING ## - -## 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' diff --git a/CONFIG.sh b/CONFIG.sh new file mode 100644 index 0000000..0dddc95 --- /dev/null +++ b/CONFIG.sh @@ -0,0 +1,60 @@ +#!/bin/bash + + +# ---- Setup Aliases ---- # +shopt -s expand_aliases +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 ---- # + + +# Chroot path +CHROOT_PTH="./work/chroot" + +# Resolution of Xephyr... ex: 1920x1080 or 1600x900, etc +RESOLUTION="1920x1080" + +# Screen-id of Xephyr... ex: :10 or :1.0, etc +# Note: Don't use :0 or :0.0 as they are your system's. +ID=":10" + + +# Your system release... this is set by set_system_release +# function above and can be safetly ignored +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="" + +# $ARCH is the target processor architecture. +# For old 32 bit x86 systems use i386. +# 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 +OS_NAME="" + +# The user of the live boot +LIVE_USER="" + + +# ---- Call CONFIG Methods Here As Needed ---- # +set_system_release; + + +# ---- DO NOT CHANGE OR REMOVE UNLESS YOU KNOW WHAT YOU ARE DOING ---- # + +# 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' diff --git a/COPY_OVER_TO_CHROOT/DEB32/32_BIT_DEBS_GO_HERE.txt b/COPY_OVER_TO_CHROOT/DEB32/32_BIT_DEBS_GO_HERE.txt deleted file mode 100644 index e49c8a7..0000000 --- a/COPY_OVER_TO_CHROOT/DEB32/32_BIT_DEBS_GO_HERE.txt +++ /dev/null @@ -1 +0,0 @@ -INSERT PPA LIST FROM UBUNTU SRC LIST GENERATOR WEBSITE HERE diff --git a/COPY_OVER_TO_CHROOT/DEB64/64_BIT_DEBS_GO_HERE.txt b/COPY_OVER_TO_CHROOT/DEB64/64_BIT_DEBS_GO_HERE.txt deleted file mode 100644 index e49c8a7..0000000 --- a/COPY_OVER_TO_CHROOT/DEB64/64_BIT_DEBS_GO_HERE.txt +++ /dev/null @@ -1 +0,0 @@ -INSERT PPA LIST FROM UBUNTU SRC LIST GENERATOR WEBSITE HERE diff --git a/COPY_OVER_TO_CHROOT/PPA_GPG.sh b/COPY_OVER_TO_CHROOT/PPA_GPG.sh deleted file mode 100644 index 05c5479..0000000 --- a/COPY_OVER_TO_CHROOT/PPA_GPG.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/bash -INSERT GPG KEY RETRIEVAL HERE diff --git a/COPY_OVER_TO_CHROOT/PPA_LIST.txt b/COPY_OVER_TO_CHROOT/PPA_LIST.txt deleted file mode 100644 index e49c8a7..0000000 --- a/COPY_OVER_TO_CHROOT/PPA_LIST.txt +++ /dev/null @@ -1 +0,0 @@ -INSERT PPA LIST FROM UBUNTU SRC LIST GENERATOR WEBSITE HERE diff --git a/COPY_OVER_TO_CHROOT/SETTINGS_THEMES/PLACE_SYSTEM_FILES_HERE_AND_CREATE_SH_SCRIPTS_TO_COPY_MOVE_THEM_TO_THE_SYS.txt b/COPY_OVER_TO_CHROOT/SETTINGS_THEMES/PLACE_SYSTEM_FILES_HERE_AND_CREATE_SH_SCRIPTS_TO_COPY_MOVE_THEM_TO_THE_SYS.txt deleted file mode 100644 index e49c8a7..0000000 --- a/COPY_OVER_TO_CHROOT/SETTINGS_THEMES/PLACE_SYSTEM_FILES_HERE_AND_CREATE_SH_SCRIPTS_TO_COPY_MOVE_THEM_TO_THE_SYS.txt +++ /dev/null @@ -1 +0,0 @@ -INSERT PPA LIST FROM UBUNTU SRC LIST GENERATOR WEBSITE HERE diff --git a/NOTES_LICENCE/Chroot_Distro_Build.txt b/NOTES/Chroot_Distro_Build.txt similarity index 100% rename from NOTES_LICENCE/Chroot_Distro_Build.txt rename to NOTES/Chroot_Distro_Build.txt diff --git a/NOTES_LICENCE/EXAMPLE-ISOLINUX-CFG b/NOTES/EXAMPLE-ISOLINUX-CFG similarity index 100% rename from NOTES_LICENCE/EXAMPLE-ISOLINUX-CFG rename to NOTES/EXAMPLE-ISOLINUX-CFG diff --git a/NOTES_LICENCE/Example_Bashrc.txt b/NOTES/Example_Bashrc.txt similarity index 100% rename from NOTES_LICENCE/Example_Bashrc.txt rename to NOTES/Example_Bashrc.txt diff --git a/NOTES_LICENCE/Useful_Commands.txt b/NOTES/Useful_Commands.txt similarity index 100% rename from NOTES_LICENCE/Useful_Commands.txt rename to NOTES/Useful_Commands.txt diff --git a/NOTES_LICENCE/listInstalledPKGs.sh b/NOTES/listInstalledPKGs.sh similarity index 100% rename from NOTES_LICENCE/listInstalledPKGs.sh rename to NOTES/listInstalledPKGs.sh diff --git a/NOTES_LICENCE/GPL2_LICENSE.txt b/NOTES_LICENCE/GPL2_LICENSE.txt deleted file mode 100644 index d159169..0000000 --- a/NOTES_LICENCE/GPL2_LICENSE.txt +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/cleanup.sh b/cleanup.sh deleted file mode 100644 index 59492c0..0000000 --- a/cleanup.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -sudo rm -rf iso/ squashfs-root/ diff --git a/dist_Builder.sh b/dist_Builder.sh deleted file mode 100755 index 71eb08e..0000000 --- a/dist_Builder.sh +++ /dev/null @@ -1,224 +0,0 @@ -#!/bin/bash -. CONFIG - -rootNisoChk() { - if [ "$(id -u)" -eq 0 ]; then - softChk - else - echo "Sorry, you are not root." - exit 1 - fi -} - -softChk() { -xyphr=$(which Xephyr) ## Chroot view window || alt desktop window -sysLnx=$(which syslinux) ## Casper stuff -squash=$(which unsquashfs) ## Squashfs-tools -genIso=$(which genisoimage) ## Iso maker - - clear - if [[ $xyphr == "" ]] || [[ $sysLnx == "" ]] || \ - [[ $squash == "" ]] || [[ $genIso == "" ]]; then - echo -e "## Missing some packages ##\n" \ - "Xephyr :" "${xyphr}\n" \ - "Syslinux :" "${sysLnx}\n" \ - "Squashfs-tools :" "${squash}\n" \ - "Genisoimage :" "${genIso}\n" \ - "Going to run :\n" \ - " apt-get install xserver-xephyr syslinux squashfs-tools genisoimage -y" - sleep 4 - apt-get install xserver-xephyr syslinux squashfs-tools genisoimage -y - getIso - else - getIso - fi -} - -getIso() { - clear - echo -e "## Download Ubuntu Mini Remix ##\n" \ - "Would you like to download an Ubuntu Mini Iso?" - read -p "(yY/Nn) --> " ANSR - while [[ $ANSR != "y" ]] && [[ $ANSR != "Y" ]] && \ - [[ $ANSR != "n" ]] && [[ $ANSR != "N" ]] - do - read -p "(yY/Nn) --> " ANSR - done - - ## Check if dl iso is wanted then dl it - if [[ $ANSR == "Y" ]] || [[ $ANSR == "y" ]]; then - clear - echo -e "## Default Settings Or Set Version And Arch ##\n" \ - "Would you like to use the default choices? " - 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 - clear - echo -e "## Get Version ##\n" \ - "What version would you like?\n" \ - "Examples :\n" \ - " LTS : 16.04\n" \ - " Non-LTS : 15.10\n" \ - "Be very sure you are correctly entering the version." - read -p "Version --> : " VERSION - clear - echo -e "## Get Architect ##\n" \ - "What version would you like?\n" \ - " 32bit : i386\n" \ - " 64bit : amd64\n" \ - "Be very sure you are correctly entering the architect." - read -p "Arch --> : " ARCH - wget http://ubuntu-mini-remix.mirror.garr.it/mirrors/ubuntu-mini-remix/"${VERSION}"/ubuntu-mini-remix-"${VERSION}"-"${ARCH}".iso - else - wget http://ubuntu-mini-remix.mirror.garr.it/mirrors/ubuntu-mini-remix/"${VERSION}"/ubuntu-mini-remix-"${VERSION}"-"${ARCH}".iso - main - fi - else - main - fi -} - -main() { - list=$(find . -maxdepth 1 -name "*.iso" -printf '%P\n') - if [[ "${list}" == "" ]] && [ ! -d squashfs-root ]; then - clear - echo -e "Sorry, there is no iso or squashfs-root dir to work with in the current directory.\n" - "Going back to download an Ubuntu Mini Iso..." - sleep 4 - getIso - elif [[ "${list}" != "" ]] && [ -d squashfs-root ]; then - ANSR="" - while [[ $ANSR != "1" ]] && [[ $ANSR != "2" ]] && [[ $ANSR != "3" ]]; do - clear - echo -e "Both an iso(s) and squashfs-root are present...\n" \ - "Which do you wish to use?\n" \ - "1.) Use ISO(s)\n" \ - "2.) Use former session: squashfs-root\n" \ - "3.) Exit" - read -p "--> : " ANSR - done - - if [[ $ANSR == "1" ]]; then - bash cleanup.sh - mountAndCopy - elif [[ $ANSR == "2" ]]; then - chrootr - elif [[ $ANSR == "3" ]]; then - exit - fi - elif [ -d squashfs-root ]; then - clear - echo "Squashfs-root directory found. Chrooting to directory." - sleep 4 - chrootr - elif [[ "${list}" != "" ]]; then - clear - echo -e "Iso(s) found. Will mount one and copying to proper file structure.\n" \ - "Then will chroot in..." - sleep 4 - mountAndCopy - chrootr - fi -} - -mountAndCopy() { - ## Prep dirs - mkdir iso/ mnt/ - - ## Prep filesystem - isoList=($(find . -maxdepth 1 -name "*.iso" -printf '%P\n')) - count="${#isoList[@]}" - ANSR="" - - while [[ "${ANSR}" > "${count}" || "${ANSR}" < "0" ]]; do - x=0; - clear - for i in "${isoList[@]}"; do - echo "$x - ${i}" - ((x++)) - done - echo "Chose the ISO from above using the number." - read -p "-->: " ANSR - done - - echo "You chose : ${isoList[$ANSR]}" - mount -o loop ./"${isoList[$ANSR]}" mnt/ - cp -r mnt/. iso/ && \ - mv iso/casper/filesystem.squashfs . - - ## Unspuashfs the squashfs - unsquashfs filesystem.squashfs && rm filesystem.squashfs - - ## Cleanup some prep items - umount mnt/ && rmdir mnt/ - ## Copy over build files 'n scripts - cp AUTO_INSTALL.sh squashfs-root/ - cp -r COPY_OVER_TO_CHROOT/ squashfs-root/ -} - -chrootr() { - ## Set Xephyr and set chrooting mounts - Xephyr -resizeable -screen "${RES}" "${ID}" & - cd squashfs-root/ - mount -t proc proc proc/ - mount -t sysfs sys sys/ - mount -o bind /dev dev/ - cp /etc/resolv.conf etc/ - - ## Enter env with chroot - chroot . bash - - ## Unmount binds - umount -lf dev/ - umount -lf proc/ - umount -lf sys/ - cd .. - - setConfigs -} - -setConfigs() { - ## Edit Iso boot info bits - sed -i 3s/Ubuntu/"${NAME}"/g iso/isolinux/txt.cfg - sed -i 7s/Ubuntu/"${NAME}"/g iso/isolinux/txt.cfg - - ## Set Live user and Hostename - sed -i 14s/Ubuntu/"${lvUSER}"/g squashfs-root/etc/casper.conf - sed -i 5,7s/ubuntu/"${lvUSER}"/g squashfs-root/etc/casper.conf - - ## Recreate manifest and clean it Note: MUST be after all setting changes - chroot squashfs-root/ dpkg-query -W --showformat="${Package} ${VERSION}\n" | sudo tee iso/casper/filesystem.manifest - cp -v iso/casper/filesystem.manifest iso/casper/filesystem.manifest-desktop - for i in $REMOVE; do - sed -i "/${i}/d" iso/casper/filesystem.manifest-desktop - done - genSqush -} - -genSqush() { - ## Recreate squashfs - mksquashfs squashfs-root/ iso/casper/filesystem.squashfs -b 1048576 -comp xz -Xdict-size 100% -e squashfs-root/boot - - ## Write the filesystem.size file, which is needed by the installer: - chmod 644 iso/casper/filesystem.size - sudo du -sx --block-size=1 squashfs-root/ | cut -f1 > iso/casper/filesystem.size - chmod 444 iso/casper/filesystem.size - - ## Calculate MD5 - (cd iso && find . -type f -print0 | xargs -0 md5sum | grep -v "\./md5sum.txt" > SHA256SUMS) - genIsoImg -} - -genIsoImg() { - ## Generate Iso - cd iso/ - sudo mkisofs -D -r -cache-inodes -J -l -b isolinux/isolinux.bin -c \ - isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o \ - ../"${NAME}".iso . -} -rootNisoChk diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..996ee86 --- /dev/null +++ b/start.sh @@ -0,0 +1,80 @@ +#!/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() { + sanity_check + if [[ $? -eq 1 ]]; then echo "\nExiting..."; return; fi + + # First setup the debootstrap env... + ./step_1_debootstrap.sh + # Then setup and run chroot + # ./step_2_chroot.sh + +} + + +function sanity_check() { + clear; + SCRIPTPATH="$( cd "$(dirname "")" >/dev/null 2>&1 ; pwd -P )"; + cd "${SCRIPTPATH}"; + 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. + # we could install from current apt buti want the user and myself to be fully aware + # of what they are chosing. IE, they could just run the install command themselves... + 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 + squash=$(which unsquashfs) ## Squashfs-tools + genIso=$(which genisoimage) ## Iso maker + if [[ $xyphr == "" ]] || [[ $sysLnx == "" ]] || \ + [[ $squash == "" ]] || [[ $genIso == "" ]]; then + echo "# ---- Missing Some Packages ---- #\n" \ + "Xephyr :" "${xyphr}\n" \ + "Syslinux :" "${sysLnx}\n" \ + "Squashfs-tools :" "${squash}\n" \ + "Genisoimage :" "${genIso}\n" \ + "Going to run :\n" \ + "\tapt-get install xserver-xephyr syslinux squashfs-tools genisoimage -y" + sleep 2 + apt-get install xserver-xephyr syslinux squashfs-tools genisoimage -y + 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 $@; diff --git a/step_1_debootstrap.sh b/step_1_debootstrap.sh new file mode 100644 index 0000000..ecc4bb4 --- /dev/null +++ b/step_1_debootstrap.sh @@ -0,0 +1,14 @@ +#!/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() { + sudo debootstrap --arch=$ARCH $RELEASE chroot +} +main $@; diff --git a/step_2_chroot.sh b/step_2_chroot.sh new file mode 100644 index 0000000..cfcc0fd --- /dev/null +++ b/step_2_chroot.sh @@ -0,0 +1,42 @@ +#!/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() { + sudo mount --bind /dev "${CHROOT_PTH}"/dev + + sudo cp /etc/hosts "${CHROOT_PTH}"/etc/hosts + sudo cp /etc/resolv.conf "${CHROOT_PTH}"/etc/resolv.conf + sudo sed s/$SYSTEM_RELEASE/$RELEASE/ < /etc/apt/sources.list > "${CHROOT_PTH}"/etc/apt/sources.list + + sudo chroot "${CHROOT_PTH}" + + + # ---- OLD SETUP ---- # + # ## Set Xephyr and set chrooting mounts + # Xephyr -resizeable -screen "${RES}" "${ID}" & + # cd squashfs-root/ + # mount -t proc proc proc/ + # mount -t sysfs sys sys/ + # mount -o bind /dev dev/ + # cp /etc/resolv.conf etc/ + # + # ## Enter env with chroot + # chroot . bash + # + # ## Unmount binds + # umount -lf dev/ + # umount -lf proc/ + # umount -lf sys/ + # cd .. + + + +} +main $@;