From e4d5fb97b2c3076ec2bfb6e5600405c9f61cd5f0 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sun, 3 Oct 2021 21:00:28 -0400 Subject: [PATCH 001/100] improvments for testing --- DEBIAN/control | 2 +- usr/bin/system-installer | 2 +- usr/share/system-installer/UI/success.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/DEBIAN/control b/DEBIAN/control index aeee855c..5167a7d2 100644 --- a/DEBIAN/control +++ b/DEBIAN/control @@ -1,5 +1,5 @@ Package: system-installer -Version: 2.1.0 +Version: 2.1.1 Maintainer: Thomas Castleman Homepage: https://github.com/drauger-os-development/system-installer Section: admin diff --git a/usr/bin/system-installer b/usr/bin/system-installer index d64272a2..43021e6e 100755 --- a/usr/bin/system-installer +++ b/usr/bin/system-installer @@ -28,7 +28,7 @@ import de_control.disable as de_disable import de_control.enable as de_enable from os import path ARGC = len(argv) -VERSION = "2.1.0" +VERSION = "2.1.1" HELP = """ system-installer, Version %s diff --git a/usr/share/system-installer/UI/success.py b/usr/share/system-installer/UI/success.py index 25391409..2ad196d2 100755 --- a/usr/share/system-installer/UI/success.py +++ b/usr/share/system-installer/UI/success.py @@ -476,4 +476,5 @@ def __poweroff__(button): if __name__ == '__main__': - show_success(sys.argv[1]) + settings = json.loads(sys.argv[1]) + show_success(settings) From e7a7aa6d2bc38d118610fbc2f72f92b767437c47 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sun, 3 Oct 2021 21:01:06 -0400 Subject: [PATCH 002/100] make installation report machine-readable Put installation reports in JSON format so it is machine readable for later infastructure developments --- usr/share/system-installer/UI/report.py | 171 +++++++----------------- 1 file changed, 51 insertions(+), 120 deletions(-) diff --git a/usr/share/system-installer/UI/report.py b/usr/share/system-installer/UI/report.py index d9973107..56b80ba9 100755 --- a/usr/share/system-installer/UI/report.py +++ b/usr/share/system-installer/UI/report.py @@ -418,126 +418,57 @@ def preview_message(self, widget): def generate_message(self): """write installation report to disk""" report_code = time.time() + output = {} + self.path = "/var/mail/installation_report-%s.dosir" % (report_code) + output['Installation Report Code'] = report_code + try: + output['system-installer Version'] = check_output(["system-installer", "-v"]).decode() + except (FileNotFoundError, CalledProcessError): + output['system-installer Version'] = "VERSION UNKNOWN. LIKELY TESTING OR MAJOR ERROR." + output['OS'] = get_info(["lsb_release", "-ds"])[0] + if self.cpu.get_active(): + output['CPU INFO'] = cpu_info() + else: + output['CPU INFO'] = 'OPT OUT' + if self.gpu.get_active(): + output['PCIe / GPU INFO'] = get_info(["lspci", "-nnq"]) + else: + output['PCIe / GPU INFO'] = 'OPT OUT' + if self.ram.get_active(): + output['RAM / SWAP INFO'] = ram_info() + else: + output['RAM / SWAP INFO'] = 'OPT OUT' + if self.disk.get_active(): + output['DISK SETUP'] = disk_info() + else: + output['DISK SETUP'] = 'OPT OUT' + if self.log.get_active(): + try: + with open("/tmp/system-installer.log", "r") as log: + output['INSTALLATION LOG'] = log.read() + except FileNotFoundError: + output['INSTALLATION LOG'] = 'Log does not exist.' + else: + output['INSTALLATION LOG'] = 'OPT OUT' + if self.custom.get_active(): + custom = self.text_buffer.get_text(self.text_buffer.get_start_iter(), + self.text_buffer.get_end_iter(), + False) + # Make sure that custom messages are not the default message. + # if they are, just put none so we don't see a bunch of + # trash custom messages + if custom == self.default_message: + output['CUSTOM MESSAGE'] = "NONE" + else: + output['CUSTOM MESSAGE'] = custom + else: + output['CUSTOM MESSAGE'] = "NONE" try: - self.path = "/var/mail/installation_report-%s.dosir" % (report_code) with open(self.path, "w+") as message: - message.write("Installation Report Code: %s\n\n" % (report_code)) - message.write("system-installer Version: ") - try: - message.write(check_output(["system-installer", "-v"]).decode()) - except (FileNotFoundError, CalledProcessError): - message.write("VERSION UNKNOWN. LIKELY TESTING OR MAJOR ERROR.\n") - message.write("\nCPU INFO:\n") - if self.cpu.get_active(): - message.write(cpu_info() + "\n") - else: - message.write("OPT OUT\n") - message.write("\n") - message.write("PCIe / GPU INFO:\n") - if self.gpu.get_active(): - for each in get_info(["lspci", "-nnq"]): - message.write(each + "\n") - else: - message.write("OPT OUT\n") - message.write("\n") - message.write("RAM / SWAP INFO:\n") - if self.ram.get_active(): - message.write(ram_info() + "\n") - else: - message.write("OPT OUT\n") - message.write("\n") - message.write("DISK SETUP:\n") - if self.disk.get_active(): - message.write(json.dumps(disk_info(), indent=1) + "\n") - else: - message.write("OPT OUT\n") - message.write("\n") - message.write("INSTALLATION LOG:\n") - if self.log.get_active(): - try: - with open("/tmp/system-installer.log", "r") as log: - message.write(log.read()) - except FileNotFoundError: - message.write("Log does not exist.") - else: - message.write("OPT OUT\n") - message.write("\n") - message.write("CUSTOM MESSAGE:\n") - if self.custom.get_active(): - custom = self.text_buffer.get_text(self.text_buffer.get_start_iter(), - self.text_buffer.get_end_iter(), - False) - # Make sure that custom messages are not the default message. - # if they are, just put none so we don't see a bunch of - # trash custom messages - if custom == self.default_message: - message.write("NONE\n") - else: - message.write(custom) - else: - message.write("NONE\n") - message.write("\n.") + json.dump(output, message, indent=1) except PermissionError: - home = getenv("HOME") - self.path = home + "/installation_report.txt" - with open(self.path, "w+") as message: - message.write(f"Installation Report Code: { report_code }\n\n") - message.write("system-installer Version: ") - try: - message.write(check_output(["system-installer", - "-v"]).decode()) - except (FileNotFoundError, CalledProcessError): - message.write("VERSION UNKNOWN. LIKELY TESTING OR MAJOR ERROR.\n") - message.write("\nCPU INFO:\n") - if self.cpu.get_active(): - message.write(cpu_info() + "\n") - else: - message.write("OPT OUT\n") - message.write("\n") - message.write("PCIe / GPU INFO:\n") - if self.gpu.get_active(): - for each in get_info(["lspci", "-nnq"]): - message.write(each + "\n") - else: - message.write("OPT OUT\n") - message.write("\n") - message.write("RAM / SWAP INFO:\n") - if self.ram.get_active(): - message.write(ram_info() + "\n") - else: - message.write("OPT OUT\n") - message.write("\n") - message.write("DISK SETUP:\n") - if self.disk.get_active(): - message.write(json.dumps(disk_info(), indent=1) + "\n") - else: - message.write("OPT OUT\n") - message.write("\n") - message.write("INSTALLATION LOG:\n") - if self.log.get_active(): - try: - with open("/tmp/system-installer.log", "r") as log: - message.write(log.read()) - except FileNotFoundError: - message.write("Log does not exist.") - else: - message.write("OPT OUT\n") - message.write("\n") - message.write("CUSTOM MESSAGE:\n") - if self.custom.get_active(): - custom = self.text_buffer.get_text(self.text_buffer.get_start_iter(), - self.text_buffer.get_end_iter(), - False) - # Make sure that custom messages are not the default message. - # if they are, just put none so we don't see a bunch of - # trash custom messages - if custom == self.default_message: - message.write("NONE\n") - else: - message.write(custom) - else: - message.write("NONE\n") - message.write("\n.") + with open(home + "/installation_report.txt", "w+") as message: + json.dump(output, message, indent=1) def message_accept(self, widget): """Accept Message Input in GUI""" @@ -744,9 +675,9 @@ def cpu_info(): def ram_info(): """Get RAM info""" - ram_capacity = check_output(["lsmem", "--summary=only"]).decode() - swap_capacity = check_output(["swapon", "--show"]).decode() - return ram_capacity + "\n" + swap_capacity + ram_capacity = check_output(["lsmem", "--summary=only"]).decode().split("\n") + swap_capacity = check_output(["swapon", "--show"]).decode().split("\n") + return {"RAM": ram_capacity, "SWAP": swap_capacity} def disk_info(): From 63f0091a9cfdaf6c2222555d4caf1f3f0330d259 Mon Sep 17 00:00:00 2001 From: Steve Gotthardt Date: Mon, 4 Oct 2021 16:53:36 -0700 Subject: [PATCH 003/100] add console-mode to see full screen on 4K monitors --- usr/share/system-installer/modules/master.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/share/system-installer/modules/master.py b/usr/share/system-installer/modules/master.py index c10166d8..9f8f8e31 100755 --- a/usr/share/system-installer/modules/master.py +++ b/usr/share/system-installer/modules/master.py @@ -318,7 +318,7 @@ def _install_systemd_boot(release, root): except FileExistsError: pass with open("/boot/efi/loader/loader.conf", "w+") as loader_conf: - loader_conf.write("default Drauger_OS\ntimeout 5\neditor 1") + loader_conf.write("default Drauger_OS\ntimeout 5\nconsole-mode 1\neditor 1") try: subprocess.check_call(["chattr", "-i", "/boot/efi/loader/loader.conf"], stdout=stderr.buffer) From 96f84b16e30c76b7945685fb0d3caa3fe69ce545 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Mon, 4 Oct 2021 23:59:33 -0400 Subject: [PATCH 004/100] enable usage of pool folder instead of kernel archive --- etc/system-installer/settings.json | 1 + usr/share/system-installer/chroot.py | 2 +- usr/share/system-installer/installer.py | 26 +++--------- usr/share/system-installer/modules/master.py | 42 +++++++++++++------- 4 files changed, 34 insertions(+), 37 deletions(-) diff --git a/etc/system-installer/settings.json b/etc/system-installer/settings.json index 0ddbe571..d36df440 100644 --- a/etc/system-installer/settings.json +++ b/etc/system-installer/settings.json @@ -1,5 +1,6 @@ { "squashfs_Location": "/run/live/medium/live/filesystem.squashfs", + "local_repo": "/run/live/medium/repo", "distro": "Drauger OS", "report": { "recv_keys": "https://download.draugeros.org/keys/public_keys.asc", diff --git a/usr/share/system-installer/chroot.py b/usr/share/system-installer/chroot.py index b5ae87fb..f006d81c 100755 --- a/usr/share/system-installer/chroot.py +++ b/usr/share/system-installer/chroot.py @@ -3,7 +3,7 @@ # # chroot.py # -# Copyright 2020 Thomas Castleman +# Copyright 2021 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/installer.py b/usr/share/system-installer/installer.py index e2717467..db197394 100755 --- a/usr/share/system-installer/installer.py +++ b/usr/share/system-installer/installer.py @@ -129,9 +129,9 @@ def install(settings): __update__(14) # STEP 3: Unsquash the sqaushfs and get the files where they need to go squashfs = "" - with open("/etc/system-installer/settings.json", "r") as config: - squashfs = json.loads(config.read())["squashfs_Location"] - if not path.exists(squashfs): + with open("/etc/system-installer/settings.json", "r") as file: + config = json.loads(file.read()) + if not path.exists(config["squashfs_Location"]): common.eprint("\n SQUASHFS FILE DOES NOT EXIST \n") UI.error.show_error("\n\tSQUASHFS FILE DOES NOT EXIST\t\n") __update__(17) @@ -158,7 +158,7 @@ def install(settings): except FileNotFoundError: pass common.eprint(" ### EXTRACTING SQUASHFS ### ") - check_call(["unsquashfs", squashfs]) + check_call(["unsquashfs", config["squashfs_Location"]]) common.eprint(" ### EXTRACTION COMPLETE ### ") file_list = listdir("/mnt/squashfs-root") for each in file_list: @@ -260,7 +260,7 @@ def install(settings): shutil.copytree(work_dir + "/assets/" + each, "/mnt/user-data/" + each) real_root = chroot.arch_chroot("/mnt") - modules.master.install(settings) + modules.master.install(settings, config["local_repo"]) chroot.de_chroot(real_root, "/mnt") common.eprint("Removing installation scripts and resetting resolv.conf") for each in file_list: @@ -275,22 +275,6 @@ def install(settings): remove("/mnt/etc/resolv.conf") shutil.move("/mnt/etc/resolv.conf.save", "/mnt/etc/resolv.conf") __update__(96) - file_list = listdir("/mnt/boot") - for each in range(len(file_list) - 1, -1, -1): - if "vmlinuz" not in file_list[each]: - del file_list[each] - if len(file_list) == 0: - common.eprint(" ### KERNEL NOT INSTALLED. CORRECTING . . . ### ") - shutil.copyfile("/usr/share/system-installer/modules/kernel.tar.xz", - "/mnt/kernel.tar.xz") - root_dir = chroot.arch_chroot("/mnt") - tar_file = tar.open("kernel.tar.xz") - tar_file.extractall() - tar_file.close() - check_call(["dpkg", "-R", "--install", "/kernel"]) - chroot.de_chroot(root_dir, "/mnt") - shutil.rmtree("/mnt/kernel") - remove("/mnt/kernel.tar.xz") try: file_list = listdir("/mnt/boot/efi/loader/entries") except FileNotFoundError: diff --git a/usr/share/system-installer/modules/master.py b/usr/share/system-installer/modules/master.py index 9f8f8e31..fa09d64b 100755 --- a/usr/share/system-installer/modules/master.py +++ b/usr/share/system-installer/modules/master.py @@ -225,22 +225,30 @@ def set_plymouth_theme(): stderr=subprocess.PIPE) process.communicate(input=bytes("2\n", "utf-8")) -def install_kernel(release): + +def install_kernel(release, local_repo): """Install kernel from kernel.tar.xz""" # we are going to do offline kernel installation from now on. # it's just easier and more reliable - eprint("EXTRACTING KERNEL.TAR.XZ") - tar_file = tar.open("kernel.tar.xz") - tar_file.extractall() - tar_file.close() - eprint("EXTRACTION COMPLETE") - subprocess.check_call(["apt", "purge", "-y", "linux-headers-" + release, - "linux-image-" + release], stdout=stderr.buffer) - subprocess.check_call(["apt", "autoremove", "-y", "--purge"], + packages = ["linux-headers-" + release, "linux-image-" + release] + install_command = ["dpkg", "-R", "--install"] + subprocess.check_call(["apt-get", "purge", "-y"] + packages, stdout=stderr.buffer) + subprocess.check_call(["apt-get", "autoremove", "-y", "--purge"], stdout=stderr.buffer) - subprocess.check_call(["dpkg", "-R", "--install", "kernel/"], + if not os.path.exists(local_repo): + eprint("EXTRACTING KERNEL.TAR.XZ") + tar_file = tar.open("kernel.tar.xz") + tar_file.extractall() + tar_file.close() + eprint("EXTRACTION COMPLETE") + subprocess.check_call(install_command + ["kernel/"], + stdout=stderr.buffer) + rmtree("/kernel") + return + # Local repo exists. Use it + packages = [each for each in os.listdir(local_repo) if "linux-" in each] + subprocess.check_call(install_command + packages, stdout=stderr.buffer) - rmtree("/kernel") def install_bootloader(efi, root, release): @@ -252,6 +260,7 @@ def install_bootloader(efi, root, release): else: _install_grub(root) + def _install_grub(root): """set up and install GRUB. This function is only retained for BIOS systems.""" @@ -331,10 +340,10 @@ def _install_systemd_boot(release, root): check_systemd_boot(release, root) -def setup_lowlevel(efi, root): +def setup_lowlevel(efi, root, local_repo): """Set up kernel and bootloader""" release = subprocess.check_output(["uname", "--release"]).decode()[0:-1] - install_kernel(release) + install_kernel(release, local_repo) set_plymouth_theme() __update__(91) eprint("\n ### MAKING INITRAMFS ### ") @@ -345,6 +354,7 @@ def setup_lowlevel(efi, root): os.symlink("/boot/initrd.img-" + release, "/boot/initrd.img") os.symlink("/boot/vmlinuz-" + release, "/boot/vmlinuz") + def check_systemd_boot(release, root): """Ensure systemd-boot was configured correctly""" # Initialize variables @@ -439,6 +449,7 @@ def check_systemd_boot(release, root): else: eprint("System.map checks out") + def _check_for_laptop(): """Check if the device we are installing is a laptop. Returns True if it is a laptop, returns False otherwise. @@ -458,7 +469,7 @@ def handle_laptops(username): de_modify.for_laptop() -def install(settings): +def install(settings, local_repo): """Entry point for installation procedure""" processes_to_do = dir(MainInstallation) for each in range(len(processes_to_do) - 1, -1, -1): @@ -466,7 +477,7 @@ def install(settings): del processes_to_do[each] MainInstallation(processes_to_do, settings) handle_laptops(settings["USERNAME"]) - setup_lowlevel(settings["EFI"], settings["ROOT"]) + setup_lowlevel(settings["EFI"], settings["ROOT"], local_repo) verify(settings["USERNAME"]) if "PURGE" in settings: purge_package(settings["PURGE"]) @@ -475,6 +486,7 @@ def install(settings): with open("/etc/system-installer/oem-post-install.flag", "w") as file: file.write("") + if __name__ == "__main__": # get length of argv ARGC = len(argv) From ffa068824deb94dcb96a3c0047658563224e5792 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Tue, 5 Oct 2021 00:00:19 -0400 Subject: [PATCH 005/100] systemd-boot managment script supersceded --- usr/share/system-installer/installer.py | 8 +- .../system-installer/modules/__init__.py | 1 - usr/share/system-installer/modules/master.py | 17 +- .../modules/systemd_boot_config.py | 165 ------------------ 4 files changed, 11 insertions(+), 180 deletions(-) delete mode 100755 usr/share/system-installer/modules/systemd_boot_config.py diff --git a/usr/share/system-installer/installer.py b/usr/share/system-installer/installer.py index db197394..e54436ba 100755 --- a/usr/share/system-installer/installer.py +++ b/usr/share/system-installer/installer.py @@ -281,13 +281,7 @@ def install(settings): file_list = [] if ((len(file_list) == 0) and (settings["EFI"] not in (None, "", "NULL", False))): common.eprint(" ### SYSTEMD-BOOT NOT CONFIGURED. CORRECTING . . . ### ") - shutil.copyfile("/usr/share/system-installer/modules/systemd_boot_config.py", - "/mnt/systemd_boot_config.py") - check_call(["arch-chroot", "/mnt", "python3", - "/systemd_boot_config.py", settings["ROOT"]]) - check_call(["arch-chroot", "/mnt", - "/etc/kernel/postinst.d/zz-update-systemd-boot"]) - remove("/mnt/systemd_boot_config.py") + check_call(["arch-chroot", "/mnt", "systemd-boot-manager", "-r"]) try: shutil.rmtree("/mnt/home/" + settings["USERNAME"] + "/.config/xfce4/panel/launcher-3") diff --git a/usr/share/system-installer/modules/__init__.py b/usr/share/system-installer/modules/__init__.py index f5fed9b6..b5e75612 100755 --- a/usr/share/system-installer/modules/__init__.py +++ b/usr/share/system-installer/modules/__init__.py @@ -27,7 +27,6 @@ import modules.auto_login_set as auto_login_set import modules.set_locale as set_locale import modules.set_time as set_time -import modules.systemd_boot_config as systemd_boot_config import modules.install_updates as install_updates import modules.set_wallpaper as set_wallpaper import modules.make_user as make_user diff --git a/usr/share/system-installer/modules/master.py b/usr/share/system-installer/modules/master.py index fa09d64b..3fac8267 100755 --- a/usr/share/system-installer/modules/master.py +++ b/usr/share/system-installer/modules/master.py @@ -43,7 +43,6 @@ import modules.auto_login_set as auto_login_set import modules.make_swap as make_swap import modules.set_time as set_time -import modules.systemd_boot_config as systemd_boot_config import modules.set_locale as set_locale import modules.install_updates as install_updates import modules.make_user as mkuser @@ -251,12 +250,12 @@ def install_kernel(release, local_repo): stdout=stderr.buffer) -def install_bootloader(efi, root, release): +def install_bootloader(efi, root, release, local_repo): """Determine whether bootloader needs to be systemd-boot (for UEFI) or GRUB (for BIOS) and install the correct one.""" if efi not in ("NULL", None, "", False): - _install_systemd_boot(release, root) + _install_systemd_boot(release, root, local_repo) else: _install_grub(root) @@ -281,7 +280,8 @@ def _install_grub(root): subprocess.check_call(["grub-mkconfig", "-o", "/boot/grub/grub.cfg"], stdout=stderr.buffer) -def _install_systemd_boot(release, root): + +def _install_systemd_boot(release, root, local_repo): """set up and install systemd-boot""" try: os.mkdir("/boot/efi") @@ -334,8 +334,11 @@ def _install_systemd_boot(release, root): except subprocess.CalledProcessError: eprint("CHATTR FAILED ON loader.conf, setting octal permissions to 444") os.chmod("/boot/efi/loader/loader.conf", 0o444) - systemd_boot_config.systemd_boot_config(root) - subprocess.check_call("/etc/kernel/postinst.d/zz-update-systemd-boot", + install_command = ["dpkg", "-R", "--install"] + package = [each for each in os.listdir(local_repo) if "systemd-boot-manager" in each] + subprocess.check_call(install_command + package, + stdout=stderr.buffer) + subprocess.check_call(["systemd-boot-manager", "-r"], stdout=stderr.buffer) check_systemd_boot(release, root) @@ -349,7 +352,7 @@ def setup_lowlevel(efi, root, local_repo): eprint("\n ### MAKING INITRAMFS ### ") subprocess.check_call(["mkinitramfs", "-o", "/boot/initrd.img-" + release], stdout=stderr.buffer) - install_bootloader(efi, root, release) + install_bootloader(efi, root, release, local_repo) sleep(0.5) os.symlink("/boot/initrd.img-" + release, "/boot/initrd.img") os.symlink("/boot/vmlinuz-" + release, "/boot/vmlinuz") diff --git a/usr/share/system-installer/modules/systemd_boot_config.py b/usr/share/system-installer/modules/systemd_boot_config.py deleted file mode 100755 index e8374dad..00000000 --- a/usr/share/system-installer/modules/systemd_boot_config.py +++ /dev/null @@ -1,165 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# systemd_boot_config.py -# -# Copyright 2020 Thomas Castleman -# -# 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. -# -# -"""Configure Systemd-Boot""" -from os import mkdir, chown, chmod -from sys import stderr, argv -from subprocess import check_output - - -def eprint(*args, **kwargs): - """Make it easier for us to print to stderr""" - print(*args, file=stderr, **kwargs) - - -def systemd_boot_config(root): - """Configure Systemd-Boot""" - eprint(" ### systemd-boot-config.py STARTED ### ") - file_list = ["/etc/kernel/postinst.d/zz-update-systemd-boot", - "/etc/kernel/postrm.d/zz-update-systemd-boot", - "/etc/initramfs/post-update.d/zz-update-systemd-boot"] - try: - mkdir("/etc/kernel/postinst.d") - except FileExistsError: - eprint("postinst.d already exists") - try: - mkdir("/etc/kernel/postrm.d") - except FileExistsError: - eprint("postrm.d already exists") - try: - mkdir("/etc/initramfs") - except FileExistsError: - eprint("/etc/initramfs already exists") - try: - mkdir("/etc/initramfs/post-update.d") - except FileExistsError: - eprint("/etc/initramfs/post-update.d already exists") - uuid = check_output(["blkid", "-s", "PARTUUID", "-o", "value", root]).decode()[:-1] - # Parse out all the stuff we don't need - contents = r"""#!/bin/bash -# -# This is a simple kernel hook to populate the systemd-boot entries -# whenever kernels are added or removed. -# - - - -# The UUID of your disk. -UUID=$( /boot/efi/loader/entries/Drauger_OS.conf -title Drauger OS -linux /Drauger_OS/vmlinuz -initrd /Drauger_OS/initrd.img -options root=PARTUUID=$UUID ${ROOTFLAGS} -EOF - cat << EOF > /boot/efi/loader/entries/Drauger_OS_Recovery.conf -title Drauger OS Recovery -linux /Drauger_OS/vmlinuz -initrd /Drauger_OS/initrd.img -options root=PARTUUID=$UUID ${RECOVERY_FLAGS} -EOF -done - - - -# Copy any legacy kernels over too, but maintain their version-based -# names to avoid collisions. -if [ ${#KERNELS[@]} -gt 1 ]; then - LEGACY="$(echo $KERNELS | sed 's/\/boot\/vmlinuz//g' | sed 's/ /\n/g' | sed 's/.old//g' | sed '/^[[:space:]]*$/d' | sed 's/-//' | sort -Vr | sed s/$LATEST//g)" - for VERSION in ${LEGACY[@]}; do - echo -e "\e[2msystemd-boot\e[0m \e[1;32m${VERSION}\e[0m" - for FILE in config initrd.img System.map vmlinuz; do - cp "/boot/${FILE}-${VERSION}" "/boot/efi/Drauger_OS/${FILE}${VERSION}" - cat << EOF > /boot/efi/loader/entries/Drauger_OS-${VERSION}.conf -title Drauger OS ${VERSION} -linux /Drauger_OS/vmlinuz-${VERSION} -initrd /Drauger_OS/initrd.img-${VERSION} -options root=PARTUUID=$UUID ${ROOTFLAGS} -EOF - cat << EOF > /boot/efi/loader/entries/Drauger_OS_Recovery.conf -title Drauger OS ${VERSION} Recovery -linux /Drauger_OS/vmlinuz-${VERSION} -initrd /Drauger_OS/initrd.img-${VERSION} -options root=PARTUUID=$UUID ${RECOVERY_FLAGS} -EOF - done - done -fi - - - -# Success!""" - for each in file_list: - with open(each, "w+") as file: - file.write(contents) - chown(each, 0, 0) - chmod(each, 0o755) - mkdir("/etc/systemd-boot") - with open("/etc/systemd-boot/uuid.conf", "w+") as conf: - conf.write(uuid) - eprint(" ### systemd-boot-config.py CLOSED ### ") - return 0 - - -if __name__ == '__main__': - systemd_boot_config(argv[1]) From b17e6971ae386eccfe8d1f794ef1b33b190b438d Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Tue, 5 Oct 2021 00:18:58 -0400 Subject: [PATCH 006/100] add ability to build without kernel archive --- build.sh | 74 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 34 deletions(-) diff --git a/build.sh b/build.sh index e49c318d..5e20ba54 100755 --- a/build.sh +++ b/build.sh @@ -4,6 +4,7 @@ PAK=$(cat DEBIAN/control | grep 'Package: ' | sed 's/Package: //g') ARCH=$(cat DEBIAN/control | grep 'Architecture: '| sed 's/Architecture: //g') FOLDER="$PAK\_$VERSION\_$ARCH" FOLDER=$(echo "$FOLDER" | sed 's/\\//g') +OPTIONS="$1" mkdir ../"$FOLDER" ############################################################## # # @@ -14,40 +15,43 @@ mkdir ../"$FOLDER" ############################################################## # Instead of compiling, we are building a tar.xz archive of the latest kernel package -cd usr/share/system-installer/modules -echo -e "\t###\tDOWNLOADING\t###\t" -rsync -vr rsync://apt.draugeros.org/aptsync/pool/main/l/linux-upstream kernel -rsync -vr rsync://apt.draugeros.org/aptsync/pool/main/l/linux-meta kernel -echo -e "\t###\tDELETING CRUFT\t###\t" -list=$(ls kernel) -for each in $list; do - remove=$(ls kernel/$each | grep -v 'amd64.deb$') - for each2 in $remove; do - rm -rfv kernel/$each/$each2 +# Don't make the archive if --pool passed +if [ "$OPTIONS" != "--pool" ]; then + cd usr/share/system-installer/modules + echo -e "\t###\tDOWNLOADING\t###\t" + rsync -vr rsync://apt.draugeros.org/aptsync/pool/main/l/linux-upstream kernel + rsync -vr rsync://apt.draugeros.org/aptsync/pool/main/l/linux-meta kernel + echo -e "\t###\tDELETING CRUFT\t###\t" + list=$(ls kernel) + for each in $list; do + remove=$(ls kernel/$each | grep -v 'amd64.deb$') + for each2 in $remove; do + rm -rfv kernel/$each/$each2 + done done -done -meta=$(echo kernel/linux-meta/$(ls kernel/linux-meta | sort -Vr | head -1)) -dep=$(dpkg-deb --field $meta Depends | sed 's/, /\\|/g') -cd kernel/linux-upstream -rm -rfv $(ls | sed "/\($dep\)/d") -dep=$(echo "$dep" | sed 's/\\|/ /g' | awk '{print $1}' | sed 's/\(image-\|headers-\)/xanmod_/g') -rm -rfv $(ls | grep "edge") -rm -rfv $(ls | grep "cacule") -cd ../linux-meta -rm -rfv $(ls | grep -v "$dep") -rm -rfv $(ls | grep "edge") -rm -rfv $(ls | grep "cacule") -cd .. -dep=$(echo "$dep" | sed 's/xanmod_//g') -mv linux-upstream "$dep" -cd .. -# delete empty folders -find . -type d -empty -print -delete -echo -e "\t###\tCOMPRESSING\t###\t" -tar --verbose --create --xz -f kernel.tar.xz kernel -echo -e "\t###\tCLEANING\t###\t" -rm -rfv kernel -cd ../../../.. + meta=$(echo kernel/linux-meta/$(ls kernel/linux-meta | sort -Vr | head -1)) + dep=$(dpkg-deb --field $meta Depends | sed 's/, /\\|/g') + cd kernel/linux-upstream + rm -rfv $(ls | sed "/\($dep\)/d") + dep=$(echo "$dep" | sed 's/\\|/ /g' | awk '{print $1}' | sed 's/\(image-\|headers-\)/xanmod_/g') + rm -rfv $(ls | grep "edge") + rm -rfv $(ls | grep "cacule") + cd ../linux-meta + rm -rfv $(ls | grep -v "$dep") + rm -rfv $(ls | grep "edge") + rm -rfv $(ls | grep "cacule") + cd .. + dep=$(echo "$dep" | sed 's/xanmod_//g') + mv linux-upstream "$dep" + cd .. + # delete empty folders + find . -type d -empty -print -delete + echo -e "\t###\tCOMPRESSING\t###\t" + tar --verbose --create --xz -f kernel.tar.xz kernel + echo -e "\t###\tCLEANING\t###\t" + rm -rfv kernel + cd ../../../.. +fi ############################################################## # # # # @@ -92,7 +96,9 @@ fi cp -R DEBIAN ../"$FOLDER"/DEBIAN cd .. #DELETE STUFF HERE -rm system-installer/usr/share/system-installer/modules/kernel.tar.xz +if [ "$OPTIONS" != "--pool" ]; then + rm system-installer/usr/share/system-installer/modules/kernel.tar.xz +fi #build the shit dpkg-deb --build "$FOLDER" rm -rf "$FOLDER" From ef9aba29b51eb85b0cadbce40283f679bb1c3f4b Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Tue, 5 Oct 2021 00:35:53 -0400 Subject: [PATCH 007/100] adapt kernel version checks for pool folder --- .../system-installer/check_kernel_versions.py | 27 ++++++++++++------- usr/share/system-installer/engine.py | 2 +- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/usr/share/system-installer/check_kernel_versions.py b/usr/share/system-installer/check_kernel_versions.py index 4ee0abce..a032335a 100755 --- a/usr/share/system-installer/check_kernel_versions.py +++ b/usr/share/system-installer/check_kernel_versions.py @@ -27,17 +27,21 @@ """ import tarfile as tar import subprocess +import os import common -def __get_file_version__(): +def __get_file_version__(local_repo): """Get kernel version in included kernel archive""" - try: - tar_file = tar.open("/usr/share/system-installer/modules/kernel.tar.xz") - except FileNotFoundError: - tar_file = tar.open("/usr/share/system-installer/modules/kernel.tar.7z") - files = tar_file.getnames() - tar_file.close() + if not os.path.exists(local_repo): + try: + tar_file = tar.open("/usr/share/system-installer/modules/kernel.tar.xz") + except FileNotFoundError: + tar_file = tar.open("/usr/share/system-installer/modules/kernel.tar.7z") + files = tar_file.getnames() + tar_file.close() + else: + files = os.listdir(local_repo) for each in range(len(files) - 1, -1, -1): if files[each] in ("kernel", "kernel/linux-meta"): del files[each] @@ -50,11 +54,16 @@ def __get_file_version__(): if files[each][-1] == "amd64.deb": del files[each][-1] files[each] = files[each][0] + files = [each for each in files if "linux" in each] version = common.unique(files)[0] if version[:6] == "linux-": version = version[6:] if version[-2:] == "-0": version = version[:-2] + if version[:8] == "headers-": + version = version[8:] + if version[:6] == "image-": + version = version[6:] return version @@ -63,10 +72,10 @@ def __get_installed_version__(): return subprocess.check_output(["uname", "--release"]).decode("utf-8")[:-1] -def check_kernel_versions(): +def check_kernel_versions(local_repo): """Compare kernel versions""" common.eprint("CHECKING KERNEL VERSIONS") - file_version = __get_file_version__() + file_version = __get_file_version__(local_repo) installed_version = __get_installed_version__() if file_version == installed_version: common.eprint("KERNEL VERSIONS MATCH: SUCCESS") diff --git a/usr/share/system-installer/engine.py b/usr/share/system-installer/engine.py index fa373111..3779712b 100755 --- a/usr/share/system-installer/engine.py +++ b/usr/share/system-installer/engine.py @@ -74,7 +74,7 @@ if len(DISK) < 1: UI.error.show_error("\n\tNo 32 GB or Larger Drives detected\t\n") sys.exit(2) -if not check_kernel_versions.check_kernel_versions(): +if not check_kernel_versions.check_kernel_versions(CONFIG["local_repo"]): UI.error.show_error(""" \tKernel Version Mismatch.\t \tPlease reboot and retry installation.\t From 401338d255de96280da62329cabbc544d2b73b43 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Wed, 20 Oct 2021 23:39:10 -0400 Subject: [PATCH 008/100] stop copying scripts into chroot --- usr/share/system-installer/engine.py | 8 +------- usr/share/system-installer/installer.py | 23 +---------------------- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/usr/share/system-installer/engine.py b/usr/share/system-installer/engine.py index 3779712b..e0aab3fd 100755 --- a/usr/share/system-installer/engine.py +++ b/usr/share/system-installer/engine.py @@ -135,13 +135,7 @@ pid = process.pid SETTINGS["INTERNET"] = check_internet.has_internet() installer.install(SETTINGS) - file_list = listdir("/mnt") - for each in file_list: - if each[-3:] in (".sh", ".py", ".xz"): - try: - remove("/mnt/" + each) - except FileNotFoundError: - pass + os.remove("/mnt/repo") common.eprint(" ### %s CLOSED ### " % (sys.argv[0])) try: copyfile("/tmp/system-installer.log", diff --git a/usr/share/system-installer/installer.py b/usr/share/system-installer/installer.py index e54436ba..a596a499 100755 --- a/usr/share/system-installer/installer.py +++ b/usr/share/system-installer/installer.py @@ -185,18 +185,6 @@ def install(settings): with open("/mnt/etc/fstab", "w+") as fstab: fstab.write(fstab_contents + "\n") __update__(34) - # STEP 5: copy scripts into chroot - file_list = listdir("/usr/share/system-installer/modules") - for each in range(len(file_list) - 1, -1, -1): - if "partitioner" in file_list[each]: - del file_list[each] - for each in file_list: - if each == "__pycache__": - continue - common.eprint("/usr/share/system-installer/modules/%s --> /mnt/%s" % - (each, each)) - shutil.copyfile("/usr/share/system-installer/modules/" + each, - "/mnt/" + each) __update__(35) # STEP 6: Run Master script inside chroot # don't run it as a background process so we know when it gets done @@ -262,16 +250,7 @@ def install(settings): real_root = chroot.arch_chroot("/mnt") modules.master.install(settings, config["local_repo"]) chroot.de_chroot(real_root, "/mnt") - common.eprint("Removing installation scripts and resetting resolv.conf") - for each in file_list: - common.eprint("Removing /mnt/" + each) - try: - remove("/mnt/" + each) - except FileNotFoundError: - pass - except IsADirectoryError: - shutil.rmtree("/mnt/" + each) - __update__(92) + common.eprint("Resetting resolv.conf") remove("/mnt/etc/resolv.conf") shutil.move("/mnt/etc/resolv.conf.save", "/mnt/etc/resolv.conf") __update__(96) From ecc9da6becc5f0f720a49f24a70e785ff78a145a Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Wed, 20 Oct 2021 23:41:32 -0400 Subject: [PATCH 009/100] Extract kernel archive earlier Extract earlier so that code later on doesn't have to handle both situations --- usr/share/system-installer/installer.py | 22 ++++++++++- usr/share/system-installer/modules/master.py | 39 +++++++------------- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/usr/share/system-installer/installer.py b/usr/share/system-installer/installer.py index a596a499..d52e9aba 100755 --- a/usr/share/system-installer/installer.py +++ b/usr/share/system-installer/installer.py @@ -185,6 +185,26 @@ def install(settings): with open("/mnt/etc/fstab", "w+") as fstab: fstab.write(fstab_contents + "\n") __update__(34) + # STEP 5: Extract Tar ball if needed, copy files to installation drive + if not os.path.exists(local_repo): + eprint("EXTRACTING KERNEL.TAR.XZ") + tar_file = tar.open("/usr/share/system-installer/kernel.tar.xz") + tar_file.extractall(path="/") + tar_file.close() + eprint("EXTRACTION COMPLETE") + path = local_repo.split("/") + for each in enumerate(path): + os.mkdir("/".join(path[:each[0] + 1])) + os.mkdir(local_repo) + # Copy everything into local_repo at top level + # We COULD go ahead and copy everything where it needs to be, but that would + # make for more code and an extra check I don't wanna bother with right now + branches = os.listdir("/kernel") + for each in branches: + lv2 = os.listdir("/kernel/" + each) + for each1 in lv2: + shutil.move(f"/kernel/{each}/{each1}", f"{local_repo}/{each1}") + shutil.copytree(local_repo, "/mnt/repo") __update__(35) # STEP 6: Run Master script inside chroot # don't run it as a background process so we know when it gets done @@ -248,7 +268,7 @@ def install(settings): shutil.copytree(work_dir + "/assets/" + each, "/mnt/user-data/" + each) real_root = chroot.arch_chroot("/mnt") - modules.master.install(settings, config["local_repo"]) + modules.master.install(settings) chroot.de_chroot(real_root, "/mnt") common.eprint("Resetting resolv.conf") remove("/mnt/etc/resolv.conf") diff --git a/usr/share/system-installer/modules/master.py b/usr/share/system-installer/modules/master.py index 3fac8267..31806125 100755 --- a/usr/share/system-installer/modules/master.py +++ b/usr/share/system-installer/modules/master.py @@ -225,37 +225,26 @@ def set_plymouth_theme(): process.communicate(input=bytes("2\n", "utf-8")) -def install_kernel(release, local_repo): +def install_kernel(release): """Install kernel from kernel.tar.xz""" # we are going to do offline kernel installation from now on. # it's just easier and more reliable packages = ["linux-headers-" + release, "linux-image-" + release] install_command = ["dpkg", "-R", "--install"] - subprocess.check_call(["apt-get", "purge", "-y"] + packages, stdout=stderr.buffer) - subprocess.check_call(["apt-get", "autoremove", "-y", "--purge"], + subprocess.check_call(["apt-get", "purge", "-y"] + packages, stdout=stderr.buffer) - if not os.path.exists(local_repo): - eprint("EXTRACTING KERNEL.TAR.XZ") - tar_file = tar.open("kernel.tar.xz") - tar_file.extractall() - tar_file.close() - eprint("EXTRACTION COMPLETE") - subprocess.check_call(install_command + ["kernel/"], - stdout=stderr.buffer) - rmtree("/kernel") - return - # Local repo exists. Use it - packages = [each for each in os.listdir(local_repo) if "linux-" in each] - subprocess.check_call(install_command + packages, + subprocess.check_call(["apt-get", "autoremove", "-y", "--purge"], stdout=stderr.buffer) + packages = [each for each in os.listdir("/repo") if "linux-" in each] + subprocess.check_call(install_command + packages, stdout=stderr.buffer) -def install_bootloader(efi, root, release, local_repo): +def install_bootloader(efi, root, release): """Determine whether bootloader needs to be systemd-boot (for UEFI) or GRUB (for BIOS) and install the correct one.""" if efi not in ("NULL", None, "", False): - _install_systemd_boot(release, root, local_repo) + _install_systemd_boot(release, root) else: _install_grub(root) @@ -281,7 +270,7 @@ def _install_grub(root): stdout=stderr.buffer) -def _install_systemd_boot(release, root, local_repo): +def _install_systemd_boot(release, root): """set up and install systemd-boot""" try: os.mkdir("/boot/efi") @@ -335,7 +324,7 @@ def _install_systemd_boot(release, root, local_repo): eprint("CHATTR FAILED ON loader.conf, setting octal permissions to 444") os.chmod("/boot/efi/loader/loader.conf", 0o444) install_command = ["dpkg", "-R", "--install"] - package = [each for each in os.listdir(local_repo) if "systemd-boot-manager" in each] + package = [each for each in os.listdir("/repo") if "systemd-boot-manager" in each] subprocess.check_call(install_command + package, stdout=stderr.buffer) subprocess.check_call(["systemd-boot-manager", "-r"], @@ -343,16 +332,16 @@ def _install_systemd_boot(release, root, local_repo): check_systemd_boot(release, root) -def setup_lowlevel(efi, root, local_repo): +def setup_lowlevel(efi, root): """Set up kernel and bootloader""" release = subprocess.check_output(["uname", "--release"]).decode()[0:-1] - install_kernel(release, local_repo) + install_kernel(release) set_plymouth_theme() __update__(91) eprint("\n ### MAKING INITRAMFS ### ") subprocess.check_call(["mkinitramfs", "-o", "/boot/initrd.img-" + release], stdout=stderr.buffer) - install_bootloader(efi, root, release, local_repo) + install_bootloader(efi, root, release) sleep(0.5) os.symlink("/boot/initrd.img-" + release, "/boot/initrd.img") os.symlink("/boot/vmlinuz-" + release, "/boot/vmlinuz") @@ -472,7 +461,7 @@ def handle_laptops(username): de_modify.for_laptop() -def install(settings, local_repo): +def install(settings): """Entry point for installation procedure""" processes_to_do = dir(MainInstallation) for each in range(len(processes_to_do) - 1, -1, -1): @@ -480,7 +469,7 @@ def install(settings, local_repo): del processes_to_do[each] MainInstallation(processes_to_do, settings) handle_laptops(settings["USERNAME"]) - setup_lowlevel(settings["EFI"], settings["ROOT"], local_repo) + setup_lowlevel(settings["EFI"], settings["ROOT"]) verify(settings["USERNAME"]) if "PURGE" in settings: purge_package(settings["PURGE"]) From 36a54362c1b8273803488996daa625e699ecc81e Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Wed, 20 Oct 2021 23:41:57 -0400 Subject: [PATCH 010/100] move kernel archive to more appropriate location --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 5e20ba54..f8ac5331 100755 --- a/build.sh +++ b/build.sh @@ -17,7 +17,7 @@ mkdir ../"$FOLDER" # Instead of compiling, we are building a tar.xz archive of the latest kernel package # Don't make the archive if --pool passed if [ "$OPTIONS" != "--pool" ]; then - cd usr/share/system-installer/modules + cd usr/share/system-installer echo -e "\t###\tDOWNLOADING\t###\t" rsync -vr rsync://apt.draugeros.org/aptsync/pool/main/l/linux-upstream kernel rsync -vr rsync://apt.draugeros.org/aptsync/pool/main/l/linux-meta kernel From bd5598aa9aa5c8d7cff3af77890e65e8a1cb1efe Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Wed, 20 Oct 2021 23:42:06 -0400 Subject: [PATCH 011/100] remove old comment --- usr/share/system-installer/installer.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/usr/share/system-installer/installer.py b/usr/share/system-installer/installer.py index d52e9aba..11769c2e 100755 --- a/usr/share/system-installer/installer.py +++ b/usr/share/system-installer/installer.py @@ -246,10 +246,6 @@ def install(settings): if settings["UPDATES"] == "": common.eprint("$UPDATES is not set. Defaulting to false.") settings["UPDATES"] = False - # ues check_call(["arch-chroot", "python3", "/master.py", ...]) because it - # jumps through a lot of hoops for us. - # check_call(["arch-chroot", "python3", "/master.py", settings], - # stdout=stderr.buffer) # Copy live system networking settings into installed system shutil.rmtree("/mnt/etc/NetworkManager/system-connections") shutil.copytree("/etc/NetworkManager/system-connections", From 9d5e05eb0346b42b66e842d4a2dfacf608d3199a Mon Sep 17 00:00:00 2001 From: Richard Romick Date: Thu, 21 Oct 2021 16:40:48 -0400 Subject: [PATCH 012/100] Fix typo in development.md --- development.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/development.md b/development.md index 63347dcf..0d867874 100644 --- a/development.md +++ b/development.md @@ -1,6 +1,6 @@ # Development Setup and Tools -The following packages are required in order to do development for `system-istaller`. Most of these packages are available in most distributions of Linux and many come pre-installed in some distros. +The following packages are required in order to do development for `system-installer`. Most of these packages are available in most distributions of Linux and many come pre-installed in some distros. * `python3` * `gir1.2-gtk-3.0` From a8386b9c35313530b0ca986c06f40c54b6d223cb Mon Sep 17 00:00:00 2001 From: Richard Romick Date: Thu, 21 Oct 2021 16:54:45 -0400 Subject: [PATCH 013/100] Create roadmap file --- roadmap.md | 444 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 444 insertions(+) create mode 100644 roadmap.md diff --git a/roadmap.md b/roadmap.md new file mode 100644 index 00000000..3a077c32 --- /dev/null +++ b/roadmap.md @@ -0,0 +1,444 @@ +# todo + +- [ ] Implement pylint, unit/doc tests and type hinting +- [ ] Document how to conduct tests +- [ ] Include testing in the development page as a "to do" checklist before creating a pull request + +# system-installer + +## auto_partitioner.py +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| MAIN | | | | +| gb_to_bytes | | | | +| bytes_to_gb | | | | +| size_of_part | | | | +| get_min_root_size | | | | +| check_disk_state | | | | +| mkfs | | | | +| mkfs_fat | | | | +| make_efi | | | | +| sectors_to_size | | | | +| make_root | | | | +| make_home | | | | +| generate_return_data | | | | +| make_root_boot | | | | +| make_part_boot | | | | +| clobber_disk | | | | +| delete_part | | | | +| partition | | | | +| make_raid_array | | | | + +## check_internet.py + +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| ping | | | | +| has_internet | | | | + +## check_kernel_versions.py + +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| get_file_version | | | | +| get_installed_version | | | | +| check_kernel_versions | | | | + +## chroot.py + +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| mount | | | | +| unmount | | | | +| arch_chroot | | | | +| de_chroot | | | | + +## common.py + +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| unique | | | | +| eprint | | | | +| real_number | | | | + +## engine.py + +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| MAIN | | | | + +## installer.py + +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| mount | | | | +| update | | | | +| install | | | | + +## progress.py + +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| MAIN | | | | + +## success.py + +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| MAIN | | | | + +# Modules + +## __init__.py + +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| MAIN | | | | + +## auto_login_set.py + +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| eprint | | | | +| auto_login_set | | | | + +## install_extras.py + +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| eprint | | | | +| install_extras | | | | + +## install_updates.py + +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| eprint | | | | +| update_system | | | | + +## make_swap.py + +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| eprint | | | | +| make_swap | | | | + +## make_user.py + +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| eprint | | | | +| fix_home | | | | +| make_user | | | | + +## master.py + +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| eprint | | | | +| update | | | | +| MainInstallation.init | | | | +| MainInstallation.time_set | | | | +| MainInstallation.locale_set | | | | +| MainInstallation.set_networking | | | | +| MainInstallation.make_user | | | | +| MainInstallation.mk_swap | | | | +| MainInstallation.apt | | | | +| MainInstallation.set_passwd | | | | +| MainInstallation.lightdm.config | | | | +| MainInstallaion.set_keyboard | | | | +| MainInstallation.remove_launcher | | | | +| set_plymouth_theme | | | | +| install_kernel | | | | +| install_bootloader | | | | +| install_grub | | | | +| install_systemd_boot | | | | +| setup_lowlevel | | | | +| check_systemd_boot | | | | +| check_for_laptop | | | | +| handle_laptops | | | | +| install | | | | + +## purge.py + +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| purge_package | | | | +| autoremove | | | | + +## set_locale.py + +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| eprint | | | | +| set_locale | | | | +| _set_locale | | | | + +## set_time.py + +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| eprint | | | | +| link | | | | +| set_time | | | | + +## set_wallpaper.py + +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| eprint | | | | +| set_wallpaper | | | | + + +## verify_install.py + +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| eprint | | | | +| verify | | | | + +# OEM + +## __init__.py +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| MAIN | | | | + +## pre_install.py +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| eprint | | | | +| has_special_charater | | | | +| Main.init | | | | +| Main.set_default_margins | | | | +| Main.auto_partition | | | | +| Main.define_array | | | | +| Main.assign_raid_disk_1 | | | | +| Main.assign_raid_disk_2 | | | | +| Main.assign_raid_disk_3 | | | | +| Main.assign_raid_disk_4 | | | | +| Main.change_raid_type | | | | +| Main.confirm_raid_array | | | | +| Main.cement_raid_array | | | | +| Main.auto_home_setup | | | | +| Main.auto_home_setup2 | | | | +| Main.select_home_part | | | | +| Main.set_root_part | | | | +| Main.confirm_auto_part | | | | +| Main.complete | | | | +| Main.exit | | | | +| Main._exit | | | | +| Main.clear_window | | | | +| Main.return_data | | | | +| show_main | | | | + +# OEM Post Install + +## __init__.py +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| MAIN | | | | + +## UI.py +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| eprint | | | | +| has_special_character | | | | +| Main.init | | | | +| Main.set_default_margins | | | | +| Main.reset | | | | +| Main.user | | | | +| Main.on_user_completed | | | | +| Main.locale | | | | +| Main.update_subregion | | | | +| Main.on_locale_completed | | | | +| Main.keyboard | | | | +| Main.varient_narrower | | | | +| Main.on_keyboard_completed | | | | +| Main.complete | | | | +| Main.clear_window | | | | +| Main.exit | | | | +| set_passwd | | | | +| show_main | | | | +| configure_locale | | | | +| configure_keyboard | | | | +| monitor_procs | | | | +| make_kbd_names | | | | + +# OEM Post Install configure + +## __init__.py +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| MAIN | | | | + +## auto_login_set.py +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| eprint | | | | +| auto_login_set | | | | + +## keyboard.py +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| configure | | | | + +## set_locale.py +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| eprint | | | | +| set_locale | | | | +| _set_locale | | | | + +## set_time.py +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| eprint | | | | +| link | | | | +| set_time | | | | + +# UI + +## __init__.py +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| MAIN | | | | + +## confirm.py +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| eprint | | | | +| Main.init | | | | +| Main.onnextclicked | | | | +| Main.set_default_margins | | | | +| Main.exit | | | | +| Main.return_install | | | | +| show_confirm | | | | + +## error.py +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| Main.init | | | | +| Main.main_menu | | | | +| show_error | | | | + +## main.py +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| eprint | | | | +| has_special_character | | | | +| Main.init | | | | +| Main.set_default_margins | | | | +| Main.quick_install_warning | | | | +| Main.reset | | | | +| Main.oem_startup | | | | +| Main.select_config | | | | +| Main.add_filters | | | | +| Main.main_menu | | | | +| Main.user | | | | +| Main.onnext2clicked | | | | +| Main.partitioning | | | | +| Main.auto_partition | | | | +| Main.define_array | | | | +| Main.assign_raid_disk_1 | | | | +| Main.assign_raid_disk_2 | | | | +| Main.assign_raid_disk_3 | | | | +| Main.assign_raid_disk_4 | | | | +| Main.change_raid_type | | | | +| Main.confirm_raid_array | | | | +| Main.cement_raid_array | | | | +| Main.make_space | | | | +| Main.make_space_parts | | | | +| Main.confirm_remove_part | | | | +| Main.remove_part | | | | +| Main.auto_home_setup | | | | +| Main.auto_home_setup2 | | | | +| Main.select_home_part | | | | +| Main.set_root_part | | | | +| Main.confirm_auto_part | | | | +| Main.input_part | | | | +| Main.onnext4clicked | | | | +| Main.opengparted | | | | +| Main.options | | | | +| Main.options_next | | | | +| Main.locale | | | | +| Main.update_subregion | | | | +| Main.on_locale_completed | | | | +| Main.keyboard | | | | +| Main.varent_narrower | | | | +| Main.on_keyboard_completed | | | | +| Main.done | | | | +| Main.complete | | | | +| Main.exit | | | | +| Main._exit | | | | +| Main.clear_window | | | | +| Main.return_data | | | | +| show_main | | | | +| make_kbd_names | | | | + +## progress.py +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| Main.init | | | | +| Main.set_default_margins | | | | +| Main.read_file | | | | +| Main.pulse | | | | +| Worker.init | | | | +| Worker.do_startup | | | | +| Worker.do_activate | | | | +| show_progress | | | | +| handle_sig_term | | | | + +## report.py +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| MAIN | | | | +| Main.init | | | | +| Main.clear_window | | | | +| Main.set_default_margin | | | | +| Main.cpu_toggle | | | | +| Main.cpu_explanation | | | | +| Main.gpu_toggle | | | | +| Main.gpu_explanation | | | | +| Main.ram_toggle | | | | +| Main.ram_explanation | | | | +| Main.disk_toggle | | | | +| Main.disk_explanation | | | | +| Main.log_toggle | | | | +| Main.log_explanation | | | | +| Main.exit | | | | +| Main.message_handler | | | | +| Main.send_report | | | | +| Main.preview_message | | | | +| Main.generate_message | | | | +| Main.message_accept | | | | +| Main.toggle_ui | | | | +| Main.main | | | | +| cpu_info | | | | +| RAM_info | | | | +| disk_info | | | | +| get_info | | | | +| send_to | | | | + +## success.py +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| MAIN | | | | +| Main.init | | | | +| Main.set_default_margins | | | | +| Main.main_menu | | | | +| Main.onadvclicked | | | | +| Main.ondeletewarn | | | | +| Main.delete_install | | | | +| Main.add_ppa | | | | +| Main.add_ppa_backend | | | | +| Main.exit | | | | +| Main.clear_window | | | | +| Main.dump_settings_dialog | | | | +| Main.dump_settings_file_dialog | | | | +| dump_settings | | | | +| adv_dump_settings | | | | +| unique | | | | +| show_success | | | | +| reboot | | | | +| poweroff | | | | \ No newline at end of file From d52ec5bc1f935d1fba53cdee977c97361967e215 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Fri, 22 Oct 2021 00:26:49 -0400 Subject: [PATCH 014/100] fix UnboundLocalError --- usr/share/system-installer/installer.py | 52 ++++++++++++------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/usr/share/system-installer/installer.py b/usr/share/system-installer/installer.py index 11769c2e..3b1ddece 100755 --- a/usr/share/system-installer/installer.py +++ b/usr/share/system-installer/installer.py @@ -23,7 +23,7 @@ # """Main module controling the installation process""" from subprocess import Popen, check_output, check_call, CalledProcessError -from os import mkdir, path, chdir, listdir, remove, symlink, chmod +import os import shutil import tarfile as tar import json @@ -52,7 +52,7 @@ def __update__(percentage): with open("/tmp/system-installer-progress.log", "w+") as progress: progress.write(str(percentage)) except PermissionError: - chmod("/tmp/system-installer-progress.log", 0o666) + os.chmod("/tmp/system-installer-progress.log", 0o666) with open("/tmp/system-installer-progress.log", "w+") as progress: progress.write(str(percentage)) @@ -100,24 +100,24 @@ def install(settings): auto_partitioner.make_part_boot(settings["ROOT"]) else: auto_partitioner.make_part_boot(settings["EFI"]) - if path.exists("/tmp/system-installer-progress.log"): - remove("/tmp/system-installer-progress.log") + if os.path.exists("/tmp/system-installer-progress.log"): + os.remove("/tmp/system-installer-progress.log") __update__(12) # STEP 2: Mount the new partitions __mount__(settings["ROOT"], "/mnt") if settings["EFI"] not in ("NULL", None, "", False): try: - mkdir("/mnt/boot") + os.mkdir("/mnt/boot") except FileExistsError: pass try: - mkdir("/mnt/boot/efi") + os.mkdir("/mnt/boot/efi") except FileExistsError: pass __mount__(settings["EFI"], "/mnt/boot/efi") if settings["HOME"] not in ("NULL", None, ""): try: - mkdir("/mnt/home") + os.mkdir("/mnt/home") except FileExistsError: common.eprint("/mnt/home exists when it shouldn't. We have issues...") __mount__(settings["HOME"], "/mnt/home") @@ -131,36 +131,36 @@ def install(settings): squashfs = "" with open("/etc/system-installer/settings.json", "r") as file: config = json.loads(file.read()) - if not path.exists(config["squashfs_Location"]): + if not os.path.exists(config["squashfs_Location"]): common.eprint("\n SQUASHFS FILE DOES NOT EXIST \n") UI.error.show_error("\n\tSQUASHFS FILE DOES NOT EXIST\t\n") __update__(17) - chdir("/mnt") + os.chdir("/mnt") common.eprint("CLEANING INSTALLATION DIRECTORY") - death_row = listdir() + death_row = os.listdir() for each in death_row: if each not in ("boot", "home"): common.eprint("Removing " + each) try: shutil.rmtree(each) except NotADirectoryError: - remove(each) + os.remove(each) try: - chdir("/mnt/boot") - death_row = listdir() + os.chdir("/mnt/boot") + death_row = os.listdir() for each in death_row: if each != "efi": try: shutil.rmtree(each) except NotADirectoryError: - remove(each) - chdir("/mnt") + os.remove(each) + os.chdir("/mnt") except FileNotFoundError: pass common.eprint(" ### EXTRACTING SQUASHFS ### ") check_call(["unsquashfs", config["squashfs_Location"]]) common.eprint(" ### EXTRACTION COMPLETE ### ") - file_list = listdir("/mnt/squashfs-root") + file_list = os.listdir("/mnt/squashfs-root") for each in file_list: try: common.eprint("/mnt/squashfs-root/" + each + " --> /mnt/" + each) @@ -169,18 +169,18 @@ def install(settings): common.eprint("ERROR: %s" % (e)) shutil.rmtree("/mnt/squashfs-root") try: - mkdir("/mnt/boot") + os.mkdir("/mnt/boot") except FileExistsError: common.eprint("/mnt/boot already created") shutil.copyfile("/tmp/system-installer-progress.log", "/mnt/tmp/system-installer-progress.log") - remove("/tmp/system-installer-progress.log") - symlink("/mnt/tmp/system-installer-progress.log", + os.remove("/tmp/system-installer-progress.log") + os.symlink("/mnt/tmp/system-installer-progress.log", "/tmp/system-installer-progress.log") __update__(32) # STEP 4: Update fstab common.eprint(" ### Updating FSTAB ### ") - remove("/mnt/etc/fstab") + os.remove("/mnt/etc/fstab") fstab_contents = check_output(["genfstab", "-U", "/mnt"]).decode() with open("/mnt/etc/fstab", "w+") as fstab: fstab.write(fstab_contents + "\n") @@ -250,11 +250,11 @@ def install(settings): shutil.rmtree("/mnt/etc/NetworkManager/system-connections") shutil.copytree("/etc/NetworkManager/system-connections", "/mnt/etc/NetworkManager/system-connections") - if path.exists(work_dir) and path.exists(work_dir + "/assets"): - ls = listdir(work_dir + "/assets") - mkdir("/mnt/user-data") + if os.path.exists(work_dir) and os.path.exists(work_dir + "/assets"): + ls = os.listdir(work_dir + "/assets") + os.mkdir("/mnt/user-data") if "master" in ls: - file_type = listdir(work_dir + "/assets/master")[0].split("/")[-1].split(".")[-1] + file_type = os.listdir(work_dir + "/assets/master")[0].split("/")[-1].split(".")[-1] shutil.copyfile(work_dir + "/assets/master/wallpaper." + file_type, "/mnt/user-data/wallpaper." + file_type) shutil.copyfile(work_dir + "/assets/screens.list", @@ -267,11 +267,11 @@ def install(settings): modules.master.install(settings) chroot.de_chroot(real_root, "/mnt") common.eprint("Resetting resolv.conf") - remove("/mnt/etc/resolv.conf") + os.remove("/mnt/etc/resolv.conf") shutil.move("/mnt/etc/resolv.conf.save", "/mnt/etc/resolv.conf") __update__(96) try: - file_list = listdir("/mnt/boot/efi/loader/entries") + file_list = os.listdir("/mnt/boot/efi/loader/entries") except FileNotFoundError: file_list = [] if ((len(file_list) == 0) and (settings["EFI"] not in (None, "", "NULL", False))): From 7d681a521f6efcd373af402d03e253c039c9ef33 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Fri, 22 Oct 2021 00:31:12 -0400 Subject: [PATCH 015/100] pass local_repo to needed areas --- usr/share/system-installer/engine.py | 2 +- usr/share/system-installer/installer.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/usr/share/system-installer/engine.py b/usr/share/system-installer/engine.py index e0aab3fd..29a58515 100755 --- a/usr/share/system-installer/engine.py +++ b/usr/share/system-installer/engine.py @@ -134,7 +134,7 @@ process = subprocess.Popen("/usr/share/system-installer/progress.py") pid = process.pid SETTINGS["INTERNET"] = check_internet.has_internet() - installer.install(SETTINGS) + installer.install(SETTINGS, CONFIG["local_repo"]) os.remove("/mnt/repo") common.eprint(" ### %s CLOSED ### " % (sys.argv[0])) try: diff --git a/usr/share/system-installer/installer.py b/usr/share/system-installer/installer.py index 3b1ddece..05a9ed66 100755 --- a/usr/share/system-installer/installer.py +++ b/usr/share/system-installer/installer.py @@ -57,7 +57,7 @@ def __update__(percentage): progress.write(str(percentage)) -def install(settings): +def install(settings, local_repo): """Begin installation proceidure settings should be a dictionary with the following values: From 24784a2e49419c6e26d6a395d6651034cca66994 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Fri, 22 Oct 2021 00:39:21 -0400 Subject: [PATCH 016/100] fix kernel and systemd-boot installation errors --- usr/share/system-installer/modules/master.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/usr/share/system-installer/modules/master.py b/usr/share/system-installer/modules/master.py index 31806125..0acd6bde 100755 --- a/usr/share/system-installer/modules/master.py +++ b/usr/share/system-installer/modules/master.py @@ -230,13 +230,15 @@ def install_kernel(release): # we are going to do offline kernel installation from now on. # it's just easier and more reliable packages = ["linux-headers-" + release, "linux-image-" + release] - install_command = ["dpkg", "-R", "--install"] + install_command = ["dpkg", "--install"] subprocess.check_call(["apt-get", "purge", "-y"] + packages, stdout=stderr.buffer) subprocess.check_call(["apt-get", "autoremove", "-y", "--purge"], stdout=stderr.buffer) packages = [each for each in os.listdir("/repo") if "linux-" in each] + os.chdir("/repo") subprocess.check_call(install_command + packages, stdout=stderr.buffer) + os.chdir("/") def install_bootloader(efi, root, release): @@ -323,10 +325,12 @@ def _install_systemd_boot(release, root): except subprocess.CalledProcessError: eprint("CHATTR FAILED ON loader.conf, setting octal permissions to 444") os.chmod("/boot/efi/loader/loader.conf", 0o444) - install_command = ["dpkg", "-R", "--install"] + install_command = ["dpkg", "--install"] package = [each for each in os.listdir("/repo") if "systemd-boot-manager" in each] + os.chdir("/repo") subprocess.check_call(install_command + package, stdout=stderr.buffer) + os.chdir("/") subprocess.check_call(["systemd-boot-manager", "-r"], stdout=stderr.buffer) check_systemd_boot(release, root) From 9ac4e9e370ee5f6fec124693795b202fa76039ce Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Fri, 22 Oct 2021 22:02:43 -0400 Subject: [PATCH 017/100] fix systemd-boot-manager installation bug --- usr/share/system-installer/modules/master.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/usr/share/system-installer/modules/master.py b/usr/share/system-installer/modules/master.py index 0acd6bde..cbf0cc27 100755 --- a/usr/share/system-installer/modules/master.py +++ b/usr/share/system-installer/modules/master.py @@ -326,9 +326,21 @@ def _install_systemd_boot(release, root): eprint("CHATTR FAILED ON loader.conf, setting octal permissions to 444") os.chmod("/boot/efi/loader/loader.conf", 0o444) install_command = ["dpkg", "--install"] - package = [each for each in os.listdir("/repo") if "systemd-boot-manager" in each] + packages = [each for each in os.listdir("/repo") if "systemd-boot-manager" in each] os.chdir("/repo") - subprocess.check_call(install_command + package, + depends = subprocess.check_output(["dpkg", "-f"] + package + ["depends"]) + depends = depends.decode()[:-1].split(", ") + # List of dependencies + depends = [depends[each[0]].split(" ") for each in enumerate(depends)] + # depends is just a list of package names. We now need to go through the list + # of files in this folder, and if the package name is in the file name, add + # it to the list `packages` + for each in os.listdir(): + for each1 in depends: + if ((each1 in each) and (each not in packages)): + packages.append(each) + break + subprocess.check_call(install_command + packages, stdout=stderr.buffer) os.chdir("/") subprocess.check_call(["systemd-boot-manager", "-r"], From c99133e638db4f0e84d83b5897c402fe567e148d Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Fri, 22 Oct 2021 22:12:32 -0400 Subject: [PATCH 018/100] 1 letter typo fix --- usr/share/system-installer/modules/master.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/share/system-installer/modules/master.py b/usr/share/system-installer/modules/master.py index cbf0cc27..1fbfaeb9 100755 --- a/usr/share/system-installer/modules/master.py +++ b/usr/share/system-installer/modules/master.py @@ -328,7 +328,7 @@ def _install_systemd_boot(release, root): install_command = ["dpkg", "--install"] packages = [each for each in os.listdir("/repo") if "systemd-boot-manager" in each] os.chdir("/repo") - depends = subprocess.check_output(["dpkg", "-f"] + package + ["depends"]) + depends = subprocess.check_output(["dpkg", "-f"] + packages + ["depends"]) depends = depends.decode()[:-1].split(", ") # List of dependencies depends = [depends[each[0]].split(" ") for each in enumerate(depends)] From 073812212e90a2b6f29c8f4cd6970a27b43f334b Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Fri, 22 Oct 2021 22:22:59 -0400 Subject: [PATCH 019/100] minor bug fix packages needs to be a list of strings. lists of split strings where not being replaced with strings. --- usr/share/system-installer/modules/master.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/share/system-installer/modules/master.py b/usr/share/system-installer/modules/master.py index 1fbfaeb9..0c0a414f 100755 --- a/usr/share/system-installer/modules/master.py +++ b/usr/share/system-installer/modules/master.py @@ -331,7 +331,7 @@ def _install_systemd_boot(release, root): depends = subprocess.check_output(["dpkg", "-f"] + packages + ["depends"]) depends = depends.decode()[:-1].split(", ") # List of dependencies - depends = [depends[each[0]].split(" ") for each in enumerate(depends)] + depends = [depends[each[0]].split(" ")[0] for each in enumerate(depends)] # depends is just a list of package names. We now need to go through the list # of files in this folder, and if the package name is in the file name, add # it to the list `packages` From 3f7cbbaf8540ccb2ace19adb02d24ef36eba9dc4 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Fri, 22 Oct 2021 22:33:57 -0400 Subject: [PATCH 020/100] generate changelog when building package --- .gitignore | 2 ++ build.sh | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/.gitignore b/.gitignore index a295864e..67119fb0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ *.pyc __pycache__ +changelog.gz +changelog diff --git a/build.sh b/build.sh index f8ac5331..2cdbe385 100755 --- a/build.sh +++ b/build.sh @@ -94,6 +94,13 @@ if [ -d srv ]; then cp -R srv ../"$FOLDER"/srv fi cp -R DEBIAN ../"$FOLDER"/DEBIAN +mkdir -p usr/share/doc/$PAK +git log > usr/share/doc/$PAK/changelog +cd usr/share/doc/$PAK +tar --verbose --create --xz -f changelog.gz changelog +rm changelog +cd ../../../.. +base="$pwd" cd .. #DELETE STUFF HERE if [ "$OPTIONS" != "--pool" ]; then From 11203b772717e469c98ff45efa9e2d0e05b463de Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Fri, 22 Oct 2021 22:36:41 -0400 Subject: [PATCH 021/100] silence useless output from changelog tarball creation --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 2cdbe385..122b17e9 100755 --- a/build.sh +++ b/build.sh @@ -97,7 +97,7 @@ cp -R DEBIAN ../"$FOLDER"/DEBIAN mkdir -p usr/share/doc/$PAK git log > usr/share/doc/$PAK/changelog cd usr/share/doc/$PAK -tar --verbose --create --xz -f changelog.gz changelog +tar --verbose --create --xz -f changelog.gz changelog 1>/dev/null rm changelog cd ../../../.. base="$pwd" From fb2da76750814d71c17b6c7f26a3952ce1cb364c Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Fri, 22 Oct 2021 22:49:19 -0400 Subject: [PATCH 022/100] fix undefined error --- usr/share/system-installer/engine.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/usr/share/system-installer/engine.py b/usr/share/system-installer/engine.py index 29a58515..7ee0c94c 100755 --- a/usr/share/system-installer/engine.py +++ b/usr/share/system-installer/engine.py @@ -25,7 +25,7 @@ from __future__ import print_function import sys import subprocess -from os import path, listdir, remove, kill +import os import json import tarfile as tar from shutil import copyfile, copytree @@ -48,10 +48,10 @@ if sys.argv[1] == "--boot-time": # OEM post-install configuration, on-boot installation, and more # are handled here - if path.exists("/etc/system-installer/oem-post-install.flag"): + if os.path.exists("/etc/system-installer/oem-post-install.flag"): # OEM post installation configuration oem.post_install.UI.show_main() - remove("/etc/system-installer/oem-post-install.flag") + os.remove("/etc/system-installer/oem-post-install.flag") modules.purge.purge_package("system-installer") if "run_post_oem" in CONFIG: subprocess.Popen(CONFIG["run_post_oem"]) @@ -94,7 +94,7 @@ \tIf your problem persists, please create an issue on our Github.\t """) sys.exit(2) - elif path.exists(SETTINGS): + elif os.path.exists(SETTINGS): if SETTINGS.split("/")[-1][-5:] == ".json": with open(SETTINGS, "r") as quick_install_file: SETTINGS = json.load(quick_install_file) @@ -102,12 +102,12 @@ tar_file = tar.open(name=SETTINGS) tar_file.extractall(path=work_dir) tar_file.close() - if path.exists(work_dir + "/settings/installation-settings.json"): + if os.path.exists(work_dir + "/settings/installation-settings.json"): with open(work_dir + "/settings/installation-settings.json", "r") as quick_install_file: SETTINGS = json.load(quick_install_file) try: - net_settings = listdir(work_dir + "/settings/network-settings") + net_settings = os.listdir(work_dir + "/settings/network-settings") if len(net_settings) > 0: copytree(net_settings + "/settings/network-settings", "/etc/NetworkManager/system-connections") @@ -150,9 +150,9 @@ "/mnt/var/log/system-installer.log") subprocess.Popen(["su", "live", "-c", "/usr/share/system-installer/success.py \'%s\'" % (json.dumps(SETTINGS))]) - kill(pid, 15) + os.kill(pid, 15) except Exception as error: - kill(pid, 15) + os.kill(pid, 15) common.eprint("\nAn Error has occured:\n%s\n" % (error)) common.eprint(traceback.format_exc()) print("\nAn Error has occured:\n%s\n" % (error)) From 21f966e6ea8ea462c9688abaacffa94f532417ba Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Fri, 22 Oct 2021 22:49:58 -0400 Subject: [PATCH 023/100] systemd-boot-manager updates Make sure it's enabled, enforcing the default, and sets itself up --- usr/share/system-installer/modules/master.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr/share/system-installer/modules/master.py b/usr/share/system-installer/modules/master.py index 0c0a414f..48c8be4c 100755 --- a/usr/share/system-installer/modules/master.py +++ b/usr/share/system-installer/modules/master.py @@ -345,6 +345,10 @@ def _install_systemd_boot(release, root): os.chdir("/") subprocess.check_call(["systemd-boot-manager", "-r"], stdout=stderr.buffer) + subprocess.check_call(["systemd-boot-manager", "-e"], + stdout=stderr.buffer) + subprocess.check_call(["systemd-boot-manager", "-u"], + stdout=stderr.buffer) check_systemd_boot(release, root) From 2183f6f40e42bb96ad84ccea7f9fa0f532b4652b Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Fri, 22 Oct 2021 22:50:23 -0400 Subject: [PATCH 024/100] move some stuff around --- usr/share/system-installer/modules/master.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/usr/share/system-installer/modules/master.py b/usr/share/system-installer/modules/master.py index 48c8be4c..e3191d0b 100755 --- a/usr/share/system-installer/modules/master.py +++ b/usr/share/system-installer/modules/master.py @@ -343,9 +343,12 @@ def _install_systemd_boot(release, root): subprocess.check_call(install_command + packages, stdout=stderr.buffer) os.chdir("/") + subprocess.check_call(["systemd-boot-manager", "-e"], + stdout=stderr.buffer) subprocess.check_call(["systemd-boot-manager", "-r"], stdout=stderr.buffer) - subprocess.check_call(["systemd-boot-manager", "-e"], + subprocess.check_call(["systemd-boot-manager", + "--enforce-default-entry=enable"], stdout=stderr.buffer) subprocess.check_call(["systemd-boot-manager", "-u"], stdout=stderr.buffer) From b2b4ac89a36bed556a4d2ec11fbe303016d1a220 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Fri, 22 Oct 2021 23:06:57 -0400 Subject: [PATCH 025/100] properly remove repo dir --- usr/share/system-installer/engine.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/usr/share/system-installer/engine.py b/usr/share/system-installer/engine.py index 7ee0c94c..b8f9a405 100755 --- a/usr/share/system-installer/engine.py +++ b/usr/share/system-installer/engine.py @@ -28,7 +28,7 @@ import os import json import tarfile as tar -from shutil import copyfile, copytree +import shutil import traceback import psutil import UI @@ -109,7 +109,7 @@ try: net_settings = os.listdir(work_dir + "/settings/network-settings") if len(net_settings) > 0: - copytree(net_settings + "/settings/network-settings", + shutil.copytree(net_settings + "/settings/network-settings", "/etc/NetworkManager/system-connections") common.eprint("\t###\tNOTE: NETWORK SETTINGS COPIED TO LIVE SYSTEM\t###\t") except FileNotFoundError: @@ -135,10 +135,10 @@ pid = process.pid SETTINGS["INTERNET"] = check_internet.has_internet() installer.install(SETTINGS, CONFIG["local_repo"]) - os.remove("/mnt/repo") + shutil.rmtree("/mnt/repo") common.eprint(" ### %s CLOSED ### " % (sys.argv[0])) try: - copyfile("/tmp/system-installer.log", + shutil.copyfile("/tmp/system-installer.log", "/mnt/var/log/system-installer.log") except FileNotFoundError: common.eprint(" ### Log Not Found. Testing? ### ") @@ -146,7 +146,7 @@ log.write("""Log was not created during installation. This is a stand-in file. """) - copyfile("/tmp/system-installer.log", + shutil.copyfile("/tmp/system-installer.log", "/mnt/var/log/system-installer.log") subprocess.Popen(["su", "live", "-c", "/usr/share/system-installer/success.py \'%s\'" % (json.dumps(SETTINGS))]) From 7a23d335bfb39e6b3dc53dc6731a3909227fec07 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sat, 23 Oct 2021 13:03:14 -0400 Subject: [PATCH 026/100] version bump A lot has been done to get this far so bump the version up. --- DEBIAN/control | 2 +- usr/bin/system-installer | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEBIAN/control b/DEBIAN/control index 5167a7d2..e61ec52a 100644 --- a/DEBIAN/control +++ b/DEBIAN/control @@ -1,5 +1,5 @@ Package: system-installer -Version: 2.1.1 +Version: 2.1.3 Maintainer: Thomas Castleman Homepage: https://github.com/drauger-os-development/system-installer Section: admin diff --git a/usr/bin/system-installer b/usr/bin/system-installer index 43021e6e..ca08bd99 100755 --- a/usr/bin/system-installer +++ b/usr/bin/system-installer @@ -28,7 +28,7 @@ import de_control.disable as de_disable import de_control.enable as de_enable from os import path ARGC = len(argv) -VERSION = "2.1.1" +VERSION = "2.1.3" HELP = """ system-installer, Version %s From 0beec7094c44b98bb4b0122ad3bf5be2ded579a5 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sat, 23 Oct 2021 13:09:03 -0400 Subject: [PATCH 027/100] update documentation --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a32f1f39..2f8ed074 100644 --- a/README.md +++ b/README.md @@ -39,5 +39,7 @@ This drawback is in place for a number of reasons: * `systemd-boot` does not support BIOS * `GRUB` is a pain on UEFI -### +40 MB *.deb +### Max 40+ MB *.deb The *.deb is currently +40 MB because it packs a kernel to install inside the *.deb file. + +This can be circumvented by passing the `--pool` flag to `build.sh`, and results in a *.deb with no kernel archive. To use this DEB, please be sure to have a folder in your ISO storing all necessary packages (kernel and systemd-boot-manager) and have that folder defined in `etc/system-installer/settings.json`. From 9b3735d12374608475ffb53b5e93454efecd90bd Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sun, 24 Oct 2021 13:04:43 -0400 Subject: [PATCH 028/100] make sure default boot option is set This will only take affect after the first boot, but so long as we use GRUB as the bootloader for the Live USB, that's how this will have to work. And, realisticly, if this were to be used by other distros, we can't expect them to use systemd-boot in their Live USBs either. So this is likely the best option. --- usr/share/system-installer/modules/master.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr/share/system-installer/modules/master.py b/usr/share/system-installer/modules/master.py index e3191d0b..ca8dc58d 100755 --- a/usr/share/system-installer/modules/master.py +++ b/usr/share/system-installer/modules/master.py @@ -350,6 +350,9 @@ def _install_systemd_boot(release, root): subprocess.check_call(["systemd-boot-manager", "--enforce-default-entry=enable"], stdout=stderr.buffer) + # This lib didn't exist before we installed this package. So we can only now import it + import systemd_boot_manager + systemd_boot_manager.update_defaults_file(systemd_boot_manager.DISTRO + ".conf") subprocess.check_call(["systemd-boot-manager", "-u"], stdout=stderr.buffer) check_systemd_boot(release, root) From 3b6c3928291c407b5ed3d7e68b42a07f1eab48e2 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sun, 24 Oct 2021 13:25:45 -0400 Subject: [PATCH 029/100] PEP8 improvments --- usr/share/system-installer/modules/master.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr/share/system-installer/modules/master.py b/usr/share/system-installer/modules/master.py index ca8dc58d..f79d1ff2 100755 --- a/usr/share/system-installer/modules/master.py +++ b/usr/share/system-installer/modules/master.py @@ -38,7 +38,6 @@ import de_control.modify as de_modify - # import our own programs import modules.auto_login_set as auto_login_set import modules.make_swap as make_swap @@ -50,6 +49,7 @@ from modules.verify_install import verify from modules.purge import purge_package + def eprint(*args, **kwargs): """Make it easier for us to print to stderr""" print(*args, file=stderr, **kwargs) @@ -64,6 +64,7 @@ def __update__(percentage): with open("/tmp/system-installer-progress.log", "w+") as progress: progress.write(str(percentage)) + class MainInstallation(): """Main Installation Procedure, minus low-level stuff""" def __init__(self, processes_to_do, settings): @@ -207,6 +208,7 @@ def remove_launcher(USERNAME): eprint("""Cannot find launcher for system-installer. User will need to remove manually.""") + def set_plymouth_theme(): """Ensure the plymouth theme is set correctly""" subprocess.Popen(["update-alternatives", "--install", From a3debb7c7aef03385fc127c6265e1783f09b2dfd Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sun, 24 Oct 2021 13:28:46 -0400 Subject: [PATCH 030/100] more PEP8 improvments --- usr/share/system-installer/modules/master.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/usr/share/system-installer/modules/master.py b/usr/share/system-installer/modules/master.py index f79d1ff2..5226041b 100755 --- a/usr/share/system-installer/modules/master.py +++ b/usr/share/system-installer/modules/master.py @@ -80,8 +80,8 @@ def __init__(self, processes_to_do, settings): offset = 39 ending = 51 iterator = round(ending / len(processes_to_do)) - # We COULD set point equal to iterator, but we don't want the iterator to change, - # so re-doing the math is safer, albiet slower. + # We COULD set point equal to iterator, but we don't want the iterator + # to change, so re-doing the math is safer, albiet slower. point = round(ending / len(processes_to_do)) while len(processes_to_do) > 0: for each in range(len(processes_to_do) - 1, -1, -1): @@ -194,16 +194,16 @@ def set_keyboard(MODEL, LAYOUT, VARIENT): subprocess.Popen(["udevadm", "trigger", "--subsystem-match=input", "--action=change"], stdout=stderr.buffer) - def remove_launcher(USERNAME): + def remove_launcher(USER): """Remove system installer desktop launcher""" try: os.remove("/home/live/Desktop/system-installer.desktop") except FileNotFoundError: try: - os.remove("/home/%s/Desktop/system-installer.desktop" % (USERNAME)) + os.remove("/home/%s/Desktop/system-installer.desktop" % (USER)) except FileNotFoundError: try: - rmtree("/home/%s/.config/xfce4/panel/launcher-3" % (USERNAME)) + rmtree("/home/%s/.config/xfce4/panel/launcher-3" % (USER)) except FileNotFoundError: eprint("""Cannot find launcher for system-installer. User will need to remove manually.""") @@ -216,7 +216,8 @@ def set_plymouth_theme(): "default.plymouth", "/usr/share/plymouth/themes/drauger-theme/drauger-theme.plymouth", "100", "--slave", - "/usr/share/plymouth/themes/default.grub", "default.plymouth.grub", + "/usr/share/plymouth/themes/default.grub", + "default.plymouth.grub", "/usr/share/plymouth/themes/drauger-theme/drauger-theme.grub"], stdout=stderr.buffer) process = subprocess.Popen(["update-alternatives", "--config", @@ -320,7 +321,8 @@ def _install_systemd_boot(release, root): except FileExistsError: pass with open("/boot/efi/loader/loader.conf", "w+") as loader_conf: - loader_conf.write("default Drauger_OS\ntimeout 5\nconsole-mode 1\neditor 1") + loader_conf.write("default Drauger_OS\n") + loader_conf.write("timeout 5\nconsole-mode 1\neditor 1") try: subprocess.check_call(["chattr", "-i", "/boot/efi/loader/loader.conf"], stdout=stderr.buffer) From eb1f5462d32b4f95f55fd7fc547cd7b1b9df426d Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sun, 24 Oct 2021 13:31:17 -0400 Subject: [PATCH 031/100] even more PEP8 improvments all line length stuff --- usr/share/system-installer/modules/master.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/usr/share/system-installer/modules/master.py b/usr/share/system-installer/modules/master.py index 5226041b..57c58676 100755 --- a/usr/share/system-installer/modules/master.py +++ b/usr/share/system-installer/modules/master.py @@ -354,7 +354,8 @@ def _install_systemd_boot(release, root): subprocess.check_call(["systemd-boot-manager", "--enforce-default-entry=enable"], stdout=stderr.buffer) - # This lib didn't exist before we installed this package. So we can only now import it + # This lib didn't exist before we installed this package. + # So we can only now import it import systemd_boot_manager systemd_boot_manager.update_defaults_file(systemd_boot_manager.DISTRO + ".conf") subprocess.check_call(["systemd-boot-manager", "-u"], @@ -391,7 +392,8 @@ def check_systemd_boot(release, root): # Write standard boot conf if it doesn't exist eprint("Standard Systemd-boot entry non-existant") try: - with open("/boot/efi/loader/entries/Drauger_OS.conf", "w+") as main_conf: + with open("/boot/efi/loader/entries/Drauger_OS.conf", + "w+") as main_conf: main_conf.write("""title Drauger OS linux /Drauger_OS/vmlinuz initrd /Drauger_OS/initrd.img @@ -408,7 +410,8 @@ def check_systemd_boot(release, root): eprint("Recovery Systemd-boot entry non-existant") try: # Write recovery boot conf if it doesn't exist - with open("/boot/efi/loader/entries/Drauger_OS_Recovery.conf", "w+") as main_conf: + with open("/boot/efi/loader/entries/Drauger_OS_Recovery.conf", + "w+") as main_conf: main_conf.write("""title Drauger OS Recovery linux /Drauger_OS/vmlinuz initrd /Drauger_OS/initrd.img From 157304c42a412e20ff6f30a31d5c59fe152d56e6 Mon Sep 17 00:00:00 2001 From: SenlisO Date: Wed, 27 Oct 2021 11:11:40 -0400 Subject: [PATCH 032/100] Create si-utilities.py incorporates eprint function so multiple files can use it and we can change the function, if necessary, in one location. --- usr/share/system-installer/si-utilities.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 usr/share/system-installer/si-utilities.py diff --git a/usr/share/system-installer/si-utilities.py b/usr/share/system-installer/si-utilities.py new file mode 100644 index 00000000..8af35b5c --- /dev/null +++ b/usr/share/system-installer/si-utilities.py @@ -0,0 +1,5 @@ +import sys + +def eprint(*args, **kwargs): + """Make it easier for us to print to stderr""" + print(*args, file=sys.stderr, **kwargs) From 709bfc594a4c7bbe9c1e948ff3905a82840c74e5 Mon Sep 17 00:00:00 2001 From: SenlisO Date: Wed, 27 Oct 2021 11:12:46 -0400 Subject: [PATCH 033/100] Update roadmap.md with new si-utilties file --- roadmap.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/roadmap.md b/roadmap.md index 3a077c32..29a88323 100644 --- a/roadmap.md +++ b/roadmap.md @@ -6,6 +6,11 @@ # system-installer +## si-utlities +| Function Name | Pylint | Unit/Doc Tests | Type Hinting | +| --- | --- | --- | --- | +| eprint | | | | + ## auto_partitioner.py | Function Name | Pylint | Unit/Doc Tests | Type Hinting | | --- | --- | --- | --- | @@ -441,4 +446,4 @@ | unique | | | | | show_success | | | | | reboot | | | | -| poweroff | | | | \ No newline at end of file +| poweroff | | | | From e8c89d6d4cd38d0886b0abe6a3f3afdd82653f98 Mon Sep 17 00:00:00 2001 From: SenlisO Date: Wed, 27 Oct 2021 11:15:06 -0400 Subject: [PATCH 034/100] Create si-utilities sym-link in UI folder --- usr/share/system-installer/UI/si-utilities.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 usr/share/system-installer/UI/si-utilities.py diff --git a/usr/share/system-installer/UI/si-utilities.py b/usr/share/system-installer/UI/si-utilities.py new file mode 100644 index 00000000..9bd8ca76 --- /dev/null +++ b/usr/share/system-installer/UI/si-utilities.py @@ -0,0 +1 @@ +../si-utilities.py From 5014e62fd0119df1067fa79d7e44365e9dc6c57f Mon Sep 17 00:00:00 2001 From: SenlisO Date: Wed, 27 Oct 2021 11:18:48 -0400 Subject: [PATCH 035/100] Remove eprint function from main.py imported si-utilities removed eprint function from file changed eprint calls to si-utilties.eprint --- usr/share/system-installer/UI/main.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/usr/share/system-installer/UI/main.py b/usr/share/system-installer/UI/main.py index 3a0b17ef..900f1225 100755 --- a/usr/share/system-installer/UI/main.py +++ b/usr/share/system-installer/UI/main.py @@ -27,18 +27,13 @@ import re import json import os +import si-utilities from subprocess import Popen, check_output, DEVNULL import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk import auto_partitioner - -def eprint(*args, **kwargs): - """Make it easier for us to print to stderr""" - print(*args, file=sys.stderr, **kwargs) - - def has_special_character(input_string): """Check for special characters""" regex = re.compile(r'[@_!#$%^&*()<>?/\|}{~:]') @@ -221,7 +216,7 @@ def oem_startup(self, widget): def select_config(self, widget): """Quick Install File Selection Window""" - eprint("\t###\tQUICK INSTALL MODE ACTIVATED\t###\t") + si_utilties.eprint("\t###\tQUICK INSTALL MODE ACTIVATED\t###\t") dialog = Gtk.FileChooserDialog("System Installer", self, Gtk.FileChooserAction.OPEN, (Gtk.STOCK_CANCEL, From 0ccb36aa4a3dad2182991bba8ed1a6146663d222 Mon Sep 17 00:00:00 2001 From: SenlisO Date: Wed, 27 Oct 2021 11:22:09 -0400 Subject: [PATCH 036/100] Update roadmap removed eprint from UI --> main.py since it was moved to a utilities file --- roadmap.md | 1 - 1 file changed, 1 deletion(-) diff --git a/roadmap.md b/roadmap.md index 29a88323..18b3e841 100644 --- a/roadmap.md +++ b/roadmap.md @@ -330,7 +330,6 @@ ## main.py | Function Name | Pylint | Unit/Doc Tests | Type Hinting | | --- | --- | --- | --- | -| eprint | | | | | has_special_character | | | | | Main.init | | | | | Main.set_default_margins | | | | From 6c115dc79377fe04bd9eb3d6d3812e0ed09012b0 Mon Sep 17 00:00:00 2001 From: Richard Romick Date: Wed, 27 Oct 2021 19:45:02 -0400 Subject: [PATCH 037/100] Corrected si-utilities.py symlink --- usr/share/system-installer/UI/si-utilities.py | 1 - usr/share/system-installer/UI/si-utilties.py | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 usr/share/system-installer/UI/si-utilities.py create mode 120000 usr/share/system-installer/UI/si-utilties.py diff --git a/usr/share/system-installer/UI/si-utilities.py b/usr/share/system-installer/UI/si-utilities.py deleted file mode 100644 index 9bd8ca76..00000000 --- a/usr/share/system-installer/UI/si-utilities.py +++ /dev/null @@ -1 +0,0 @@ -../si-utilities.py diff --git a/usr/share/system-installer/UI/si-utilties.py b/usr/share/system-installer/UI/si-utilties.py new file mode 120000 index 00000000..3abb1c4a --- /dev/null +++ b/usr/share/system-installer/UI/si-utilties.py @@ -0,0 +1 @@ +../si-utilities.py \ No newline at end of file From 37ba2df520c1215e4835ef859f79b3088f0ab2c2 Mon Sep 17 00:00:00 2001 From: Richard Romick Date: Wed, 27 Oct 2021 19:49:03 -0400 Subject: [PATCH 038/100] Change si-utiltiies.py file to si_utiltiies.py So it can be properly imported to main.py file --- usr/share/system-installer/UI/main.py | 2 +- usr/share/system-installer/UI/si-utilties.py | 1 - usr/share/system-installer/UI/si_utilties.py | 1 + usr/share/system-installer/{si-utilities.py => si_utilities.py} | 0 4 files changed, 2 insertions(+), 2 deletions(-) delete mode 120000 usr/share/system-installer/UI/si-utilties.py create mode 120000 usr/share/system-installer/UI/si_utilties.py rename usr/share/system-installer/{si-utilities.py => si_utilities.py} (100%) diff --git a/usr/share/system-installer/UI/main.py b/usr/share/system-installer/UI/main.py index 900f1225..b4ee5908 100755 --- a/usr/share/system-installer/UI/main.py +++ b/usr/share/system-installer/UI/main.py @@ -27,7 +27,7 @@ import re import json import os -import si-utilities +import si_utilities from subprocess import Popen, check_output, DEVNULL import gi gi.require_version('Gtk', '3.0') diff --git a/usr/share/system-installer/UI/si-utilties.py b/usr/share/system-installer/UI/si-utilties.py deleted file mode 120000 index 3abb1c4a..00000000 --- a/usr/share/system-installer/UI/si-utilties.py +++ /dev/null @@ -1 +0,0 @@ -../si-utilities.py \ No newline at end of file diff --git a/usr/share/system-installer/UI/si_utilties.py b/usr/share/system-installer/UI/si_utilties.py new file mode 120000 index 00000000..2a4a46a0 --- /dev/null +++ b/usr/share/system-installer/UI/si_utilties.py @@ -0,0 +1 @@ +../si_utilities.py \ No newline at end of file diff --git a/usr/share/system-installer/si-utilities.py b/usr/share/system-installer/si_utilities.py similarity index 100% rename from usr/share/system-installer/si-utilities.py rename to usr/share/system-installer/si_utilities.py From 3b45cccb7d406bbcedd20600188c69726a42a39a Mon Sep 17 00:00:00 2001 From: Richard Romick Date: Wed, 27 Oct 2021 19:50:52 -0400 Subject: [PATCH 039/100] Correct typo si_utilities symlink was incorrectly named --- usr/share/system-installer/UI/{si_utilties.py => si_utilities.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename usr/share/system-installer/UI/{si_utilties.py => si_utilities.py} (100%) diff --git a/usr/share/system-installer/UI/si_utilties.py b/usr/share/system-installer/UI/si_utilities.py similarity index 100% rename from usr/share/system-installer/UI/si_utilties.py rename to usr/share/system-installer/UI/si_utilities.py From 4e008fdffa0f97242618de6bf914b38304fa4229 Mon Sep 17 00:00:00 2001 From: Richard Romick Date: Wed, 27 Oct 2021 19:53:22 -0400 Subject: [PATCH 040/100] Update development.md added python3-parted dependency --- development.md | 1 + 1 file changed, 1 insertion(+) diff --git a/development.md b/development.md index 0d867874..742f5f4c 100644 --- a/development.md +++ b/development.md @@ -5,6 +5,7 @@ The following packages are required in order to do development for `system-insta * `python3` * `gir1.2-gtk-3.0` * `p7zip-full` + * `python3-parted` The following are not required but may help out * `arch-install-scripts` From aa43effd2f30befec99bcfb0ee7e91a598004708 Mon Sep 17 00:00:00 2001 From: Richard Romick Date: Wed, 27 Oct 2021 20:05:40 -0400 Subject: [PATCH 041/100] Update development.md with python3-gnupd --- development.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/development.md b/development.md index 742f5f4c..0ca9511f 100644 --- a/development.md +++ b/development.md @@ -6,6 +6,7 @@ The following packages are required in order to do development for `system-insta * `gir1.2-gtk-3.0` * `p7zip-full` * `python3-parted` + * `python3-gnupg` The following are not required but may help out * `arch-install-scripts` @@ -13,6 +14,11 @@ The following are not required but may help out * `squashfs-tools` * `pylint` + To install all of the dependencies at once, use + ```bash + sudo apt install -y python3 gir1.2-gtk-3.0 p7zip-full python3-parted python3-gnupg arch-install-scripts coreutils squashfs-tools pylint + ``` + You can find a number of tests to make sure your programs work correctly in the `tests` directory. These are currently tailored to how these programs are written, i.e. they work Python scripts. None of the UI is tested yet. Feel free to write more tests and request their addition in a pull request. All Python code should conform to `PEP8` as closely as possible. If you open a pull request `pep8speaks` will provide feedback on your `PEP8` conformance. From 25089ffb3a657f07ee65acd009402af4c4b8c619 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Wed, 27 Oct 2021 22:09:10 -0400 Subject: [PATCH 042/100] fix bug affecting user setup --- DEBIAN/control | 2 +- usr/bin/system-installer | 2 +- usr/share/system-installer/modules/master.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/DEBIAN/control b/DEBIAN/control index e61ec52a..ce8dc49c 100644 --- a/DEBIAN/control +++ b/DEBIAN/control @@ -1,5 +1,5 @@ Package: system-installer -Version: 2.1.3 +Version: 2.1.4 Maintainer: Thomas Castleman Homepage: https://github.com/drauger-os-development/system-installer Section: admin diff --git a/usr/bin/system-installer b/usr/bin/system-installer index ca08bd99..e2706794 100755 --- a/usr/bin/system-installer +++ b/usr/bin/system-installer @@ -28,7 +28,7 @@ import de_control.disable as de_disable import de_control.enable as de_enable from os import path ARGC = len(argv) -VERSION = "2.1.3" +VERSION = "2.1.4" HELP = """ system-installer, Version %s diff --git a/usr/share/system-installer/modules/master.py b/usr/share/system-installer/modules/master.py index 57c58676..4a730d23 100755 --- a/usr/share/system-installer/modules/master.py +++ b/usr/share/system-installer/modules/master.py @@ -194,16 +194,16 @@ def set_keyboard(MODEL, LAYOUT, VARIENT): subprocess.Popen(["udevadm", "trigger", "--subsystem-match=input", "--action=change"], stdout=stderr.buffer) - def remove_launcher(USER): + def remove_launcher(USERNAME): """Remove system installer desktop launcher""" try: os.remove("/home/live/Desktop/system-installer.desktop") except FileNotFoundError: try: - os.remove("/home/%s/Desktop/system-installer.desktop" % (USER)) + os.remove("/home/%s/Desktop/system-installer.desktop" % (USERNAME)) except FileNotFoundError: try: - rmtree("/home/%s/.config/xfce4/panel/launcher-3" % (USER)) + rmtree("/home/%s/.config/xfce4/panel/launcher-3" % (USERNAME)) except FileNotFoundError: eprint("""Cannot find launcher for system-installer. User will need to remove manually.""") From 5401af47cd375be341856ade2ada1d1b92f97d65 Mon Sep 17 00:00:00 2001 From: SenlisO Date: Thu, 28 Oct 2021 13:10:14 -0400 Subject: [PATCH 043/100] Delete si_utilities.py this functionality is handled by common.py --- usr/share/system-installer/si_utilities.py | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 usr/share/system-installer/si_utilities.py diff --git a/usr/share/system-installer/si_utilities.py b/usr/share/system-installer/si_utilities.py deleted file mode 100644 index 8af35b5c..00000000 --- a/usr/share/system-installer/si_utilities.py +++ /dev/null @@ -1,5 +0,0 @@ -import sys - -def eprint(*args, **kwargs): - """Make it easier for us to print to stderr""" - print(*args, file=sys.stderr, **kwargs) From d331a516e9dd0051184c87bf50d617c74a5c50c4 Mon Sep 17 00:00:00 2001 From: SenlisO Date: Thu, 28 Oct 2021 13:10:53 -0400 Subject: [PATCH 044/100] Delete si-utlilties.py symlink this functionality is handled by common.py --- usr/share/system-installer/UI/si_utilities.py | 1 - 1 file changed, 1 deletion(-) delete mode 120000 usr/share/system-installer/UI/si_utilities.py diff --git a/usr/share/system-installer/UI/si_utilities.py b/usr/share/system-installer/UI/si_utilities.py deleted file mode 120000 index 2a4a46a0..00000000 --- a/usr/share/system-installer/UI/si_utilities.py +++ /dev/null @@ -1 +0,0 @@ -../si_utilities.py \ No newline at end of file From 03df65263d7f3b1bdc6d0e6e139ef56e723b8982 Mon Sep 17 00:00:00 2001 From: SenlisO Date: Thu, 28 Oct 2021 13:12:47 -0400 Subject: [PATCH 045/100] replace si-utilities with common In UI main.py, replaced references to si-utilities with common --- usr/share/system-installer/UI/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr/share/system-installer/UI/main.py b/usr/share/system-installer/UI/main.py index b4ee5908..dc4cb721 100755 --- a/usr/share/system-installer/UI/main.py +++ b/usr/share/system-installer/UI/main.py @@ -27,7 +27,7 @@ import re import json import os -import si_utilities +import common from subprocess import Popen, check_output, DEVNULL import gi gi.require_version('Gtk', '3.0') @@ -216,7 +216,7 @@ def oem_startup(self, widget): def select_config(self, widget): """Quick Install File Selection Window""" - si_utilties.eprint("\t###\tQUICK INSTALL MODE ACTIVATED\t###\t") + common.eprint("\t###\tQUICK INSTALL MODE ACTIVATED\t###\t") dialog = Gtk.FileChooserDialog("System Installer", self, Gtk.FileChooserAction.OPEN, (Gtk.STOCK_CANCEL, From 8f44ecdcdb6fbb71c8aa32b786bfe9393baefcaf Mon Sep 17 00:00:00 2001 From: Richard Romick Date: Thu, 28 Oct 2021 20:12:57 -1000 Subject: [PATCH 046/100] Update roadmap removed si-utilities.py from roadmap --- roadmap.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/roadmap.md b/roadmap.md index 18b3e841..8ba9c37b 100644 --- a/roadmap.md +++ b/roadmap.md @@ -6,11 +6,6 @@ # system-installer -## si-utlities -| Function Name | Pylint | Unit/Doc Tests | Type Hinting | -| --- | --- | --- | --- | -| eprint | | | | - ## auto_partitioner.py | Function Name | Pylint | Unit/Doc Tests | Type Hinting | | --- | --- | --- | --- | From 847dfbafa5bc40f4daf4b196129d6aecfd7903f7 Mon Sep 17 00:00:00 2001 From: Richard Romick Date: Fri, 29 Oct 2021 14:55:24 -0400 Subject: [PATCH 047/100] Update development documentation Added more content to the developer documentation --- development.md | 63 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/development.md b/development.md index 0ca9511f..469f3389 100644 --- a/development.md +++ b/development.md @@ -1,4 +1,4 @@ -# Development Setup and Tools +# Development environment setup The following packages are required in order to do development for `system-installer`. Most of these packages are available in most distributions of Linux and many come pre-installed in some distros. @@ -19,8 +19,67 @@ The following are not required but may help out sudo apt install -y python3 gir1.2-gtk-3.0 p7zip-full python3-parted python3-gnupg arch-install-scripts coreutils squashfs-tools pylint ``` -You can find a number of tests to make sure your programs work correctly in the `tests` directory. These are currently tailored to how these programs are written, i.e. they work Python scripts. None of the UI is tested yet. Feel free to write more tests and request their addition in a pull request. +# How to get started + +Do you know some programming and want to help out, but haven't worked on someone else's codebase before? This section is here for you. These are some recommended steps on how to contribute without diving into specifics. + +1. Create a Github account (if necessary) + * It is strongly recommended to protect your github account with 2FA to protect us from your account being compromized. + * SMS 2FA is not recommended +2. Download and install a git management tool. + * [Gitkraken](https://www.gitkraken.com) is recommended + * The rest of the guide assumes you are using Gitkraken. +3. Go to preferences==>SSH. Generate a new private/public key. +4. Go to Github SSH settings and add your public key. +5. Open the Drauger OS Development repository you want to work on. +6. Click the fork button +7. Go to your repositories, you should now see your forked repository of the Drauger OS repository +8. Click on code ==> SSH and copy the URL provided +9. Go into Gitkraken and clone your forked repository using the SSH URL +10. When viewing your repository in Gitkraken, find the dev branch (remote) and have Gitkraken checkout. You should be checked out to the current dev branch of your repository + * While you are working, changes might be made to the Drauger OS repository you forked. + * If changes affect the files you are working on, you may need to rebase from your repository's page. Be aware that your work may be lost, so backup your working files. + * If you rebase, don't forget to pull from gitkraken. +11. Make the desired changes and commits. +12. Push your commits to your repository as necessary +13. When you are finished making your changes, run through the pre-pull checklist +14. Go to the pull requests section of the Drauger OS repository and generate a pull request + * Even if you have permissions to do so, don't approve pull requests you yourself generate + +# Pre-pull checklist +- [ ] Run pylint +- [ ] Run unit tests +- [ ] Check type hinting +- [ ] Test the code (run the application) + +# Pylint instructions +_more coming soon_ All Python code should conform to `PEP8` as closely as possible. If you open a pull request `pep8speaks` will provide feedback on your `PEP8` conformance. A good rule of thumb is if your Python code gets a score of `7.5` or higher from `pylint`, and works correctly, the chances of having your pull request accepted is fairly high, but no pull request is guaranteed to be accepted. + +# Unit test instructions +_more coming soon_ + +You can find a number of tests to make sure your programs work correctly in the `tests` directory. These are currently tailored to how these programs are written, i.e. they work Python scripts. None of the UI is tested yet. Feel free to write more tests and request their addition in a pull request. + +If, after modifying a function, the unit test fails, fix the issue in the function. Don't modify the unit test unless the functions interface has changed + +# Type hinting instructions +_coming soon_ + +# Recommended coding practices +This section provides standards agreed upon by senior developers. By following these guidelines, you reduce the likelihood the pull request will be returned. + +* Your code should be self documenting (i.e. variable names, function names, etc.) +* Comment where necessary. Assume someone else is going to read your code +* Docstrings will describe how others will interface with your function + * other users should not need to read the code in your function to know how to use it +* Harden your function inputs +* Functions should have high functional cohesion -- doing one thing, and doing it well +* Functions should have loose coupling -- limited connections to other functions and high portability +* Minimize the scopes of variables +* Avoid duplicate code +* When able, prioritize code readability + From 44fdb1f17dc579b76a0c86806c3dc8245397f3c9 Mon Sep 17 00:00:00 2001 From: Richard Romick Date: Sun, 31 Oct 2021 05:57:35 -0400 Subject: [PATCH 048/100] Fixed pylint:lines too long --- usr/share/system-installer/UI/main.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/usr/share/system-installer/UI/main.py b/usr/share/system-installer/UI/main.py index dc4cb721..416fbd55 100755 --- a/usr/share/system-installer/UI/main.py +++ b/usr/share/system-installer/UI/main.py @@ -901,8 +901,8 @@ def make_space_parts(self, widget): for each1 in each["children"]: self.parts.append(each1["name"], "%s, filesystem: %s, size: %sGB" % (each1["name"], - each1["fstype"], - int(auto_partitioner.bytes_to_gb(each1["size"])))) + each1["fstype"], + int(auto_partitioner.bytes_to_gb(each1["size"])))) self.show_all() def confirm_remove_part(self, widget): @@ -1200,7 +1200,8 @@ def onnext4clicked(self, button): self.show_all() return - elif (not os.path.exists(self.efi.get_text()) or (self.efi.get_text() == "")) and os.path.isdir("/sys/firmware/efi"): + elif (not os.path.exists(self.efi.get_text()) or ( + self.efi.get_text() == "")) and os.path.isdir("/sys/firmware/efi"): label = Gtk.Label() label.set_markup(""" What are the mount points for the partitions you wish to be used? @@ -1304,7 +1305,8 @@ def onnext4clicked(self, button): self.show_all() return if ((self.swap.get_text().upper() == "FILE") or (self.swap.get_text() == "")): - if auto_partitioner.size_of_part(self.root.get_text()) < auto_partitioner.get_min_root_size(bytes=False): + if auto_partitioner.size_of_part(self.root.get_text()) < \ + auto_partitioner.get_min_root_size(bytes=False): label = Gtk.Label() label.set_markup(f""" What are the mount points for the partitions you wish to be used? @@ -1325,7 +1327,8 @@ def onnext4clicked(self, button): self.show_all() return else: - if auto_partitioner.size_of_part(self.root.get_text()) < auto_partitioner.get_min_root_size(swap=False, bytes=False): + if auto_partitioner.size_of_part(self.root.get_text()) < \ + auto_partitioner.get_min_root_size(swap=False, bytes=False): label = Gtk.Label() label.set_markup(f""" What are the mount points for the partitions you wish to be used? From 9cfbf60d0d136299c5171f881e76624afbde7a86 Mon Sep 17 00:00:00 2001 From: Richard Romick Date: Sun, 31 Oct 2021 06:05:26 -0400 Subject: [PATCH 049/100] Updated main.py imports --- usr/share/system-installer/UI/main.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/usr/share/system-installer/UI/main.py b/usr/share/system-installer/UI/main.py index 416fbd55..5a7eea40 100755 --- a/usr/share/system-installer/UI/main.py +++ b/usr/share/system-installer/UI/main.py @@ -28,11 +28,17 @@ import json import os import common -from subprocess import Popen, check_output, DEVNULL +import subprocess import gi +import auto_partitioner + gi.require_version('Gtk', '3.0') + from gi.repository import Gtk -import auto_partitioner + + + + def has_special_character(input_string): """Check for special characters""" @@ -545,7 +551,7 @@ def auto_partition(self, button): self.data["AUTO_PART"] = True # Get a list of disks and their capacity - self.devices = json.loads(check_output(["lsblk", "-n", "-i", "--json", + self.devices = json.loads(subprocess.check_output(["lsblk", "-n", "-i", "--json", "-o", "NAME,SIZE,TYPE"]).decode()) self.devices = self.devices["blockdevices"] dev = [] @@ -1382,7 +1388,7 @@ def onnext4clicked(self, button): def opengparted(self, button): """Open GParted""" - Popen("gparted", stdout=DEVNULL, stderr=DEVNULL) + Subprocess.Subprocess.Popen("gparted", stdout=SUBPROCESS.DEVNULL, stderr=SUBPROCESS.DEVNULL) self.data["AUTO_PART"] = False self.input_part("clicked") From 2dfd870f8032d83426c15f70b816b69d9616297b Mon Sep 17 00:00:00 2001 From: Richard Romick Date: Sun, 31 Oct 2021 06:44:19 -0400 Subject: [PATCH 050/100] Consolidate partitioner message The top message in the manual partitioner duplicated code in multiple places. I consolidated it into one function. --- usr/share/system-installer/UI/main.py | 158 +++++++------------------- 1 file changed, 44 insertions(+), 114 deletions(-) diff --git a/usr/share/system-installer/UI/main.py b/usr/share/system-installer/UI/main.py index 5a7eea40..20be4af6 100755 --- a/usr/share/system-installer/UI/main.py +++ b/usr/share/system-installer/UI/main.py @@ -1057,18 +1057,39 @@ def confirm_auto_part(self, button): self.main_menu("clicked") - def input_part(self, button): - """Manual Partitioning Input Window""" - self.clear_window() + def set_up_partitioner_label(self, additional_message = ""): + """prepare top label for display on manual partitioner + + Keyword arguments: + additonal message -- any errors that need to be displayed below original message + Return value: + label -- the top label ready for additional formatting and display + """ label = Gtk.Label() - label.set_markup(""" + + input_string = """ What are the mount points for the partitions you wish to be used? Leave empty the partitions you don't want. / MUST BE USED - """) + """ + + if additional_message != "": + input_string = input_string + "\n " + additional_message + + label.set_markup(input_string) + label.set_justify(Gtk.Justification.LEFT) label = self._set_default_margins(label) + + return label + + + def input_part(self, button): + """Manual Partitioning Input Window""" + self.clear_window() + + label = self.set_up_partitioner_label() self.grid.attach(label, 1, 1, 3, 1) label2 = Gtk.Label() @@ -1148,16 +1169,7 @@ def onnext4clicked(self, button): """Check device paths provided for manual partitioner""" if ((self.root.get_text() == "") or ( self.root.get_text()[0:5] != "/dev/")): - label = Gtk.Label() - label.set_markup(""" - What are the mount points for the partitions you wish to be used? - Leave empty the partitions you don't want. - / MUST BE USED - - / NOT SET - """) - label.set_justify(Gtk.Justification.LEFT) - label = self._set_default_margins(label) + label = self.set_up_partitioner_label("ERROR: / NOT SET") try: self.grid.remove(self.grid.get_child_at(1, 1)) except TypeError: @@ -1167,16 +1179,7 @@ def onnext4clicked(self, button): self.show_all() return elif not os.path.exists(self.root.get_text()): - label = Gtk.Label() - label.set_markup(""" - What are the mount points for the partitions you wish to be used? - Leave empty the partitions you don't want. - / MUST BE USED - - Not a Valid Device on / - """) - label.set_justify(Gtk.Justification.LEFT) - label = self._set_default_margins(label) + label = self.set_up_partitioner_label("ERROR: Not a Valid Device on /") try: self.grid.remove(self.grid.get_child_at(1, 1)) except TypeError: @@ -1187,17 +1190,8 @@ def onnext4clicked(self, button): return elif (((self.efi.get_text() == "") or ( self.efi.get_text()[0:5] != "/dev/")) and os.path.isdir("/sys/firmware/efi")): - label = Gtk.Label() - label.set_markup(""" - What are the mount points for the partitions you wish to be used? - Leave empty the partitions you don't want. - / MUST BE USED - - You are using EFI, therefore an EFI partition - must be set. - """) - label.set_justify(Gtk.Justification.LEFT) - label = self._set_default_margins(label) + label = self.set_up_partitioner_label( + "ERROR: System is running EFI. An EFI partition must be set.") try: self.grid.remove(self.grid.get_child_at(1, 1)) except TypeError: @@ -1209,15 +1203,7 @@ def onnext4clicked(self, button): elif (not os.path.exists(self.efi.get_text()) or ( self.efi.get_text() == "")) and os.path.isdir("/sys/firmware/efi"): label = Gtk.Label() - label.set_markup(""" - What are the mount points for the partitions you wish to be used? - Leave empty the partitions you don't want. - / MUST BE USED - - Not a Valid Device on /boot/efi - """) - label.set_justify(Gtk.Justification.LEFT) - label = self._set_default_margins(label) + label = self.set_up_partitioner_label("ERROR: Not a Valid Device on /boot/efi") try: self.grid.remove(self.grid.get_child_at(1, 1)) except TypeError: @@ -1230,15 +1216,7 @@ def onnext4clicked(self, button): self.home.get_text()[0:5] != "/dev/") and ( self.home.get_text() != "NULL")): label = Gtk.Label() - label.set_markup(""" - What are the mount points for the partitions you wish to be used? - Leave empty the partitions you don't want. - / MUST BE USED - - Please input a valid device path for HOME partition. - """) - label.set_justify(Gtk.Justification.LEFT) - label = self._set_default_margins(label) + label = self.set_up_partitioner_label("ERROR: invalid HOME partition device path") try: self.grid.remove(self.grid.get_child_at(1, 1)) except TypeError: @@ -1250,16 +1228,7 @@ def onnext4clicked(self, button): elif (not os.path.exists(self.home.get_text()) and ( self.home.get_text() != "") and ( self.home.get_text() != "NULL")): - label = Gtk.Label() - label.set_markup(""" - What are the mount points for the partitions you wish to be used? - Leave empty the partitions you don't want. - / MUST BE USED - - Not a Valid Device on /home - """) - label.set_justify(Gtk.Justification.LEFT) - label = self._set_default_margins(label) + label = self.set_up_partitioner_label("ERROR: Not a Valid Device on /home") try: self.grid.remove(self.grid.get_child_at(1, 1)) except TypeError: @@ -1271,17 +1240,8 @@ def onnext4clicked(self, button): elif ((self.swap.get_text() != "") and ( self.swap.get_text()[0:5] != "/dev/") and ( self.swap.get_text().upper() != "FILE")): - label = Gtk.Label() - label.set_markup(""" - What are the mount points for the partitions you wish to be used? - Leave empty the partitions you don't want. - / MUST BE USED - - SWAP must be set to a valid partition path, "FILE", or - left empty. - """) - label.set_justify(Gtk.Justification.LEFT) - label = self._set_default_margins(label) + label = self.set_up_partitioner_label( + "ERROR: SWAP must be set to a valid path, 'FILE', or empty.") try: self.grid.remove(self.grid.get_child_at(1, 1)) except TypeError: @@ -1292,16 +1252,7 @@ def onnext4clicked(self, button): elif (not os.path.exists(self.swap.get_text()) and ( self.swap.get_text().upper() != "FILE") and ( self.swap.get_text() != "")): - label = Gtk.Label() - label.set_markup(""" - What are the mount points for the partitions you wish to be used? - Leave empty the partitions you don't want. - / MUST BE USED - - Not a Valid Device on SWAP - """) - label.set_justify(Gtk.Justification.LEFT) - label = self._set_default_margins(label) + label = self.set_up_partitioner_label("ERROR: Not a Valid Device on SWAP") try: self.grid.remove(self.grid.get_child_at(1, 1)) except TypeError: @@ -1313,17 +1264,11 @@ def onnext4clicked(self, button): if ((self.swap.get_text().upper() == "FILE") or (self.swap.get_text() == "")): if auto_partitioner.size_of_part(self.root.get_text()) < \ auto_partitioner.get_min_root_size(bytes=False): - label = Gtk.Label() - label.set_markup(f""" - What are the mount points for the partitions you wish to be used? - Leave empty the partitions you don't want. - / MUST BE USED - - / is too small. Minimum Root Partition size is { round(auto_partitioner.get_min_root_size(bytes=False)) } GB + label_string = \ + f""" / is too small. Minimum Root Partition size is { round(auto_partitioner.get_min_root_size(bytes=False)) } GB Make a swap partition to reduce this minimum to { round(auto_partitioner.get_min_root_size(swap=False, bytes=False)) } GB - """) - label.set_justify(Gtk.Justification.LEFT) - label = self._set_default_margins(label) + """ + label = self.set_up_partitioner_label(label_string) try: self.grid.remove(self.grid.get_child_at(1, 1)) except TypeError: @@ -1335,16 +1280,8 @@ def onnext4clicked(self, button): else: if auto_partitioner.size_of_part(self.root.get_text()) < \ auto_partitioner.get_min_root_size(swap=False, bytes=False): - label = Gtk.Label() - label.set_markup(f""" - What are the mount points for the partitions you wish to be used? - Leave empty the partitions you don't want. - / MUST BE USED - - / is too small. Minimum Root Partition size is { round(auto_partitioner.get_min_root_size(swap=False, bytes=False)) } GB - """) - label.set_justify(Gtk.Justification.LEFT) - label = self._set_default_margins(label) + label_string = f"/ is too small. Minimum Root Partition size is { round(auto_partitioner.get_min_root_size(swap=False, bytes=False)) } GB" + label = self.set_up_partitioner_label(label_string) try: self.grid.remove(self.grid.get_child_at(1, 1)) except TypeError: @@ -1353,14 +1290,7 @@ def onnext4clicked(self, button): self.show_all() return - label = Gtk.Label() - label.set_markup(""" - What are the mount points for the partitions you wish to be used? - Leave empty the partitions you don't want. - / MUST BE USED - """) - label.set_justify(Gtk.Justification.LEFT) - label = self._set_default_margins(label) + label = self.set_up_partitioner_label() try: self.grid.remove(self.grid.get_child_at(1, 1)) except TypeError: @@ -1388,7 +1318,7 @@ def onnext4clicked(self, button): def opengparted(self, button): """Open GParted""" - Subprocess.Subprocess.Popen("gparted", stdout=SUBPROCESS.DEVNULL, stderr=SUBPROCESS.DEVNULL) + subprocess.Popen("gparted", stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) self.data["AUTO_PART"] = False self.input_part("clicked") From 38e7cd39069572659075548b1652e96e7c7e5d6c Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sun, 31 Oct 2021 21:18:16 -0400 Subject: [PATCH 051/100] better branding support, ensure boot entry is added and default --- DEBIAN/control | 2 +- usr/bin/system-installer | 2 +- usr/share/system-installer/installer.py | 2 +- usr/share/system-installer/modules/master.py | 62 +++++++-------- .../modules/verify_install.py | 78 ++++++++++++++++++- 5 files changed, 110 insertions(+), 36 deletions(-) diff --git a/DEBIAN/control b/DEBIAN/control index ce8dc49c..84486039 100644 --- a/DEBIAN/control +++ b/DEBIAN/control @@ -1,5 +1,5 @@ Package: system-installer -Version: 2.1.4 +Version: 2.1.5 Maintainer: Thomas Castleman Homepage: https://github.com/drauger-os-development/system-installer Section: admin diff --git a/usr/bin/system-installer b/usr/bin/system-installer index e2706794..4e42f931 100755 --- a/usr/bin/system-installer +++ b/usr/bin/system-installer @@ -28,7 +28,7 @@ import de_control.disable as de_disable import de_control.enable as de_enable from os import path ARGC = len(argv) -VERSION = "2.1.4" +VERSION = "2.1.5" HELP = """ system-installer, Version %s diff --git a/usr/share/system-installer/installer.py b/usr/share/system-installer/installer.py index 05a9ed66..46067b52 100755 --- a/usr/share/system-installer/installer.py +++ b/usr/share/system-installer/installer.py @@ -264,7 +264,7 @@ def install(settings, local_repo): shutil.copytree(work_dir + "/assets/" + each, "/mnt/user-data/" + each) real_root = chroot.arch_chroot("/mnt") - modules.master.install(settings) + modules.master.install(settings, config["distro"].replace(" ", "_")) chroot.de_chroot(real_root, "/mnt") common.eprint("Resetting resolv.conf") os.remove("/mnt/etc/resolv.conf") diff --git a/usr/share/system-installer/modules/master.py b/usr/share/system-installer/modules/master.py index 4a730d23..e82aab55 100755 --- a/usr/share/system-installer/modules/master.py +++ b/usr/share/system-installer/modules/master.py @@ -244,12 +244,12 @@ def install_kernel(release): os.chdir("/") -def install_bootloader(efi, root, release): +def install_bootloader(efi, root, release, distro): """Determine whether bootloader needs to be systemd-boot (for UEFI) or GRUB (for BIOS) and install the correct one.""" if efi not in ("NULL", None, "", False): - _install_systemd_boot(release, root) + _install_systemd_boot(release, root, distro) else: _install_grub(root) @@ -275,7 +275,7 @@ def _install_grub(root): stdout=stderr.buffer) -def _install_systemd_boot(release, root): +def _install_systemd_boot(release, root, distro): """set up and install systemd-boot""" try: os.mkdir("/boot/efi") @@ -283,7 +283,7 @@ def _install_systemd_boot(release, root): pass os.mkdir("/boot/efi/loader") os.mkdir("/boot/efi/loader/entries") - os.mkdir("/boot/efi/Drauger_OS") + os.mkdir(f"/boot/efi/{distro}" ) os.environ["SYSTEMD_RELAX_ESP_CHECKS"] = "1" with open("/etc/environment", "a") as envi: envi.write("export SYSTEMD_RELAX_ESP_CHECKS=1") @@ -321,7 +321,7 @@ def _install_systemd_boot(release, root): except FileExistsError: pass with open("/boot/efi/loader/loader.conf", "w+") as loader_conf: - loader_conf.write("default Drauger_OS\n") + loader_conf.write(f"default {distro}\n") loader_conf.write("timeout 5\nconsole-mode 1\neditor 1") try: subprocess.check_call(["chattr", "-i", "/boot/efi/loader/loader.conf"], @@ -357,13 +357,13 @@ def _install_systemd_boot(release, root): # This lib didn't exist before we installed this package. # So we can only now import it import systemd_boot_manager - systemd_boot_manager.update_defaults_file(systemd_boot_manager.DISTRO + ".conf") + systemd_boot_manager.update_defaults_file(distro + ".conf") subprocess.check_call(["systemd-boot-manager", "-u"], stdout=stderr.buffer) - check_systemd_boot(release, root) + check_systemd_boot(release, root, distro) -def setup_lowlevel(efi, root): +def setup_lowlevel(efi, root, distro): """Set up kernel and bootloader""" release = subprocess.check_output(["uname", "--release"]).decode()[0:-1] install_kernel(release) @@ -372,13 +372,13 @@ def setup_lowlevel(efi, root): eprint("\n ### MAKING INITRAMFS ### ") subprocess.check_call(["mkinitramfs", "-o", "/boot/initrd.img-" + release], stdout=stderr.buffer) - install_bootloader(efi, root, release) + install_bootloader(efi, root, release, distro) sleep(0.5) os.symlink("/boot/initrd.img-" + release, "/boot/initrd.img") os.symlink("/boot/vmlinuz-" + release, "/boot/vmlinuz") -def check_systemd_boot(release, root): +def check_systemd_boot(release, root, distro): """Ensure systemd-boot was configured correctly""" # Initialize variables root_flags = "quiet splash" @@ -388,15 +388,15 @@ def check_systemd_boot(release, root): "-o", "value", root]).decode()[0:-1] # Check for standard boot config - if not os.path.exists("/boot/efi/loader/entries/Drauger_OS.conf"): + if not os.path.exists(f"/boot/efi/loader/entries/{distro}.conf"): # Write standard boot conf if it doesn't exist eprint("Standard Systemd-boot entry non-existant") try: - with open("/boot/efi/loader/entries/Drauger_OS.conf", + with open(f"/boot/efi/loader/entries/{distro}.conf", "w+") as main_conf: - main_conf.write("""title Drauger OS -linux /Drauger_OS/vmlinuz -initrd /Drauger_OS/initrd.img + main_conf.write(f"""title {distro} +linux /{distro}/vmlinuz +initrd /{distro}/initrd.img options root=PARTUUID=%s %s""" % (uuid, root_flags)) eprint("Made standard systemd-boot entry") # Raise an exception if we cannot write the entry @@ -406,15 +406,15 @@ def check_systemd_boot(release, root): else: eprint("Standard systemd-boot entry checks out") # Check for recovery boot config - if not os.path.exists("/boot/efi/loader/entries/Drauger_OS_Recovery.conf"): + if not os.path.exists(f"/boot/efi/loader/entries/{distro}_Recovery.conf"): eprint("Recovery Systemd-boot entry non-existant") try: # Write recovery boot conf if it doesn't exist - with open("/boot/efi/loader/entries/Drauger_OS_Recovery.conf", + with open(f"/boot/efi/loader/entries/{distro}_Recovery.conf", "w+") as main_conf: - main_conf.write("""title Drauger OS Recovery -linux /Drauger_OS/vmlinuz -initrd /Drauger_OS/initrd.img + main_conf.write(f"""title {distro}_Recovery +linux /{distro}/vmlinuz +initrd /{distro}/initrd.img options root=PARTUUID=%s %s""" % (uuid, recovery_flags)) eprint("Made recovery systemd-boot entry") # Raise a warning if we cannot write the entry @@ -449,27 +449,27 @@ def check_systemd_boot(release, root): sysmap = sorted(sysmap)[-1] # Copy the latest files into place # Also, rename them so that systemd-boot can find them - if not os.path.exists("/boot/efi/Drauger_OS/vmlinuz"): + if not os.path.exists(f"/boot/efi/{distro}/vmlinuz"): eprint("vmlinuz non-existant") - copyfile("/boot/" + vmlinuz, "/boot/efi/Drauger_OS/vmlinuz") + copyfile("/boot/" + vmlinuz, f"/boot/efi/{distro}/vmlinuz") eprint("vmlinuz copied") else: eprint("vmlinuz checks out") - if not os.path.exists("/boot/efi/Drauger_OS/config"): + if not os.path.exists(f"/boot/efi/{distro}/config"): eprint("config non-existant") - copyfile("/boot/" + config, "/boot/efi/Drauger_OS/config") + copyfile("/boot/" + config, f"/boot/efi/{distro}/config") eprint("config copied") else: eprint("Config checks out") - if not os.path.exists("/boot/efi/Drauger_OS/initrd.img"): + if not os.path.exists(f"/boot/efi/{distro}/initrd.img"): eprint("initrd.img non-existant") - copyfile("/boot/" + initrd, "/boot/efi/Drauger_OS/initrd.img") + copyfile("/boot/" + initrd, f"/boot/efi/{distro}/initrd.img") eprint("initrd.img copied") else: eprint("initrd.img checks out") - if not os.path.exists("/boot/efi/Drauger_OS/System.map"): + if not os.path.exists(f"/boot/efi/{distro}/System.map"): eprint("System.map non-existant") - copyfile("/boot/" + sysmap, "/boot/efi/Drauger_OS/System.map") + copyfile("/boot/" + sysmap, f"/boot/efi/{distro}/System.map") eprint("System.map copied") else: eprint("System.map checks out") @@ -494,7 +494,7 @@ def handle_laptops(username): de_modify.for_laptop() -def install(settings): +def install(settings, distro): """Entry point for installation procedure""" processes_to_do = dir(MainInstallation) for each in range(len(processes_to_do) - 1, -1, -1): @@ -502,8 +502,8 @@ def install(settings): del processes_to_do[each] MainInstallation(processes_to_do, settings) handle_laptops(settings["USERNAME"]) - setup_lowlevel(settings["EFI"], settings["ROOT"]) - verify(settings["USERNAME"]) + setup_lowlevel(settings["EFI"], settings["ROOT"], distro) + verify(settings["USERNAME"], settings["ROOT"], distro) if "PURGE" in settings: purge_package(settings["PURGE"]) # Mark a system as an OEM installation if necessary diff --git a/usr/share/system-installer/modules/verify_install.py b/usr/share/system-installer/modules/verify_install.py index 70de0a35..88221d0c 100755 --- a/usr/share/system-installer/modules/verify_install.py +++ b/usr/share/system-installer/modules/verify_install.py @@ -3,7 +3,7 @@ # # verify_install.py # -# Copyright 2020 Thomas Castleman +# Copyright 2021 Thomas Castleman # # 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 @@ -26,6 +26,7 @@ from sys import stderr from os import path, remove from shutil import move +import subprocess import apt import modules.purge as purge @@ -36,7 +37,75 @@ def __eprint__(*args, **kwargs): print(*args, file=stderr, **kwargs) -def verify(username): +def add_boot_entry(root, distro): + """Add the necessary boot entry""" + if "nvme" in root: + disk = root[:12] + part = root[13:] + else: + disk = root[:8] + part = root[8:] + + subprocess.check_call(["efibootmgr", "--create", "--disk", disk, "--part", + part, "--loader", "\EFI\systemd\systemd-bootx64.efi", + "--label", distro], stdout=stderr.buffer, + stderr=stderr.buffer) + + +def set_default_entry(distro): + """Set default boot entry""" + entries = subprocess.check_output(["efibootmgr"]).decode().split("\n") + entries = [each.split(" ") for each in entries] + del entries[0] + del entries[0] + del entries[-1] + for each in enumerate(entries): + entries[each[0]][1] = " ".join(entries[each[0]][1:]) + if len(entries[each[0]]) > 2: + del entries[each[0]][2:] + entries[each[0]][0] = entries[each[0]][0][4:-1] + entries[0][1] = entries[0][1].split(",") + code = "" + for each in entries[1:]: + if each[1] in ("UEFI OS", "Linux Boot Manager", distro): + code = each[0] + break + del entries[0][1][entries[0][1].index(code)] + entries[0][1].insert(0, code) + order = ",".join(entries[0][1]) + # clean up a bit + del entries, code + subprocess.check_call(["efibootmgr", "-o", order]) + + +def is_default_entry(distro): + """Check if we are the default boot entry""" + entries = subprocess.check_output(["efibootmgr"]).decode().split("\n") + entries = [each.split(" ") for each in entries] + del entries[0] + del entries[0] + del entries[-1] + for each in enumerate(entries): + entries[each[0]][1] = " ".join(entries[each[0]][1:]) + if len(entries[each[0]]) > 2: + del entries[each[0]][2:] + entries[each[0]][0] = entries[each[0]][0][4:-1] + entries[0][1] = entries[0][1].split(",") + code = entries[0][1][0] + # we need to check if the entry is set as default + for each in entries[1:]: + if each[0] == code: + if each[1] in ("UEFI OS", "Linux Boot Manager", distro): + return True + # we know it's not default. Check if it exists + for each in entries[1:]: + if (("UEFI OS" in each) or ("Linux Boot Manager" in each) or (distro in each)): + return False + # it is non-existant + return None + + +def verify(username, root, distro): """Verify installation success""" __eprint__(" ### verify_install.py STARTED ### ") cache = apt.cache.Cache() @@ -58,4 +127,9 @@ def verify(username): except FileNotFoundError: pass cache.close() + status = is_default_entry(distro) + if status in (False, None): + if status is None: + add_boot_entry(root, distro) + set_default_entry(disto) __eprint__(" ### verify_install.py CLOSED ### ") From 35d24faed9f2b1c83671cb8f12789d0104b415bd Mon Sep 17 00:00:00 2001 From: Richard Romick Date: Thu, 18 Nov 2021 05:16:32 -0500 Subject: [PATCH 052/100] Fix auto_partitioner bug Fixed issue where variable self.device was referenced instead of self.devices --- usr/share/system-installer/UI/main.py | 49 ++++++++++++++------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/usr/share/system-installer/UI/main.py b/usr/share/system-installer/UI/main.py index 20be4af6..cbd3aeb1 100755 --- a/usr/share/system-installer/UI/main.py +++ b/usr/share/system-installer/UI/main.py @@ -31,6 +31,7 @@ import subprocess import gi import auto_partitioner +import pdb gi.require_version('Gtk', '3.0') @@ -975,33 +976,33 @@ def auto_home_setup(self, widget): def auto_home_setup2(self, widget): """Provide options for prexisting home partitions""" if widget.get_active() == 1: - dev = [] - for each5 in enumerate(self.device): - if ("loop" in self.device[each5[0]]) or ("disk" in self.device[each5[0]]): + dev_list = [] # dev_list will be an list of dictionaries + for each5 in enumerate(self.devices): + if ("loop" in self.devices[each5[0]]) or ("disk" in self.devices[each5[0]]): continue - dev.append(self.device[each5[0]]) - devices = [] - for each5 in dev: - devices.append(each5.split()) - devices = [x for x in devices if x != []] - for each5 in devices: - if each5[0] == "sr0": - devices.remove(each5) - for each5 in enumerate(devices): - devices[each5[0]].remove(devices[each5[0]][2]) - for each5 in enumerate(devices): - devices[each5[0]][0] = list(devices[each5[0]][0]) - del devices[each5[0]][0][0] - del devices[each5[0]][0][0] - devices[each5[0]][0] = "".join(devices[each5[0]][0]) - for each5 in enumerate(devices): - devices[each5[0]][0] = "/dev/%s" % ("".join(devices[each5[0]][0])) + dev_list.append(self.devices[each5[0]]) + + dev_list = [x for x in dev_list if x != []] #removes empty indexes + + for i in range(len(dev_list)): # iterate numerically through the dev_list indexes + if dev_list[i - 1]['name'] == "sr0": + del dev_list[i - 1] + + for each5 in enumerate(dev_list): + dev_list[each5[0]].remove(dev_list[each5[0]][2]) + for each5 in enumerate(dev_list): + dev_list[each5[0]][0] = list(dev_list[each5[0]][0]) + del dev_list[each5[0]][0][0] + del dev_list[each5[0]][0][0] + dev_list[each5[0]][0] = "".join(dev_list[each5[0]][0]) + for each5 in enumerate(dev_list): + dev_list[each5[0]][0] = "/dev/%s" % ("".join(dev_list[each5[0]][0])) parts = Gtk.ComboBoxText.new() - for each5 in enumerate(devices): - parts.append("%s" % (devices[each5[0]][0]), - "%s Size: %s" % (devices[each5[0]][0], - devices[each5[0]][1])) + for each5 in enumerate(dev_list): + parts.append("%s" % (dev_list[each5[0]][0]), + "%s Size: %s" % (dev_list[each5[0]][0], + dev_list[each5[0]][1])) if self.data["HOME"] != "": parts.set_active_id(self.data["HOME"]) parts.connect("changed", self.select_home_part) From bb3e28bd5d06d403da19184ed81dd75041b0b2a2 Mon Sep 17 00:00:00 2001 From: Richard Romick Date: Fri, 19 Nov 2021 18:11:14 -0500 Subject: [PATCH 053/100] Finish fixing auto_partitioner bug still needs testing/validation and bug fixes if required --- usr/share/system-installer/UI/main.py | 71 +++++++++++++++------------ 1 file changed, 40 insertions(+), 31 deletions(-) diff --git a/usr/share/system-installer/UI/main.py b/usr/share/system-installer/UI/main.py index cbd3aeb1..18258f4b 100755 --- a/usr/share/system-installer/UI/main.py +++ b/usr/share/system-installer/UI/main.py @@ -976,38 +976,47 @@ def auto_home_setup(self, widget): def auto_home_setup2(self, widget): """Provide options for prexisting home partitions""" if widget.get_active() == 1: - dev_list = [] # dev_list will be an list of dictionaries - for each5 in enumerate(self.devices): - if ("loop" in self.devices[each5[0]]) or ("disk" in self.devices[each5[0]]): - continue - dev_list.append(self.devices[each5[0]]) - - dev_list = [x for x in dev_list if x != []] #removes empty indexes - - for i in range(len(dev_list)): # iterate numerically through the dev_list indexes - if dev_list[i - 1]['name'] == "sr0": - del dev_list[i - 1] - - for each5 in enumerate(dev_list): - dev_list[each5[0]].remove(dev_list[each5[0]][2]) - for each5 in enumerate(dev_list): - dev_list[each5[0]][0] = list(dev_list[each5[0]][0]) - del dev_list[each5[0]][0][0] - del dev_list[each5[0]][0][0] - dev_list[each5[0]][0] = "".join(dev_list[each5[0]][0]) - for each5 in enumerate(dev_list): - dev_list[each5[0]][0] = "/dev/%s" % ("".join(dev_list[each5[0]][0])) - - parts = Gtk.ComboBoxText.new() - for each5 in enumerate(dev_list): - parts.append("%s" % (dev_list[each5[0]][0]), - "%s Size: %s" % (dev_list[each5[0]][0], - dev_list[each5[0]][1])) + dev_list = tuple(self.devices) + new_dev_list = [] # this will be the final list that is displayed for the user + + for device in dev_list: # we will iterate through the dev list and add devices to the new list + try: + if device == []: # if the device is empty, we skip + continue + if device['name'] == "sr0": # skip sr0 devices + continue + elif 'type' in device: # device should have type or children in it + if device['type'] == "loop" or device['type'] == "disk": # skip loop devices (created by snap packages) + continue + elif 'children' in device: + for child in device['children']: + test_child = {'name' : child['name'], 'size' : child['size']} + + if test_child not in new_dev_list: # make sure child object is not already in dev_list + new_dev_list.append(test_child) + else: + new_device = {'name' : device['name'], 'size' : device['size']} + + new_dev_list.append(new_device) + except KeyError: + pass # todo: use traceback module to print the traceback to stderr + # can print to file. Look up printing tracebacks from an exception + + # todo: should parent objects be included in the list? + + home_cmbbox = Gtk.ComboBoxText.new() + + # properly format device names and add to combo box + for device in new_dev_list: + device['name'] = "/dev/%s" % device['name'] + + home_cmbbox.append(device['name'], "%s Size: %s" % (device['name'], device['size'])) + if self.data["HOME"] != "": - parts.set_active_id(self.data["HOME"]) - parts.connect("changed", self.select_home_part) - parts = self._set_default_margins(parts) - self.grid.attach(parts, 1, 5, 2, 1) + home_cmbbox.set_active_id(self.data["HOME"]) + home_cmbbox.connect("changed", self.select_home_part) + parts = self._set_default_margins(home_cmbbox) + self.grid.attach(home_cmbbox, 1, 5, 2, 1) else: self.data["HOME"] = "MAKE" From 85035b93b1c5fe86937ea98af685893eb1eb75a7 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Fri, 26 Nov 2021 17:25:10 -0500 Subject: [PATCH 054/100] Fix #52 --- usr/share/system-installer/modules/master.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/usr/share/system-installer/modules/master.py b/usr/share/system-installer/modules/master.py index e82aab55..f92684b3 100755 --- a/usr/share/system-installer/modules/master.py +++ b/usr/share/system-installer/modules/master.py @@ -35,6 +35,7 @@ import json import warnings import tarfile as tar +import traceback import de_control.modify as de_modify @@ -267,10 +268,22 @@ def _install_grub(root): if root[-1] == "p": del root[-1] root = "".join(root) - subprocess.check_call(["grub-mkdevicemap", "--verbose"], - stdout=stderr.buffer) + redo = False + try: + subprocess.check_call(["grub-mkdevicemap", "--verbose"], + stdout=stderr.buffer) + except CalledProcessError: + redo = True subprocess.check_call(["grub-install", "--verbose", "--force", "--target=i386-pc", root], stdout=stderr.buffer) + if redo: + try: + subprocess.check_call(["grub-mkdevicemap", "--verbose"], + stdout=stderr.buffer) + except CalledProcessError as e: + eprint("WARNING: GRUB device map failed to generate") + eprint("The error was as follows:") + eprint(traceback.format_exeception()) subprocess.check_call(["grub-mkconfig", "-o", "/boot/grub/grub.cfg"], stdout=stderr.buffer) From 5439831b77f94911a97bebf4387fc9aed82fa03e Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Wed, 1 Dec 2021 23:58:35 -0500 Subject: [PATCH 055/100] make sure commands exist when needed --- DEBIAN/control | 2 +- usr/bin/system-installer | 2 +- .../modules/verify_install.py | 24 +++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/DEBIAN/control b/DEBIAN/control index 84486039..60070d33 100644 --- a/DEBIAN/control +++ b/DEBIAN/control @@ -1,5 +1,5 @@ Package: system-installer -Version: 2.1.5 +Version: 2.1.6 Maintainer: Thomas Castleman Homepage: https://github.com/drauger-os-development/system-installer Section: admin diff --git a/usr/bin/system-installer b/usr/bin/system-installer index 4e42f931..f18f289c 100755 --- a/usr/bin/system-installer +++ b/usr/bin/system-installer @@ -28,7 +28,7 @@ import de_control.disable as de_disable import de_control.enable as de_enable from os import path ARGC = len(argv) -VERSION = "2.1.5" +VERSION = "2.1.6" HELP = """ system-installer, Version %s diff --git a/usr/share/system-installer/modules/verify_install.py b/usr/share/system-installer/modules/verify_install.py index 88221d0c..6670b295 100755 --- a/usr/share/system-installer/modules/verify_install.py +++ b/usr/share/system-installer/modules/verify_install.py @@ -108,18 +108,6 @@ def is_default_entry(distro): def verify(username, root, distro): """Verify installation success""" __eprint__(" ### verify_install.py STARTED ### ") - cache = apt.cache.Cache() - cache.open() - if username != "drauger-user": - if (("system-installer" in cache) and cache["system-installer"].is_installed): - cache["system-installer"].mark_delete() - if path.isfile("/etc/kernel/postinst.d/zz-update-systemd-boot"): - with cache.actiongroup(): - for each in cache: - if (("grub" in each.name) and each.is_installed): - each.mark_delete() - cache.commit() - purge.autoremove(cache) if path.isdir("/home/home/live"): move("/home/home/live", "/home/" + username) try: @@ -132,4 +120,16 @@ def verify(username, root, distro): if status is None: add_boot_entry(root, distro) set_default_entry(disto) + cache = apt.cache.Cache() + cache.open() + if username != "drauger-user": + if (("system-installer" in cache) and cache["system-installer"].is_installed): + cache["system-installer"].mark_delete() + if path.isfile("/etc/kernel/postinst.d/zz-update-systemd-boot"): + with cache.actiongroup(): + for each in cache: + if (("grub" in each.name) and each.is_installed): + each.mark_delete() + cache.commit() + purge.autoremove(cache) __eprint__(" ### verify_install.py CLOSED ### ") From ffc8f2833b334c6901336f20bd17db3b426dea4a Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Thu, 2 Dec 2021 00:32:36 -0500 Subject: [PATCH 056/100] fix UnboundLocalError --- usr/share/system-installer/modules/verify_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/share/system-installer/modules/verify_install.py b/usr/share/system-installer/modules/verify_install.py index 6670b295..b11086c2 100755 --- a/usr/share/system-installer/modules/verify_install.py +++ b/usr/share/system-installer/modules/verify_install.py @@ -114,7 +114,6 @@ def verify(username, root, distro): remove("/home/" + username + "/Desktop/system-installer.desktop") except FileNotFoundError: pass - cache.close() status = is_default_entry(distro) if status in (False, None): if status is None: @@ -132,4 +131,5 @@ def verify(username, root, distro): each.mark_delete() cache.commit() purge.autoremove(cache) + cache.close() __eprint__(" ### verify_install.py CLOSED ### ") From ad0e612f1757ddba11ef4e1f6696a726079d022f Mon Sep 17 00:00:00 2001 From: Richard Romick Date: Sat, 1 Jan 2022 21:53:12 -0500 Subject: [PATCH 057/100] Fix existing home partition partition list Removed empty drives from the list and simplified the logic of choosing what devices end up on the list. --- usr/share/system-installer/UI/main.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/usr/share/system-installer/UI/main.py b/usr/share/system-installer/UI/main.py index 18258f4b..9d42fa7e 100755 --- a/usr/share/system-installer/UI/main.py +++ b/usr/share/system-installer/UI/main.py @@ -979,21 +979,23 @@ def auto_home_setup2(self, widget): dev_list = tuple(self.devices) new_dev_list = [] # this will be the final list that is displayed for the user + pdb.set_trace() + for device in dev_list: # we will iterate through the dev list and add devices to the new list try: if device == []: # if the device is empty, we skip continue - if device['name'] == "sr0": # skip sr0 devices - continue - elif 'type' in device: # device should have type or children in it - if device['type'] == "loop" or device['type'] == "disk": # skip loop devices (created by snap packages) - continue elif 'children' in device: for child in device['children']: + if not child['type'] == 'part': # if it isn't labeled partition, skip + continue + test_child = {'name' : child['name'], 'size' : child['size']} if test_child not in new_dev_list: # make sure child object is not already in dev_list new_dev_list.append(test_child) + elif not device['type'] == 'part': # if it isn't labeled partition, skip + continue else: new_device = {'name' : device['name'], 'size' : device['size']} @@ -1006,6 +1008,8 @@ def auto_home_setup2(self, widget): home_cmbbox = Gtk.ComboBoxText.new() + pdb.set_trace() + # properly format device names and add to combo box for device in new_dev_list: device['name'] = "/dev/%s" % device['name'] From 00e2b773abd0470b288109422dfc710fe6976141 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sun, 2 Jan 2022 01:45:54 -0500 Subject: [PATCH 058/100] Initial work converting to C++ This is going to be a LONG, arduous process. So start with the easy stuff now. --- DEBIAN/control | 4 +- build.sh | 9 + usr/bin/system-installer.cxx | 169 ++++++++++++++++++ .../{system-installer => system-installer.py} | 0 4 files changed, 180 insertions(+), 2 deletions(-) create mode 100644 usr/bin/system-installer.cxx rename usr/bin/{system-installer => system-installer.py} (100%) diff --git a/DEBIAN/control b/DEBIAN/control index 60070d33..56ba3e87 100644 --- a/DEBIAN/control +++ b/DEBIAN/control @@ -1,9 +1,9 @@ Package: system-installer -Version: 2.1.6 +Version: 2.1.7 Maintainer: Thomas Castleman Homepage: https://github.com/drauger-os-development/system-installer Section: admin -Architecture: all +Architecture: amd64 Priority: important Depends: arch-install-scripts, python3 (>=3.6.7-1~18.04), bash, gir1.2-gtk-3.0 (>=3.24.12-1ubuntu1), coreutils (>=8.28-1ubuntu1), apt (>=1.6.11), squashfs-tools (>=1:4.3-6ubuntu0.18.04.1), zenity (>=3.28.1-1), grub2-common (>=2.02-2ubuntu8.13), initramfs-tools (>=0.130ubuntu3.8), systemd (>=237-3ubuntu10.24), locales (>=2.27-3ubuntu1), procps (>=2:3.3.12-3ubuntu1.1), grep (>=3.1-2), keyboard-configuration, util-linux (>=2.34-0.1ubuntu2), python3-parted (>=3.11.2), python3-psutil (>=5.5.0), python3-apt (>=2.0.0), python3-pycurl, python3-gnupg (>=0.4.5), python3-xmltodict (>=0.11.0) Description: System Installer for Drauger OS diff --git a/build.sh b/build.sh index 122b17e9..1974fdd5 100755 --- a/build.sh +++ b/build.sh @@ -52,6 +52,11 @@ if [ "$OPTIONS" != "--pool" ]; then rm -rfv kernel cd ../../../.. fi + +# Pshyc - we're compiling shit now +cd usr/bin +g++ -o system-installer system-installer.cxx $(python3.9-config --ldflags --cflags --embed) +cd ../.. ############################################################## # # # # @@ -106,6 +111,10 @@ cd .. if [ "$OPTIONS" != "--pool" ]; then rm system-installer/usr/share/system-installer/modules/kernel.tar.xz fi +# delete binary file from repo +rm "$base"/usr/bin/system-installer +# delete C++ source from package +rm "$FOLDER"/usr/bin/system-installer.cxx #build the shit dpkg-deb --build "$FOLDER" rm -rf "$FOLDER" diff --git a/usr/bin/system-installer.cxx b/usr/bin/system-installer.cxx new file mode 100644 index 00000000..169ef705 --- /dev/null +++ b/usr/bin/system-installer.cxx @@ -0,0 +1,169 @@ +/* + * system-installer.cxx + * + * Copyright 2021 Thomas Castleman + * + * 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. + * + * + */ + + //define macros +#define elif else if +#define str string +#define str_list vector +#define int_list vector +#define float_list vector +#define bool_list vector +#define PY_SSIZE_T_CLEAN + + // import libs + #include + #include + // #include + // #include + // #include + #include + // #include + // #include + // #include + #include + #include + // #include + +using namespace std; + +str VERSION = "2.1.6"; +str R = "\033[0;31m"; +str G = "\033[0;32m"; +str Y = "\033[1;33m"; +str NC = "\033[0m"; +str HELP = "\n" +"system-installer, Version " + VERSION + "\n" +"\n" +"\t-h, --help print this help dialoge.\n" +"\t --boot-time launch system-installer in boot-time mode.\n" +"\t-v, --version print current version.\n" +"\n" +"Pass nothing to start installer.\n"; + +wchar_t* Py_Init() +{ + wchar_t *program = Py_DecodeLocale("system-installer", NULL); + Py_SetProgramName(program); + Py_Initialize(); + return program; +} + +str run(const char* cmd) { + char buffer[128]; + str result = ""; + FILE* pipe = popen(cmd, "r"); + if (!pipe) throw std::runtime_error("popen() failed!"); + try { + while (fgets(buffer, sizeof buffer, pipe) != NULL) + { + result += buffer; + } + } + catch (...) { + pclose(pipe); + throw; + } + pclose(pipe); + return result; +} + + +// Launch with boot time parameter +void launch(bool boot_time) +{ + str command1 = "/usr/bin/xhost"; + str enable = " +si:localuser:root"; + str disable = " -si:localuser:root"; + str command = "echo 'toor' | sudo -S /usr/share/system-installer/engine.py"; + run((command1 + enable).c_str()); + cout << Y << "RUNNING LOG LOCATED AT /tmp/system-installer.log" << NC << endl; + wchar_t *program = Py_Init(); + if (boot_time) + { + + PyRun_SimpleString("import de_control.enable as de_enable\n" + "de_enable.immersion()\n"); + FILE* file = fopen("/tmp/system-installer.log", "w"); + if (file != NULL) + { + fputs("STARTING IN BOOT-TIME MODE\n", file); + fclose(file); + } + else + { + cerr << "Failed to write to log file!" << endl; + } + command = command + " --boot-time"; + } + command = command + " 2>/tmp/system-installer.log 1>&2"; + system(command.c_str()); + if (boot_time) + { + PyRun_SimpleString("import de_control.disable as de_disable\n" + "de_disable.immersion()\n"); + if (Py_FinalizeEx() < 0) + { + exit(120); + } + PyMem_RawFree(program); + } + + system((command1 + disable).c_str()); +} + +// Launch with no parameter +void launch() +{ + launch(false); +} + + +int main(int argc, char **argv) +{ + if (argc > 1) + { + str arg = argv[1]; + if ((arg == "-v") || (arg == "--version")) + { + cout << "\n" << VERSION << "\n" << endl; + } + elif ((arg == "-h") || (arg == "--help")) + { + cout << HELP << endl; + } + elif (arg == "--boot-time") + { + launch(true); + } + else + { + cerr << "Option " << arg << " not recognized." << endl; + cerr << HELP << endl; + } + } + else + { + launch(); + } + return 0; +} diff --git a/usr/bin/system-installer b/usr/bin/system-installer.py similarity index 100% rename from usr/bin/system-installer rename to usr/bin/system-installer.py From 0470c812c45f4e30bd348431ed9a6238d782f335 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sun, 2 Jan 2022 12:05:37 -0500 Subject: [PATCH 059/100] fix build issue --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 1974fdd5..dd964556 100755 --- a/build.sh +++ b/build.sh @@ -105,7 +105,7 @@ cd usr/share/doc/$PAK tar --verbose --create --xz -f changelog.gz changelog 1>/dev/null rm changelog cd ../../../.. -base="$pwd" +base="$PWD" cd .. #DELETE STUFF HERE if [ "$OPTIONS" != "--pool" ]; then From 8bd92f5fc09b9e1d5b89d45361b41e4b3ea647f3 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sun, 2 Jan 2022 13:46:43 -0500 Subject: [PATCH 060/100] full switch over to C++ PATH binary --- DEBIAN/control | 2 +- usr/bin/system-installer.cxx | 7 ++- usr/bin/system-installer.py | 94 ------------------------------------ 3 files changed, 4 insertions(+), 99 deletions(-) delete mode 100755 usr/bin/system-installer.py diff --git a/DEBIAN/control b/DEBIAN/control index 56ba3e87..69d7c2a4 100644 --- a/DEBIAN/control +++ b/DEBIAN/control @@ -1,5 +1,5 @@ Package: system-installer -Version: 2.1.7 +Version: 2.1.8 Maintainer: Thomas Castleman Homepage: https://github.com/drauger-os-development/system-installer Section: admin diff --git a/usr/bin/system-installer.cxx b/usr/bin/system-installer.cxx index 169ef705..22273b0d 100644 --- a/usr/bin/system-installer.cxx +++ b/usr/bin/system-installer.cxx @@ -46,7 +46,7 @@ using namespace std; -str VERSION = "2.1.6"; +str VERSION = "2.1.8"; str R = "\033[0;31m"; str G = "\033[0;32m"; str Y = "\033[1;33m"; @@ -116,7 +116,7 @@ void launch(bool boot_time) command = command + " --boot-time"; } command = command + " 2>/tmp/system-installer.log 1>&2"; - system(command.c_str()); + run(command.c_str()); if (boot_time) { PyRun_SimpleString("import de_control.disable as de_disable\n" @@ -127,8 +127,7 @@ void launch(bool boot_time) } PyMem_RawFree(program); } - - system((command1 + disable).c_str()); + run((command1 + disable).c_str()); } // Launch with no parameter diff --git a/usr/bin/system-installer.py b/usr/bin/system-installer.py deleted file mode 100755 index f18f289c..00000000 --- a/usr/bin/system-installer.py +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# system-installer -# -# Copyright 2021 Thomas Castleman -# -# 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. -# -# -"""Command line executable for System Installer""" -from sys import argv, stderr -import subprocess -import de_control.disable as de_disable -import de_control.enable as de_enable -from os import path -ARGC = len(argv) -VERSION = "2.1.6" -HELP = """ -system-installer, Version %s - -\t-h, --help print this help dialoge. -\t --boot-time launch system-installer in boot-time mode. -\t-v, --version print current version. - -Pass nothing to start installer. -""" -R = "\033[0;31m" -G = "\033[0;32m" -Y = "\033[1;33m" -NC = "\033[0m" - -def eprint(args, *kwargs, color=R): - """Print to stderr easier""" - print(color, file=stderr, end="") - print(args, file=stderr, *kwargs, end="") - print(NC, file=stderr) - - -def launch(boot_time=False): - """Launch system-isntaller""" - command1 = ["/usr/bin/xhost"] - enable = ["+si:localuser:root"] - disable = ["-si:localuser:root"] - subprocess.check_call(command1 + enable) - print(Y + "RUNNING LOG LOCATED AT /tmp/system-installer.log" + NC) - command = ["echo 'toor' | sudo -S /usr/share/system-installer/engine.py", - "2>/tmp/system-installer.log 1>&2"] - if boot_time: - with open("/tmp/system-installer.log", "w+") as log_file: - log_file.write("STARTING IN BOOT-TIME MODE") - command.insert(1, "--boot-time") - de_enable.immersion() - - command = " ".join(command) - try: - exit_code = subprocess.check_call(command, shell=True) - except subprocess.CalledProcessError: - # Assume the worst - exit_code = 256 - if boot_time: - de_disable.immersion() - if ((exit_code == 256) and (not path.exists("/tmp/system-installer.log"))): - eprint("Error accessing /usr/share/system-installer/engine.py: No such file or directory") - with open("/tmp/system-installer.log", "w+") as log_file: - log_file.write("Error accessing /usr/share/system-installer/engine.py: No such file or directory") - subprocess.check_call(command1 + disable) - - -if ARGC > 1: - if (argv[1] == "-v" or argv[1] == "--version"): - print("\n%s\n" % (VERSION)) - elif (argv[1] == "-h" or argv[1] == "--help"): - print(HELP % (VERSION)) - elif argv[1] == "--boot-time": - launch(boot_time=True) - else: - eprint("Option %s not recognized." % (argv[1])) - eprint(HELP % (VERSION), color=NC) -else: - launch() From 47cd0109941a7468ebc84fd249161365ca201413 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sun, 2 Jan 2022 13:52:06 -0500 Subject: [PATCH 061/100] update Copyright date --- etc/xdg/autostart/system-installer.desktop | 2 +- tests/bin.sh | 12 ++++++------ tests/engine.sh | 12 ++++++------ tests/installer.sh | 12 ++++++------ tests/modules.sh | 12 ++++++------ tests/test-all.sh | 14 +++++++------- usr/bin/system-installer.cxx | 2 +- .../python3/dist-packages/de_control/__init__.py | 2 +- .../python3/dist-packages/de_control/disable.py | 2 +- usr/lib/python3/dist-packages/de_control/enable.py | 2 +- usr/lib/python3/dist-packages/de_control/modify.py | 2 +- usr/share/system-installer/UI/__init__.py | 2 +- usr/share/system-installer/UI/confirm.py | 2 +- usr/share/system-installer/UI/error.py | 2 +- usr/share/system-installer/UI/main.py | 2 +- usr/share/system-installer/UI/progress.py | 2 +- usr/share/system-installer/UI/report.py | 2 +- usr/share/system-installer/UI/success.py | 2 +- usr/share/system-installer/auto_partitioner.py | 2 +- usr/share/system-installer/check_internet.py | 2 +- .../system-installer/check_kernel_versions.py | 2 +- usr/share/system-installer/chroot.py | 2 +- usr/share/system-installer/common.py | 2 +- usr/share/system-installer/engine.py | 2 +- usr/share/system-installer/installer.py | 2 +- usr/share/system-installer/modules/__init__.py | 2 +- .../system-installer/modules/auto_login_set.py | 2 +- .../system-installer/modules/install_extras.py | 2 +- .../system-installer/modules/install_updates.py | 2 +- usr/share/system-installer/modules/make_swap.py | 2 +- usr/share/system-installer/modules/make_user.py | 2 +- usr/share/system-installer/modules/master.py | 2 +- usr/share/system-installer/modules/purge.py | 2 +- usr/share/system-installer/modules/set_locale.py | 2 +- usr/share/system-installer/modules/set_time.py | 2 +- .../system-installer/modules/set_wallpaper.py | 2 +- .../system-installer/modules/verify_install.py | 2 +- usr/share/system-installer/oem/__init__.py | 2 +- usr/share/system-installer/oem/post_install/UI.py | 2 +- .../system-installer/oem/post_install/__init__.py | 2 +- .../oem/post_install/configure/__init__.py | 2 +- .../oem/post_install/configure/auto_login_set.py | 2 +- .../oem/post_install/configure/keyboard.py | 2 +- .../oem/post_install/configure/set_locale.py | 2 +- .../oem/post_install/configure/set_time.py | 2 +- usr/share/system-installer/oem/pre_install.py | 2 +- usr/share/system-installer/progress.py | 2 +- usr/share/system-installer/success.py | 2 +- 48 files changed, 74 insertions(+), 74 deletions(-) diff --git a/etc/xdg/autostart/system-installer.desktop b/etc/xdg/autostart/system-installer.desktop index fa24e6b6..b3a4b2e6 100644 --- a/etc/xdg/autostart/system-installer.desktop +++ b/etc/xdg/autostart/system-installer.desktop @@ -1,6 +1,6 @@ [Desktop Entry] Name=System Installer -Version=1.9.7-beta9 +Version=2.1.8 Exec=/usr/bin/system-installer --boot-time Comment=Install Drauger OS to your internal drive Type=Application diff --git a/tests/bin.sh b/tests/bin.sh index 86e8a543..204d126f 100755 --- a/tests/bin.sh +++ b/tests/bin.sh @@ -2,24 +2,24 @@ # -*- coding: utf-8 -*- # # bin.sh -# -# Copyright 2020 Thomas Castleman -# +# +# Copyright 2022 Thomas Castleman +# # 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. -# +# # R='\033[0;31m' G='\033[0;32m' diff --git a/tests/engine.sh b/tests/engine.sh index 32fca9cb..25e62504 100755 --- a/tests/engine.sh +++ b/tests/engine.sh @@ -2,24 +2,24 @@ # -*- coding: utf-8 -*- # # engine.sh -# -# Copyright 2020 Thomas Castleman -# +# +# Copyright 2022 Thomas Castleman +# # 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. -# +# # R='\033[0;31m' G='\033[0;32m' diff --git a/tests/installer.sh b/tests/installer.sh index f427af61..4ada9a4b 100755 --- a/tests/installer.sh +++ b/tests/installer.sh @@ -2,24 +2,24 @@ # -*- coding: utf-8 -*- # # installer.sh -# -# Copyright 2020 Thomas Castleman -# +# +# Copyright 2022 Thomas Castleman +# # 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. -# +# # R='\033[0;31m' G='\033[0;32m' diff --git a/tests/modules.sh b/tests/modules.sh index 8546bebd..e591d199 100755 --- a/tests/modules.sh +++ b/tests/modules.sh @@ -2,24 +2,24 @@ # -*- coding: utf-8 -*- # # modules.sh -# -# Copyright 2020 Thomas Castleman -# +# +# Copyright 2022 Thomas Castleman +# # 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. -# +# # R='\033[0;31m' G='\033[0;32m' diff --git a/tests/test-all.sh b/tests/test-all.sh index f12ffdfc..e6e6bb89 100755 --- a/tests/test-all.sh +++ b/tests/test-all.sh @@ -2,24 +2,24 @@ # -*- coding: utf-8 -*- # # test-all.sh -# -# Copyright 2020 Thomas Castleman -# +# +# Copyright 2022 Thomas Castleman +# # 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. -# +# # #tee all output to a log R='\033[0;31m' @@ -34,7 +34,7 @@ for each in $FILE_LIST; do if [ "$each" == "bin.sh" ]; then bash -x "$each" 2>&1 | tee "$each"_test.log | grep '^- ' else - bash -x "$each" 2>&1 | tee "$each"_test.log | grep -v '^+' + bash -x "$each" 2>&1 | tee "$each"_test.log | grep -v '^+' fi done touch tests.log diff --git a/usr/bin/system-installer.cxx b/usr/bin/system-installer.cxx index 22273b0d..a0a84e50 100644 --- a/usr/bin/system-installer.cxx +++ b/usr/bin/system-installer.cxx @@ -1,7 +1,7 @@ /* * system-installer.cxx * - * Copyright 2021 Thomas Castleman + * Copyright 2022 Thomas Castleman * * 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 diff --git a/usr/lib/python3/dist-packages/de_control/__init__.py b/usr/lib/python3/dist-packages/de_control/__init__.py index 42109d99..3a893474 100644 --- a/usr/lib/python3/dist-packages/de_control/__init__.py +++ b/usr/lib/python3/dist-packages/de_control/__init__.py @@ -3,7 +3,7 @@ # # __init__.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/lib/python3/dist-packages/de_control/disable.py b/usr/lib/python3/dist-packages/de_control/disable.py index 78748a6f..2b21e666 100644 --- a/usr/lib/python3/dist-packages/de_control/disable.py +++ b/usr/lib/python3/dist-packages/de_control/disable.py @@ -3,7 +3,7 @@ # # disable.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/lib/python3/dist-packages/de_control/enable.py b/usr/lib/python3/dist-packages/de_control/enable.py index 0e6b3de3..ac2dd0f7 100644 --- a/usr/lib/python3/dist-packages/de_control/enable.py +++ b/usr/lib/python3/dist-packages/de_control/enable.py @@ -3,7 +3,7 @@ # # enable.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/lib/python3/dist-packages/de_control/modify.py b/usr/lib/python3/dist-packages/de_control/modify.py index 96a96fc4..80b2917c 100644 --- a/usr/lib/python3/dist-packages/de_control/modify.py +++ b/usr/lib/python3/dist-packages/de_control/modify.py @@ -3,7 +3,7 @@ # # modify.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/UI/__init__.py b/usr/share/system-installer/UI/__init__.py index 5f1426c4..12278ce4 100755 --- a/usr/share/system-installer/UI/__init__.py +++ b/usr/share/system-installer/UI/__init__.py @@ -3,7 +3,7 @@ # # __init__.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/UI/confirm.py b/usr/share/system-installer/UI/confirm.py index a534bd7f..618f2544 100755 --- a/usr/share/system-installer/UI/confirm.py +++ b/usr/share/system-installer/UI/confirm.py @@ -3,7 +3,7 @@ # # confirm.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/UI/error.py b/usr/share/system-installer/UI/error.py index fb1ef61d..43a4ccd5 100755 --- a/usr/share/system-installer/UI/error.py +++ b/usr/share/system-installer/UI/error.py @@ -3,7 +3,7 @@ # # error.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/UI/main.py b/usr/share/system-installer/UI/main.py index 20be4af6..85ea2bf7 100755 --- a/usr/share/system-installer/UI/main.py +++ b/usr/share/system-installer/UI/main.py @@ -3,7 +3,7 @@ # # main.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/UI/progress.py b/usr/share/system-installer/UI/progress.py index f7398c81..66f3f303 100755 --- a/usr/share/system-installer/UI/progress.py +++ b/usr/share/system-installer/UI/progress.py @@ -3,7 +3,7 @@ # # progress.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/UI/report.py b/usr/share/system-installer/UI/report.py index 56b80ba9..77468db3 100755 --- a/usr/share/system-installer/UI/report.py +++ b/usr/share/system-installer/UI/report.py @@ -3,7 +3,7 @@ # # report.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/UI/success.py b/usr/share/system-installer/UI/success.py index 2ad196d2..6abb1645 100755 --- a/usr/share/system-installer/UI/success.py +++ b/usr/share/system-installer/UI/success.py @@ -3,7 +3,7 @@ # # success.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/auto_partitioner.py b/usr/share/system-installer/auto_partitioner.py index 38af855a..7420d49c 100755 --- a/usr/share/system-installer/auto_partitioner.py +++ b/usr/share/system-installer/auto_partitioner.py @@ -3,7 +3,7 @@ # # auto_partitioner.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/check_internet.py b/usr/share/system-installer/check_internet.py index 39008e86..c224f560 100755 --- a/usr/share/system-installer/check_internet.py +++ b/usr/share/system-installer/check_internet.py @@ -3,7 +3,7 @@ # # check_internet.py # -# Copyright 2020 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/check_kernel_versions.py b/usr/share/system-installer/check_kernel_versions.py index a032335a..68ed8aed 100755 --- a/usr/share/system-installer/check_kernel_versions.py +++ b/usr/share/system-installer/check_kernel_versions.py @@ -3,7 +3,7 @@ # # check_kernel_version.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/chroot.py b/usr/share/system-installer/chroot.py index f006d81c..d25af7f5 100755 --- a/usr/share/system-installer/chroot.py +++ b/usr/share/system-installer/chroot.py @@ -3,7 +3,7 @@ # # chroot.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/common.py b/usr/share/system-installer/common.py index b51edac0..e2a98e9a 100755 --- a/usr/share/system-installer/common.py +++ b/usr/share/system-installer/common.py @@ -3,7 +3,7 @@ # # common.py # -# Copyright 2020 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/engine.py b/usr/share/system-installer/engine.py index b8f9a405..8ab68aff 100755 --- a/usr/share/system-installer/engine.py +++ b/usr/share/system-installer/engine.py @@ -3,7 +3,7 @@ # # engine.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/installer.py b/usr/share/system-installer/installer.py index 46067b52..f6b28bd2 100755 --- a/usr/share/system-installer/installer.py +++ b/usr/share/system-installer/installer.py @@ -3,7 +3,7 @@ # # installer.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/modules/__init__.py b/usr/share/system-installer/modules/__init__.py index b5e75612..e1e87886 100755 --- a/usr/share/system-installer/modules/__init__.py +++ b/usr/share/system-installer/modules/__init__.py @@ -3,7 +3,7 @@ # # __init__.py # -# Copyright 2020 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/modules/auto_login_set.py b/usr/share/system-installer/modules/auto_login_set.py index cc37544b..31c37e81 100755 --- a/usr/share/system-installer/modules/auto_login_set.py +++ b/usr/share/system-installer/modules/auto_login_set.py @@ -3,7 +3,7 @@ # # auto_login_set.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/modules/install_extras.py b/usr/share/system-installer/modules/install_extras.py index c2d7c0ab..ccfafe70 100644 --- a/usr/share/system-installer/modules/install_extras.py +++ b/usr/share/system-installer/modules/install_extras.py @@ -3,7 +3,7 @@ # # install_extras.py # -# Copyright 2020 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/modules/install_updates.py b/usr/share/system-installer/modules/install_updates.py index 025fdb09..4f3727c4 100755 --- a/usr/share/system-installer/modules/install_updates.py +++ b/usr/share/system-installer/modules/install_updates.py @@ -3,7 +3,7 @@ # # install_updates.py # -# Copyright 2020 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/modules/make_swap.py b/usr/share/system-installer/modules/make_swap.py index 341f64a1..deabf660 100755 --- a/usr/share/system-installer/modules/make_swap.py +++ b/usr/share/system-installer/modules/make_swap.py @@ -3,7 +3,7 @@ # # make_swap.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/modules/make_user.py b/usr/share/system-installer/modules/make_user.py index cfe7fff6..bfd6a69a 100755 --- a/usr/share/system-installer/modules/make_user.py +++ b/usr/share/system-installer/modules/make_user.py @@ -3,7 +3,7 @@ # # make_user.py # -# Copyright 2020 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/modules/master.py b/usr/share/system-installer/modules/master.py index f92684b3..0c01b89b 100755 --- a/usr/share/system-installer/modules/master.py +++ b/usr/share/system-installer/modules/master.py @@ -3,7 +3,7 @@ # # master.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/modules/purge.py b/usr/share/system-installer/modules/purge.py index eca98bf4..f44380bd 100755 --- a/usr/share/system-installer/modules/purge.py +++ b/usr/share/system-installer/modules/purge.py @@ -3,7 +3,7 @@ # # purge.py # -# Copyright 2020 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/modules/set_locale.py b/usr/share/system-installer/modules/set_locale.py index db5db6d7..a39802ee 100755 --- a/usr/share/system-installer/modules/set_locale.py +++ b/usr/share/system-installer/modules/set_locale.py @@ -3,7 +3,7 @@ # # set_locale.py # -# Copyright 2020 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/modules/set_time.py b/usr/share/system-installer/modules/set_time.py index fc62e245..fede388e 100755 --- a/usr/share/system-installer/modules/set_time.py +++ b/usr/share/system-installer/modules/set_time.py @@ -3,7 +3,7 @@ # # set_time.py # -# Copyright 2020 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/modules/set_wallpaper.py b/usr/share/system-installer/modules/set_wallpaper.py index 522b8cec..85bece00 100755 --- a/usr/share/system-installer/modules/set_wallpaper.py +++ b/usr/share/system-installer/modules/set_wallpaper.py @@ -3,7 +3,7 @@ # # set_wallpaper.py # -# Copyright 2020 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/modules/verify_install.py b/usr/share/system-installer/modules/verify_install.py index b11086c2..04dc2da7 100755 --- a/usr/share/system-installer/modules/verify_install.py +++ b/usr/share/system-installer/modules/verify_install.py @@ -3,7 +3,7 @@ # # verify_install.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/oem/__init__.py b/usr/share/system-installer/oem/__init__.py index 9efac761..329fb7f2 100755 --- a/usr/share/system-installer/oem/__init__.py +++ b/usr/share/system-installer/oem/__init__.py @@ -3,7 +3,7 @@ # # __init__.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/oem/post_install/UI.py b/usr/share/system-installer/oem/post_install/UI.py index 6659f1eb..26d0f30b 100755 --- a/usr/share/system-installer/oem/post_install/UI.py +++ b/usr/share/system-installer/oem/post_install/UI.py @@ -3,7 +3,7 @@ # # main.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/oem/post_install/__init__.py b/usr/share/system-installer/oem/post_install/__init__.py index 9cf60c27..e25f3bc4 100755 --- a/usr/share/system-installer/oem/post_install/__init__.py +++ b/usr/share/system-installer/oem/post_install/__init__.py @@ -3,7 +3,7 @@ # # __init__.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/oem/post_install/configure/__init__.py b/usr/share/system-installer/oem/post_install/configure/__init__.py index c28c3699..204de407 100755 --- a/usr/share/system-installer/oem/post_install/configure/__init__.py +++ b/usr/share/system-installer/oem/post_install/configure/__init__.py @@ -3,7 +3,7 @@ # # __init__.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/oem/post_install/configure/auto_login_set.py b/usr/share/system-installer/oem/post_install/configure/auto_login_set.py index cc37544b..31c37e81 100755 --- a/usr/share/system-installer/oem/post_install/configure/auto_login_set.py +++ b/usr/share/system-installer/oem/post_install/configure/auto_login_set.py @@ -3,7 +3,7 @@ # # auto_login_set.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/oem/post_install/configure/keyboard.py b/usr/share/system-installer/oem/post_install/configure/keyboard.py index bc5bf9ca..18ec7449 100755 --- a/usr/share/system-installer/oem/post_install/configure/keyboard.py +++ b/usr/share/system-installer/oem/post_install/configure/keyboard.py @@ -3,7 +3,7 @@ # # keyboard.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/oem/post_install/configure/set_locale.py b/usr/share/system-installer/oem/post_install/configure/set_locale.py index db5db6d7..a39802ee 100755 --- a/usr/share/system-installer/oem/post_install/configure/set_locale.py +++ b/usr/share/system-installer/oem/post_install/configure/set_locale.py @@ -3,7 +3,7 @@ # # set_locale.py # -# Copyright 2020 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/oem/post_install/configure/set_time.py b/usr/share/system-installer/oem/post_install/configure/set_time.py index 8ccd31ba..fede388e 100755 --- a/usr/share/system-installer/oem/post_install/configure/set_time.py +++ b/usr/share/system-installer/oem/post_install/configure/set_time.py @@ -3,7 +3,7 @@ # # set_time.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/oem/pre_install.py b/usr/share/system-installer/oem/pre_install.py index 9de8e919..3bc18df4 100755 --- a/usr/share/system-installer/oem/pre_install.py +++ b/usr/share/system-installer/oem/pre_install.py @@ -3,7 +3,7 @@ # # main.py # -# Copyright 2021 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/progress.py b/usr/share/system-installer/progress.py index d8ea5eb1..8295f7a1 100755 --- a/usr/share/system-installer/progress.py +++ b/usr/share/system-installer/progress.py @@ -3,7 +3,7 @@ # # progress.py # -# Copyright 2020 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 diff --git a/usr/share/system-installer/success.py b/usr/share/system-installer/success.py index cca2841b..97bdace6 100755 --- a/usr/share/system-installer/success.py +++ b/usr/share/system-installer/success.py @@ -3,7 +3,7 @@ # # success.py # -# Copyright 2020 Thomas Castleman +# Copyright 2022 Thomas Castleman # # 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 From d61f0677eb95ada94523abf83790502749ffec73 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Mon, 3 Jan 2022 00:59:51 -0500 Subject: [PATCH 062/100] update gitignore for C++ code --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 67119fb0..c98494f2 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ __pycache__ changelog.gz changelog +*.o +*.so From 92cfe76c3261c368a328a1fb36170d387697c7b3 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Mon, 3 Jan 2022 01:00:13 -0500 Subject: [PATCH 063/100] start work converting common.py to C++ --- build.sh | 10 ++++-- usr/share/system-installer/common.cxx | 51 +++++++++++++++++++++++++++ usr/share/system-installer/common.hpp | 40 +++++++++++++++++++++ 3 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 usr/share/system-installer/common.cxx create mode 100644 usr/share/system-installer/common.hpp diff --git a/build.sh b/build.sh index dd964556..1eaa80fb 100755 --- a/build.sh +++ b/build.sh @@ -56,7 +56,10 @@ fi # Pshyc - we're compiling shit now cd usr/bin g++ -o system-installer system-installer.cxx $(python3.9-config --ldflags --cflags --embed) -cd ../.. +cd ../share/system-installer +g++ -c -Wall -Werror -fpic common.cxx $(python3.9-config --cflags) +g++ -shared -o libcommon.so common.o $(python3.9-config --ldflags) +cd ../../.. ############################################################## # # # # @@ -111,8 +114,11 @@ cd .. if [ "$OPTIONS" != "--pool" ]; then rm system-installer/usr/share/system-installer/modules/kernel.tar.xz fi -# delete binary file from repo +# delete binary files from repo rm "$base"/usr/bin/system-installer +rm "$base"/usr/share/system-installer/libcommon.so +# delete object files from the repo +rm "$base"/use/share/system-installer/common.o # delete C++ source from package rm "$FOLDER"/usr/bin/system-installer.cxx #build the shit diff --git a/usr/share/system-installer/common.cxx b/usr/share/system-installer/common.cxx new file mode 100644 index 00000000..aa7b1aa5 --- /dev/null +++ b/usr/share/system-installer/common.cxx @@ -0,0 +1,51 @@ +/* + * common.cxx + * + * Copyright 2022 Thomas Castleman + * + * 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. + * + * + */ +#include "common.hpp" + +using namespace std; + +// real_number() +// Take an int or float and return an int that is 0 or higher +// +// This DOES NOT return absolute value. Any negative numbers will return 0. +// Valid floats that are passed are truncated, not rounded. + +unsigned real_number(int num) +{ + // This one is really easy. Just check to see if the argument is positive + if (num > 0) + { + // now just static_cast the var so we know it's unsigned for sure + return static_cast(num); + } + return 0; +} + +unsigned real_number(float num) +{ + // First we need to static_cast the float to an int, to truncate it + int new_num = static_cast(num); + // now, just use the other real_number() + // no need to write code twice! + return real_number(new_num); +} diff --git a/usr/share/system-installer/common.hpp b/usr/share/system-installer/common.hpp new file mode 100644 index 00000000..d7ced7f6 --- /dev/null +++ b/usr/share/system-installer/common.hpp @@ -0,0 +1,40 @@ +/* + * common.hpp + * + * Copyright 2022 Thomas Castleman + * + * 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. + * + * + */ +#define PY_SSIZE_T_CLEAN +#ifndef common_hpp__ +#define common_hpp__ +#define elif else if +#define string_list std::vector +#define int_list std::vector +#define float_list std::vector +#define bool_list std::vector + +#include + +// We need to overload this method so it can take either a float or an int +extern unsigned real_number(float num); + +extern unsigned real_number(int num); + + +#endif //common_hpp__ From 0d25a73e66b4b7ebf4f2e337082c460316b6b5db Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Mon, 3 Jan 2022 02:27:26 -0500 Subject: [PATCH 064/100] create intial abstraction layer for Python --- usr/share/system-installer/common.cxx | 15 +++++++++++++++ usr/share/system-installer/common.hpp | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/usr/share/system-installer/common.cxx b/usr/share/system-installer/common.cxx index aa7b1aa5..a0c704bf 100644 --- a/usr/share/system-installer/common.cxx +++ b/usr/share/system-installer/common.cxx @@ -30,6 +30,7 @@ using namespace std; // This DOES NOT return absolute value. Any negative numbers will return 0. // Valid floats that are passed are truncated, not rounded. + unsigned real_number(int num) { // This one is really easy. Just check to see if the argument is positive @@ -41,6 +42,7 @@ unsigned real_number(int num) return 0; } + unsigned real_number(float num) { // First we need to static_cast the float to an int, to truncate it @@ -49,3 +51,16 @@ unsigned real_number(float num) // no need to write code twice! return real_number(new_num); } + + +PyObject * real_number(PyObject *self, PyObject *args) +{ + int * num; + + if (!PyArg_ParseTuple(args, "i", &num)) + { + return NULL; + } + return PyLong_FromLong(real_number(*num)); + +} diff --git a/usr/share/system-installer/common.hpp b/usr/share/system-installer/common.hpp index d7ced7f6..9d951ff1 100644 --- a/usr/share/system-installer/common.hpp +++ b/usr/share/system-installer/common.hpp @@ -33,8 +33,8 @@ // We need to overload this method so it can take either a float or an int extern unsigned real_number(float num); - extern unsigned real_number(int num); +extern PyObject * real_number(PyObject *self, PyObject *args); #endif //common_hpp__ From 225c2a21d585d2f6786ec0d90a488ef5ca952d52 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Mon, 3 Jan 2022 02:42:08 -0500 Subject: [PATCH 065/100] rename shared object Python doesn't ignore the `lib` at the beginning of library names. So we need to remove it ourselves. --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 1eaa80fb..4db29fb6 100755 --- a/build.sh +++ b/build.sh @@ -58,7 +58,7 @@ cd usr/bin g++ -o system-installer system-installer.cxx $(python3.9-config --ldflags --cflags --embed) cd ../share/system-installer g++ -c -Wall -Werror -fpic common.cxx $(python3.9-config --cflags) -g++ -shared -o libcommon.so common.o $(python3.9-config --ldflags) +g++ -shared -o common.so common.o $(python3.9-config --ldflags) cd ../../.. ############################################################## # # From 18aa522394ea38da2ad4c370ea909379932b9028 Mon Sep 17 00:00:00 2001 From: Richard Romick Date: Mon, 3 Jan 2022 07:02:26 -0500 Subject: [PATCH 066/100] Remove debugging statements and update comments --- usr/share/system-installer/UI/main.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/usr/share/system-installer/UI/main.py b/usr/share/system-installer/UI/main.py index 9d42fa7e..784c9373 100755 --- a/usr/share/system-installer/UI/main.py +++ b/usr/share/system-installer/UI/main.py @@ -31,7 +31,6 @@ import subprocess import gi import auto_partitioner -import pdb gi.require_version('Gtk', '3.0') @@ -979,8 +978,8 @@ def auto_home_setup2(self, widget): dev_list = tuple(self.devices) new_dev_list = [] # this will be the final list that is displayed for the user - pdb.set_trace() + # todo: account for BTRFS drives that have no partitions for device in dev_list: # we will iterate through the dev list and add devices to the new list try: if device == []: # if the device is empty, we skip @@ -1002,14 +1001,9 @@ def auto_home_setup2(self, widget): new_dev_list.append(new_device) except KeyError: pass # todo: use traceback module to print the traceback to stderr - # can print to file. Look up printing tracebacks from an exception - - # todo: should parent objects be included in the list? home_cmbbox = Gtk.ComboBoxText.new() - pdb.set_trace() - # properly format device names and add to combo box for device in new_dev_list: device['name'] = "/dev/%s" % device['name'] From b299c9bae2558abc9e870a81160b7e6249f14b8b Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sat, 15 Jan 2022 00:21:54 -0500 Subject: [PATCH 067/100] build for generic amd64 arch --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 4db29fb6..53467139 100755 --- a/build.sh +++ b/build.sh @@ -55,11 +55,11 @@ fi # Pshyc - we're compiling shit now cd usr/bin -g++ -o system-installer system-installer.cxx $(python3.9-config --ldflags --cflags --embed) cd ../share/system-installer g++ -c -Wall -Werror -fpic common.cxx $(python3.9-config --cflags) g++ -shared -o common.so common.o $(python3.9-config --ldflags) cd ../../.. +g++ -m64 -o system-installer system-installer.cxx $(python3.9-config --ldflags --cflags --embed) ############################################################## # # # # From 9240c57c94dfbe54dfd8258be37705bce838b05d Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sat, 15 Jan 2022 00:23:18 -0500 Subject: [PATCH 068/100] do not build unused C++ lib libcommon will remain Python in this branch, for now --- build.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/build.sh b/build.sh index 53467139..a506d15e 100755 --- a/build.sh +++ b/build.sh @@ -55,11 +55,8 @@ fi # Pshyc - we're compiling shit now cd usr/bin -cd ../share/system-installer -g++ -c -Wall -Werror -fpic common.cxx $(python3.9-config --cflags) -g++ -shared -o common.so common.o $(python3.9-config --ldflags) -cd ../../.. g++ -m64 -o system-installer system-installer.cxx $(python3.9-config --ldflags --cflags --embed) +cd ../.. ############################################################## # # # # @@ -116,9 +113,6 @@ if [ "$OPTIONS" != "--pool" ]; then fi # delete binary files from repo rm "$base"/usr/bin/system-installer -rm "$base"/usr/share/system-installer/libcommon.so -# delete object files from the repo -rm "$base"/use/share/system-installer/common.o # delete C++ source from package rm "$FOLDER"/usr/bin/system-installer.cxx #build the shit From 9adefc03e862a3b4998ceb8a3fdd8b34f8cd5d18 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sat, 15 Jan 2022 00:23:44 -0500 Subject: [PATCH 069/100] delete C++ lib files Keep all C++ conversion to C++_conversion branch --- usr/share/system-installer/common.cxx | 66 --------------------------- usr/share/system-installer/common.hpp | 40 ---------------- 2 files changed, 106 deletions(-) delete mode 100644 usr/share/system-installer/common.cxx delete mode 100644 usr/share/system-installer/common.hpp diff --git a/usr/share/system-installer/common.cxx b/usr/share/system-installer/common.cxx deleted file mode 100644 index a0c704bf..00000000 --- a/usr/share/system-installer/common.cxx +++ /dev/null @@ -1,66 +0,0 @@ -/* - * common.cxx - * - * Copyright 2022 Thomas Castleman - * - * 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. - * - * - */ -#include "common.hpp" - -using namespace std; - -// real_number() -// Take an int or float and return an int that is 0 or higher -// -// This DOES NOT return absolute value. Any negative numbers will return 0. -// Valid floats that are passed are truncated, not rounded. - - -unsigned real_number(int num) -{ - // This one is really easy. Just check to see if the argument is positive - if (num > 0) - { - // now just static_cast the var so we know it's unsigned for sure - return static_cast(num); - } - return 0; -} - - -unsigned real_number(float num) -{ - // First we need to static_cast the float to an int, to truncate it - int new_num = static_cast(num); - // now, just use the other real_number() - // no need to write code twice! - return real_number(new_num); -} - - -PyObject * real_number(PyObject *self, PyObject *args) -{ - int * num; - - if (!PyArg_ParseTuple(args, "i", &num)) - { - return NULL; - } - return PyLong_FromLong(real_number(*num)); - -} diff --git a/usr/share/system-installer/common.hpp b/usr/share/system-installer/common.hpp deleted file mode 100644 index 9d951ff1..00000000 --- a/usr/share/system-installer/common.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * common.hpp - * - * Copyright 2022 Thomas Castleman - * - * 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. - * - * - */ -#define PY_SSIZE_T_CLEAN -#ifndef common_hpp__ -#define common_hpp__ -#define elif else if -#define string_list std::vector -#define int_list std::vector -#define float_list std::vector -#define bool_list std::vector - -#include - -// We need to overload this method so it can take either a float or an int -extern unsigned real_number(float num); -extern unsigned real_number(int num); -extern PyObject * real_number(PyObject *self, PyObject *args); - - -#endif //common_hpp__ From ab737499c1c4b9feb9986877d2ba9ac41efdd682 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sat, 15 Jan 2022 00:37:26 -0500 Subject: [PATCH 070/100] another minor build fix --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index a506d15e..06f0505a 100755 --- a/build.sh +++ b/build.sh @@ -50,7 +50,7 @@ if [ "$OPTIONS" != "--pool" ]; then tar --verbose --create --xz -f kernel.tar.xz kernel echo -e "\t###\tCLEANING\t###\t" rm -rfv kernel - cd ../../../.. + cd ../../.. fi # Pshyc - we're compiling shit now From 93e8ab1dbddfa32789b56a55719cf0ebbc0fe273 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sat, 15 Jan 2022 00:52:34 -0500 Subject: [PATCH 071/100] another another minor build fix --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 06f0505a..9f8caab0 100755 --- a/build.sh +++ b/build.sh @@ -109,7 +109,7 @@ base="$PWD" cd .. #DELETE STUFF HERE if [ "$OPTIONS" != "--pool" ]; then - rm system-installer/usr/share/system-installer/modules/kernel.tar.xz + rm "$base"/system-installer/usr/share/system-installer/modules/kernel.tar.xz fi # delete binary files from repo rm "$base"/usr/bin/system-installer From 5b8237509206a2044c858768fe6c1a54ee27fd2a Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sat, 15 Jan 2022 01:01:37 -0500 Subject: [PATCH 072/100] I think this will do it --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 9f8caab0..4d39301b 100755 --- a/build.sh +++ b/build.sh @@ -109,7 +109,7 @@ base="$PWD" cd .. #DELETE STUFF HERE if [ "$OPTIONS" != "--pool" ]; then - rm "$base"/system-installer/usr/share/system-installer/modules/kernel.tar.xz + rm "$base"/usr/share/system-installer/modules/kernel.tar.xz fi # delete binary files from repo rm "$base"/usr/bin/system-installer From fdcb91a2d94003420f421be1865dc4f730956aff Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sat, 15 Jan 2022 20:41:07 -0500 Subject: [PATCH 073/100] prevent bug on BIOS installations we need /boot/grub to exist in order for the device map to be made. Make that folder so that THAT error doesn't pop up. --- usr/share/system-installer/modules/master.py | 1 + 1 file changed, 1 insertion(+) diff --git a/usr/share/system-installer/modules/master.py b/usr/share/system-installer/modules/master.py index 0c01b89b..1ce7acf1 100755 --- a/usr/share/system-installer/modules/master.py +++ b/usr/share/system-installer/modules/master.py @@ -269,6 +269,7 @@ def _install_grub(root): del root[-1] root = "".join(root) redo = False + os.mkdir("/boot/grub") try: subprocess.check_call(["grub-mkdevicemap", "--verbose"], stdout=stderr.buffer) From f5eb3e7d324dd3762d3cf13b592352aef988f7e2 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sat, 15 Jan 2022 20:41:35 -0500 Subject: [PATCH 074/100] fix name error CalledProcessError doesn't exist, but subprocess.CalledProcessError does --- usr/share/system-installer/modules/master.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr/share/system-installer/modules/master.py b/usr/share/system-installer/modules/master.py index 1ce7acf1..9094a481 100755 --- a/usr/share/system-installer/modules/master.py +++ b/usr/share/system-installer/modules/master.py @@ -272,16 +272,16 @@ def _install_grub(root): os.mkdir("/boot/grub") try: subprocess.check_call(["grub-mkdevicemap", "--verbose"], - stdout=stderr.buffer) - except CalledProcessError: + stdout=stderr.buffer) + except subprocess.CalledProcessError: redo = True subprocess.check_call(["grub-install", "--verbose", "--force", "--target=i386-pc", root], stdout=stderr.buffer) if redo: try: subprocess.check_call(["grub-mkdevicemap", "--verbose"], - stdout=stderr.buffer) - except CalledProcessError as e: + stdout=stderr.buffer) + except subprocess.CalledProcessError as e: eprint("WARNING: GRUB device map failed to generate") eprint("The error was as follows:") eprint(traceback.format_exeception()) From a56cd7a0d870b3c277f68fce1f75b073ef539aa5 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sat, 15 Jan 2022 20:43:57 -0500 Subject: [PATCH 075/100] minor fix for PEP8 --- usr/share/system-installer/modules/master.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/share/system-installer/modules/master.py b/usr/share/system-installer/modules/master.py index 9094a481..bd8833ce 100755 --- a/usr/share/system-installer/modules/master.py +++ b/usr/share/system-installer/modules/master.py @@ -297,7 +297,7 @@ def _install_systemd_boot(release, root, distro): pass os.mkdir("/boot/efi/loader") os.mkdir("/boot/efi/loader/entries") - os.mkdir(f"/boot/efi/{distro}" ) + os.mkdir(f"/boot/efi/{distro}") os.environ["SYSTEMD_RELAX_ESP_CHECKS"] = "1" with open("/etc/environment", "a") as envi: envi.write("export SYSTEMD_RELAX_ESP_CHECKS=1") From 3f64dd285ef44cd428d02f0d6a0bfd942aae9843 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sat, 15 Jan 2022 22:13:17 -0500 Subject: [PATCH 076/100] do not do stuff for EFI on BIOS There were not checks in the verification script for if the user was using UEFI or BIOS, before trying to set efi vars. Added those checks in. --- DEBIAN/control | 2 +- usr/bin/system-installer.cxx | 2 +- .../system-installer/modules/verify_install.py | 14 ++++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/DEBIAN/control b/DEBIAN/control index 69d7c2a4..c121b195 100644 --- a/DEBIAN/control +++ b/DEBIAN/control @@ -1,5 +1,5 @@ Package: system-installer -Version: 2.1.8 +Version: 2.1.9 Maintainer: Thomas Castleman Homepage: https://github.com/drauger-os-development/system-installer Section: admin diff --git a/usr/bin/system-installer.cxx b/usr/bin/system-installer.cxx index a0a84e50..c6eba33f 100644 --- a/usr/bin/system-installer.cxx +++ b/usr/bin/system-installer.cxx @@ -46,7 +46,7 @@ using namespace std; -str VERSION = "2.1.8"; +str VERSION = "2.1.9"; str R = "\033[0;31m"; str G = "\033[0;32m"; str Y = "\033[1;33m"; diff --git a/usr/share/system-installer/modules/verify_install.py b/usr/share/system-installer/modules/verify_install.py index 04dc2da7..71c0341c 100755 --- a/usr/share/system-installer/modules/verify_install.py +++ b/usr/share/system-installer/modules/verify_install.py @@ -114,17 +114,19 @@ def verify(username, root, distro): remove("/home/" + username + "/Desktop/system-installer.desktop") except FileNotFoundError: pass - status = is_default_entry(distro) - if status in (False, None): - if status is None: - add_boot_entry(root, distro) - set_default_entry(disto) + if path.isdir("/sys/firmware/efi"): + # on UEFI, set as default entry + status = is_default_entry(distro) + if status in (False, None): + if status is None: + add_boot_entry(root, distro) + set_default_entry(disto) cache = apt.cache.Cache() cache.open() if username != "drauger-user": if (("system-installer" in cache) and cache["system-installer"].is_installed): cache["system-installer"].mark_delete() - if path.isfile("/etc/kernel/postinst.d/zz-update-systemd-boot"): + if path.isdir("/sys/firmware/efi"): with cache.actiongroup(): for each in cache: if (("grub" in each.name) and each.is_installed): From c84d516bdf8ce6e218e2eb963ef462add69a3d58 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sun, 16 Jan 2022 15:12:26 -0500 Subject: [PATCH 077/100] debug statments Trying to find where #50 is occuring --- usr/share/system-installer/auto_partitioner.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr/share/system-installer/auto_partitioner.py b/usr/share/system-installer/auto_partitioner.py index 7420d49c..0a91a523 100755 --- a/usr/share/system-installer/auto_partitioner.py +++ b/usr/share/system-installer/auto_partitioner.py @@ -455,14 +455,17 @@ def partition(root, efi, home, raid_array): # If home == "MAKE", we KNOW there are no partitons because we made a # new partition table if size >= gb_to_bytes(config["mdswh"]): + common.eprint("Getting root partition size") root_end = int((size * 0.35) / (1000 ** 2)) else: root_end = get_min_root_size() if (efi and (part1 is None)): + common.eprint("Making home part") part1 = __make_efi__(device) part2 = __make_root__(device, end=root_end) part3 = __make_home__(device, new_start=root_end) elif part1 is None: + common.eprint("Making home part") part1 = __make_root__(device, start="0%", end=root_end) __make_root_boot__(device) part2 = __make_home__(device, new_start=root_end) From 6bd9fb7b098c250675b135575aab6b948c253eb2 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sun, 16 Jan 2022 16:19:20 -0500 Subject: [PATCH 078/100] hopeful fix for #50 sectors_to_size() returns sizes in megabytes. For most applications, this works. But for the comparision with `LIMITER`, it forces it to return `True` unless someone has a 32TB drive they are installing on --- usr/share/system-installer/auto_partitioner.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/usr/share/system-installer/auto_partitioner.py b/usr/share/system-installer/auto_partitioner.py index 0a91a523..8e19b19e 100755 --- a/usr/share/system-installer/auto_partitioner.py +++ b/usr/share/system-installer/auto_partitioner.py @@ -422,7 +422,8 @@ def partition(root, efi, home, raid_array): except parted._ped.DiskLabelException: common.eprint("NO PARTITION TABLE EXISTS. MAKING NEW ONE . . .") disk = parted.freshDisk(device, "gpt") - size = sectors_to_size(device.length, device.sectorSize) * 1000 + # sectors_to_size() returns size in MBs, multiply by 1 million to convert to bytes + size = sectors_to_size(device.length, device.sectorSize) * 1000000 if ((home in ("NULL", "null", None, "MAKE")) and (raid_array["raid_type"] is None)): disk = clobber_disk(device) @@ -455,17 +456,14 @@ def partition(root, efi, home, raid_array): # If home == "MAKE", we KNOW there are no partitons because we made a # new partition table if size >= gb_to_bytes(config["mdswh"]): - common.eprint("Getting root partition size") root_end = int((size * 0.35) / (1000 ** 2)) else: root_end = get_min_root_size() if (efi and (part1 is None)): - common.eprint("Making home part") part1 = __make_efi__(device) part2 = __make_root__(device, end=root_end) part3 = __make_home__(device, new_start=root_end) elif part1 is None: - common.eprint("Making home part") part1 = __make_root__(device, start="0%", end=root_end) __make_root_boot__(device) part2 = __make_home__(device, new_start=root_end) From 2543505faa2a0cf03c63f84ffc6681f7b43419a7 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sun, 16 Jan 2022 16:28:53 -0500 Subject: [PATCH 079/100] version bump to appease le gods de apt --- DEBIAN/control | 2 +- usr/bin/system-installer.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEBIAN/control b/DEBIAN/control index c121b195..70caa3c2 100644 --- a/DEBIAN/control +++ b/DEBIAN/control @@ -1,5 +1,5 @@ Package: system-installer -Version: 2.1.9 +Version: 2.2.0 Maintainer: Thomas Castleman Homepage: https://github.com/drauger-os-development/system-installer Section: admin diff --git a/usr/bin/system-installer.cxx b/usr/bin/system-installer.cxx index c6eba33f..234faa4d 100644 --- a/usr/bin/system-installer.cxx +++ b/usr/bin/system-installer.cxx @@ -46,7 +46,7 @@ using namespace std; -str VERSION = "2.1.9"; +str VERSION = "2.2.0"; str R = "\033[0;31m"; str G = "\033[0;32m"; str Y = "\033[1;33m"; From 4c022e84e669a02932af98bd0e48f7e658cf7665 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Sun, 16 Jan 2022 18:05:32 -0500 Subject: [PATCH 080/100] build fix for 7.5.1 --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 4d39301b..0cec14d1 100755 --- a/build.sh +++ b/build.sh @@ -109,7 +109,7 @@ base="$PWD" cd .. #DELETE STUFF HERE if [ "$OPTIONS" != "--pool" ]; then - rm "$base"/usr/share/system-installer/modules/kernel.tar.xz + rm "$base"/usr/share/system-installer/kernel.tar.xz fi # delete binary files from repo rm "$base"/usr/bin/system-installer From 61c57223594fc62772f38e0e42df728082c76d3c Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Mon, 17 Jan 2022 22:10:42 -0500 Subject: [PATCH 081/100] fix several 7.5.1 specific bugs --- DEBIAN/control | 2 +- usr/bin/system-installer.cxx | 2 +- .../system-installer/check_kernel_versions.py | 4 ++-- usr/share/system-installer/installer.py | 16 ++++++++++------ 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/DEBIAN/control b/DEBIAN/control index 70caa3c2..502f120a 100644 --- a/DEBIAN/control +++ b/DEBIAN/control @@ -1,5 +1,5 @@ Package: system-installer -Version: 2.2.0 +Version: 2.2.1 Maintainer: Thomas Castleman Homepage: https://github.com/drauger-os-development/system-installer Section: admin diff --git a/usr/bin/system-installer.cxx b/usr/bin/system-installer.cxx index 234faa4d..60da35e5 100644 --- a/usr/bin/system-installer.cxx +++ b/usr/bin/system-installer.cxx @@ -46,7 +46,7 @@ using namespace std; -str VERSION = "2.2.0"; +str VERSION = "2.2.1"; str R = "\033[0;31m"; str G = "\033[0;32m"; str Y = "\033[1;33m"; diff --git a/usr/share/system-installer/check_kernel_versions.py b/usr/share/system-installer/check_kernel_versions.py index 68ed8aed..a908d3ba 100755 --- a/usr/share/system-installer/check_kernel_versions.py +++ b/usr/share/system-installer/check_kernel_versions.py @@ -35,9 +35,9 @@ def __get_file_version__(local_repo): """Get kernel version in included kernel archive""" if not os.path.exists(local_repo): try: - tar_file = tar.open("/usr/share/system-installer/modules/kernel.tar.xz") + tar_file = tar.open("/usr/share/system-installer/kernel.tar.xz") except FileNotFoundError: - tar_file = tar.open("/usr/share/system-installer/modules/kernel.tar.7z") + tar_file = tar.open("/usr/share/system-installer/kernel.tar.7z") files = tar_file.getnames() tar_file.close() else: diff --git a/usr/share/system-installer/installer.py b/usr/share/system-installer/installer.py index f6b28bd2..f5cd6b8f 100755 --- a/usr/share/system-installer/installer.py +++ b/usr/share/system-installer/installer.py @@ -187,15 +187,19 @@ def install(settings, local_repo): __update__(34) # STEP 5: Extract Tar ball if needed, copy files to installation drive if not os.path.exists(local_repo): - eprint("EXTRACTING KERNEL.TAR.XZ") + common.eprint("EXTRACTING KERNEL.TAR.XZ") tar_file = tar.open("/usr/share/system-installer/kernel.tar.xz") tar_file.extractall(path="/") tar_file.close() - eprint("EXTRACTION COMPLETE") - path = local_repo.split("/") - for each in enumerate(path): - os.mkdir("/".join(path[:each[0] + 1])) - os.mkdir(local_repo) + common.eprint("EXTRACTION COMPLETE") + # try to use the default path. If an OSError or PermissionError is thrown, + # default to a path that should be good. This may mean more memory usage + # since /tmp is in memory, not on disk. But that's a sacrifice we can make here + try: + common.recursive_mkdir(local_repo) + except (OSError, PermissionError): + local_repo = "/tmp/system-installer/repo" + common.recursive_mkdir(local_repo) # Copy everything into local_repo at top level # We COULD go ahead and copy everything where it needs to be, but that would # make for more code and an extra check I don't wanna bother with right now From 720c307dee2d841631f1870e9c77429a4a20f4b3 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Mon, 17 Jan 2022 22:11:18 -0500 Subject: [PATCH 082/100] create recursive_mkdir() function This is functionally equivallent to `mkdir -p ` --- usr/share/system-installer/common.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/usr/share/system-installer/common.py b/usr/share/system-installer/common.py index e2a98e9a..376e6498 100755 --- a/usr/share/system-installer/common.py +++ b/usr/share/system-installer/common.py @@ -23,7 +23,7 @@ # """Common functions and other data for system-installer""" import sys - +import os def unique(starting_list): """Function to get a list down to only unique elements""" @@ -54,3 +54,19 @@ def real_number(num): if num >= 0: return int(num) return 0 + + +def recursive_mkdir(path): + """ Recursively make directories down a file path + + This function is functionally equivallent to: `mkdir -p {path}' + """ + path = path.split("/") + for each in enumerate(path): + dir = "/".join(path[:each[0] + 1]) + # prevent calling mkdir() on an empty string + if dir != "": + try: + os.mkdir(dir) + except FileExistsError: + pass From 4cbf1d4966c4adeaad73411ae4b1a3da68bc52ac Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Thu, 20 Jan 2022 13:35:35 -0500 Subject: [PATCH 083/100] PEP8 conformance improvments --- usr/share/system-installer/common.py | 1 + 1 file changed, 1 insertion(+) diff --git a/usr/share/system-installer/common.py b/usr/share/system-installer/common.py index 376e6498..20141305 100755 --- a/usr/share/system-installer/common.py +++ b/usr/share/system-installer/common.py @@ -25,6 +25,7 @@ import sys import os + def unique(starting_list): """Function to get a list down to only unique elements""" # intilize a null list From c0f80d24da0eac17d028d368cfa4fe972657a8aa Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Thu, 20 Jan 2022 18:39:50 -0500 Subject: [PATCH 084/100] fix a couple hidden bugs --- usr/share/system-installer/auto_partitioner.py | 11 +++++++---- usr/share/system-installer/modules/make_user.py | 6 +++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/usr/share/system-installer/auto_partitioner.py b/usr/share/system-installer/auto_partitioner.py index 8e19b19e..5024253e 100755 --- a/usr/share/system-installer/auto_partitioner.py +++ b/usr/share/system-installer/auto_partitioner.py @@ -351,10 +351,13 @@ def make_part_boot(part_path): # narrow down to just primary partitions partitions = disk.getPrimaryPartitions() # mark designated partition as bootable - if "nvme" in part_path: - partitions[int(part_path[13:])].setFlag(parted.PARTITION_BOOT) - else: - partitions[int(part_path[8:])].setFlag(parted.PARTITION_BOOT) + try: + if "nvme" in part_path: + partitions[int(part_path[13:])].setFlag(parted.PARTITION_BOOT) + else: + partitions[int(part_path[8:])].setFlag(parted.PARTITION_BOOT) + except IndexError: + return # We don't have commitment issues here! disk.commit() diff --git a/usr/share/system-installer/modules/make_user.py b/usr/share/system-installer/modules/make_user.py index bfd6a69a..6e54b691 100755 --- a/usr/share/system-installer/modules/make_user.py +++ b/usr/share/system-installer/modules/make_user.py @@ -58,7 +58,11 @@ def make_user(username): new_home = "/home/" + username if os.path.exists(new_home): eprint("Original home folder found. Substituting it in . . .") - rmtree("/home/live") + try: + rmtree("/home/live") + except FileNotFoundError: + if username != "home": #literally a 1 in a trillion chance of happening, but just in case + rmtree("/home/home") elif os.path.exists("/home/home/live"): __fix_home__(username) else: From 29509cd0304112ce594d84af7913392cf416e095 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Thu, 20 Jan 2022 18:40:33 -0500 Subject: [PATCH 085/100] version bump, due to version being taken in testing --- DEBIAN/control | 2 +- usr/bin/system-installer.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEBIAN/control b/DEBIAN/control index 502f120a..0da77c0e 100644 --- a/DEBIAN/control +++ b/DEBIAN/control @@ -1,5 +1,5 @@ Package: system-installer -Version: 2.2.1 +Version: 2.2.3 Maintainer: Thomas Castleman Homepage: https://github.com/drauger-os-development/system-installer Section: admin diff --git a/usr/bin/system-installer.cxx b/usr/bin/system-installer.cxx index 60da35e5..bd356ae2 100644 --- a/usr/bin/system-installer.cxx +++ b/usr/bin/system-installer.cxx @@ -46,7 +46,7 @@ using namespace std; -str VERSION = "2.2.1"; +str VERSION = "2.2.3"; str R = "\033[0;31m"; str G = "\033[0;32m"; str Y = "\033[1;33m"; From b34e17b78b5ced3e387a7a49b7daa272da7aee84 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Thu, 20 Jan 2022 18:43:25 -0500 Subject: [PATCH 086/100] PEP8 improvments --- usr/share/system-installer/modules/make_user.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr/share/system-installer/modules/make_user.py b/usr/share/system-installer/modules/make_user.py index 6e54b691..5255da49 100755 --- a/usr/share/system-installer/modules/make_user.py +++ b/usr/share/system-installer/modules/make_user.py @@ -61,7 +61,8 @@ def make_user(username): try: rmtree("/home/live") except FileNotFoundError: - if username != "home": #literally a 1 in a trillion chance of happening, but just in case + # literally a 1 in a trillion chance of happening, but just in case + if username != "home": rmtree("/home/home") elif os.path.exists("/home/home/live"): __fix_home__(username) From ebc354c92d2bec476e46fedbf60489436f5fbe4a Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Thu, 20 Jan 2022 21:15:37 -0500 Subject: [PATCH 087/100] more intelligent parsing of partition paths --- .../system-installer/auto_partitioner.py | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/usr/share/system-installer/auto_partitioner.py b/usr/share/system-installer/auto_partitioner.py index 5024253e..82168038 100755 --- a/usr/share/system-installer/auto_partitioner.py +++ b/usr/share/system-installer/auto_partitioner.py @@ -82,10 +82,7 @@ def size_of_part(part_path, bytes=False): Else, return size in gigabytes. """ # Get the root Drive - if "nvme" in part_path: - root = part_path[:12] - else: - root = part_path[:8] + root = get_drive_path(part_path) # connect to that drive's partition table device = parted.getDevice(root) try: @@ -102,6 +99,21 @@ def size_of_part(part_path, bytes=False): return size +def get_drive_path(part_path): + """Get drive path from partition path""" + if "nvme" in part_path: + output = part_path[:part_path.index("p")] + else: + count = 0 + for each in part_path: + if not each.isnumeric(): + count+=1 + else: + break + output = part_path[:count] + return output + + def get_min_root_size(swap=True, ram_size=False, ram_size_unit=True, bytes=True): """Get minimum root partition size as bytes @@ -339,11 +351,8 @@ def make_part_boot(part_path): etc... """ - # Get root partiton - if "nvme" in part_path: - root = part_path[:12] - else: - root = part_path[:8] + # Get root drive + root = get_drive_path(part_path) # get Device device = parted.getDevice(root) # get entire partition table @@ -353,7 +362,7 @@ def make_part_boot(part_path): # mark designated partition as bootable try: if "nvme" in part_path: - partitions[int(part_path[13:])].setFlag(parted.PARTITION_BOOT) + partitions[int(part_path[part_path.index("p") + 1:])].setFlag(parted.PARTITION_BOOT) else: partitions[int(part_path[8:])].setFlag(parted.PARTITION_BOOT) except IndexError: @@ -373,10 +382,7 @@ def clobber_disk(device): def delete_part(part_path): """Delete partiton indicated by path""" - if "nvme" in part_path: - device = parted.getDevice(part_path[:-2]) - else: - device = parted.getDevice(part_path[:-1]) + device = parted.getDevice(get_drive_path(part_path)) disk = parted.Disk(device) part = disk.getPartitionByPath(part_path) disk.deletePartition(part) @@ -486,10 +492,7 @@ def partition(root, efi, home, raid_array): return __generate_return_data__(home, efi, part1, part2, part3) # This one we need to figure out if the home partiton is on the drive # we are working on or elsewhere - if "nvme" in home: - check = home[:-2] - else: - check = home[:-1] + check = get_drive_path(home) if root == check: # It IS on the same drive. We need to figure out where at and work # around it From e7061d11249caa79181efe83728a6474a5427a6e Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Thu, 20 Jan 2022 21:16:47 -0500 Subject: [PATCH 088/100] clobber root drive anyways If auto-partitioning, and home partition is not on root drive, we can clobber the root drive. So do so to prevent overlapping partitions --- usr/share/system-installer/auto_partitioner.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/usr/share/system-installer/auto_partitioner.py b/usr/share/system-installer/auto_partitioner.py index 82168038..de55b49c 100755 --- a/usr/share/system-installer/auto_partitioner.py +++ b/usr/share/system-installer/auto_partitioner.py @@ -448,7 +448,12 @@ def partition(root, efi, home, raid_array): common.eprint("FALLING BACK TO NO HOME PARTITION.") home = None else: - common.eprint("HOME PARTITION EXISTS. NOT DELETING PARTITIONS.") + home_drive = get_drive_path(home) + root_drive = get_drive_path(root) + if home_drive == root_drive: + common.eprint("HOME PARTITION EXISTS. NOT DELETING PARTITIONS.") + else: + disk = clobber_disk(device) if size <= LIMITER: if efi: part1 = __make_efi__(device) From e7975ae2d33e14de547d2cec15b70f6e5a248693 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Thu, 20 Jan 2022 21:17:04 -0500 Subject: [PATCH 089/100] use f-strings instead of %s --- usr/share/system-installer/auto_partitioner.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/usr/share/system-installer/auto_partitioner.py b/usr/share/system-installer/auto_partitioner.py index de55b49c..6890a9d9 100755 --- a/usr/share/system-installer/auto_partitioner.py +++ b/usr/share/system-installer/auto_partitioner.py @@ -439,7 +439,7 @@ def partition(root, efi, home, raid_array): elif raid_array["raid_type"] is not None: disk = clobber_disk(device) common.eprint("CREATING RAID ARRAY") - common.eprint("RAID TYPE: %s" % (raid_array["raid_type"])) + common.eprint(f"RAID TYPE: {raid_array['raid_type']}") if not make_raid_array(raid_array["disks"], raid_array["raid_type"]): common.eprint("INITIAL RAID ARRAY CREATION FAILED. FORCING . . .") if not make_raid_array(raid_array["disks"], raid_array["raid_type"], @@ -575,19 +575,19 @@ def make_raid_array(disks: list, raid_type: int, force=False) -> bool: if force: command.insert(1, "-f") if raid_type not in raid_types_dict: - raise ValueError("'%s' not a valid BTRFS RAID type" % (raid_type)) + raise ValueError(f"'{raid_type}' not a valid BTRFS RAID type") if raid_type in (0, 1): if len(disks) < 2: - raise ValueError("Not enough disks for RAID%s" % (raid_type)) + raise ValueError(f"Not enough disks for RAID{raid_type}") elif raid_type == 5: if not 3 <= len(disks) <= 16: raise ValueError("Not enough/Too many disks for RAID5") elif raid_type in (6, 10): if len(disks) < 4: - raise ValueError("Not enough disks for RAID%s" % (raid_type)) + raise ValueError(f"Not enough disks for RAID{raid_type}") for each in disks: if not os.path.exists(each): - raise FileNotFoundError("Device not found: %s" % (each)) + raise FileNotFoundError(f"Device not found: {each}") command.append(raid_types_dict[raid_type]) if raid_type not in (0, 5, 6): command.append("-m") From 19bbc50d14e5ca82621a565906018ffdfb3a0d7d Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Thu, 20 Jan 2022 22:58:01 -0500 Subject: [PATCH 090/100] minor optimizations --- usr/share/system-installer/auto_partitioner.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr/share/system-installer/auto_partitioner.py b/usr/share/system-installer/auto_partitioner.py index 6890a9d9..6a9ff9ac 100755 --- a/usr/share/system-installer/auto_partitioner.py +++ b/usr/share/system-installer/auto_partitioner.py @@ -448,9 +448,10 @@ def partition(root, efi, home, raid_array): common.eprint("FALLING BACK TO NO HOME PARTITION.") home = None else: + # we know there is a pre-existing home partition + # determine if it is on the same drive and act accordingly home_drive = get_drive_path(home) - root_drive = get_drive_path(root) - if home_drive == root_drive: + if home_drive == root: common.eprint("HOME PARTITION EXISTS. NOT DELETING PARTITIONS.") else: disk = clobber_disk(device) @@ -497,8 +498,7 @@ def partition(root, efi, home, raid_array): return __generate_return_data__(home, efi, part1, part2, part3) # This one we need to figure out if the home partiton is on the drive # we are working on or elsewhere - check = get_drive_path(home) - if root == check: + if root == get_drive_path(home): # It IS on the same drive. We need to figure out where at and work # around it # NOTE: WE NEED TO WORK IN MB ONLY IN THIS SECTION From 313dd967064802dcc8943d92dba8ccd728617a3b Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Fri, 21 Jan 2022 11:59:33 -0500 Subject: [PATCH 091/100] attempts to fix root partition bug It seems that we cannot create a root partition on the same drive as the home partition. This needs fixing. --- .../system-installer/auto_partitioner.py | 47 ++++++++++++++----- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/usr/share/system-installer/auto_partitioner.py b/usr/share/system-installer/auto_partitioner.py index 6a9ff9ac..990370f9 100755 --- a/usr/share/system-installer/auto_partitioner.py +++ b/usr/share/system-installer/auto_partitioner.py @@ -264,15 +264,15 @@ def __make_root__(device, start=config["ROOT"]["START"], "MB", device.sectorSize)) end_geo = parted.geometry.Geometry(device=device, - start=parted.sizeToSectors(common.real_number(end - 40), + start=parted.sizeToSectors(common.real_number(end - 100), "MB", device.sectorSize), end=parted.sizeToSectors(end, "MB", device.sectorSize)) - min_size = parted.sizeToSectors(common.real_number((end - start) - 150), + min_size = parted.sizeToSectors(common.real_number((end - start) - 250), "MB", device.sectorSize) - max_size = parted.sizeToSectors(common.real_number((end - start) + 150), + max_size = parted.sizeToSectors(common.real_number((end - start) + 250), "MB", device.sectorSize) const = parted.Constraint(startAlign=device.optimumAlignment, @@ -280,16 +280,39 @@ def __make_root__(device, start=config["ROOT"]["START"], startRange=start_geo, endRange=end_geo, minSize=min_size, maxSize=max_size) - geometry = parted.geometry.Geometry(start=parted.sizeToSectors(start, "MB", - device.sectorSize), - length=parted.sizeToSectors((end - start), - "MB", - device.sectorSize), + geo = parted.geometry.Geometry(start=parted.sizeToSectors(start, "MB", + device.sectorSize), + length=parted.sizeToSectors((end - start), + "MB", + device.sectorSize), device=device) new_part = parted.Partition(disk=disk, type=parted.PARTITION_NORMAL, - geometry=geometry) - disk.addPartition(partition=new_part, constraint=const) + geometry=geo) + try: + disk.addPartition(partition=new_part, constraint=const) + except parted._ped.PartitionException: + # Simply use the geometry of the first free space region, if it is big enough + data = disk.getFreeSpaceRegions() + sizes = {} + for each in data: + sizes[each.length] = each + made = False + for each in sizes: + if sizes[each].getSize(unit="b") >= get_min_root_size(): + new_part = parted.Partition(disk=disk, + type=parted.PARTITION_NORMAL, + geometry=sizes[each]) + try: + disk.addPartition(partition=new_part, constraint=const) + except: + break + made = True + break + if not made: + common.eprint("WAS NOT ABLE TO CREATE ROOT PARTITION. LIKELY NOT ENOUGH SPACE FOR ONE.") + common.eprint("INSTALLATION WILL FAIL") + disk.commit() time.sleep(0.1) __mkfs__(new_part.path, fs) @@ -523,8 +546,8 @@ def partition(root, efi, home, raid_array): else: for each in sizes_sorted: if sizes[each].getSize() >= 200: - part1 = __make_root__(device, start=sizes[each].start, - end=sizes[each].end) + part1 = __make_root__(device, start=sizes[each].start + 1, + end=sizes[each].end - 1) __make_root_boot__(device) break common.eprint("\t###\tauto_partioner.py CLOSED\t###\t") From dd59713ee58624cd8beaddf53025228cd844236e Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Fri, 21 Jan 2022 14:02:18 -0500 Subject: [PATCH 092/100] update constraints --- .../system-installer/auto_partitioner.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/usr/share/system-installer/auto_partitioner.py b/usr/share/system-installer/auto_partitioner.py index 990370f9..e0976aac 100755 --- a/usr/share/system-installer/auto_partitioner.py +++ b/usr/share/system-installer/auto_partitioner.py @@ -300,6 +300,30 @@ def __make_root__(device, start=config["ROOT"]["START"], made = False for each in sizes: if sizes[each].getSize(unit="b") >= get_min_root_size(): + start_geo = parted.geometry.Geometry(device=device, + start=parted.sizeToSectors(common.real_number(sizes[each].start - 500), + "MB", + device.sectorSize), + end=parted.sizeToSectors(sizes[each].start + 500, + "MB", + device.sectorSize)) + end_geo = parted.geometry.Geometry(device=device, + start=parted.sizeToSectors(common.real_number(sizes[each].end - 500), + "MB", + device.sectorSize), + end=parted.sizeToSectors(sizes[each].end + 500, "MB", + device.sectorSize)) + min_size = parted.sizeToSectors(common.real_number((sizes[each].end - sizes[each].start) - 500), + "MB", + device.sectorSize) + max_size = parted.sizeToSectors(common.real_number((sizes[each].end - sizes[each].start) + 500), + "MB", + device.sectorSize) + const = parted.Constraint(startAlign=device.optimumAlignment, + endAlign=device.optimumAlignment, + startRange=start_geo, endRange=end_geo, + minSize=min_size, + maxSize=max_size) new_part = parted.Partition(disk=disk, type=parted.PARTITION_NORMAL, geometry=sizes[each]) From f5a5121d9b8f4f90c25ded57945e0917723e14b2 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Fri, 21 Jan 2022 15:38:56 -0500 Subject: [PATCH 093/100] minor PEP8 improvments --- .../system-installer/auto_partitioner.py | 69 ++++++++++--------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/usr/share/system-installer/auto_partitioner.py b/usr/share/system-installer/auto_partitioner.py index e0976aac..b72205e3 100755 --- a/usr/share/system-installer/auto_partitioner.py +++ b/usr/share/system-installer/auto_partitioner.py @@ -256,19 +256,19 @@ def __make_root__(device, start=config["ROOT"]["START"], except TypeError: pass disk = parted.Disk(device) - start_geo = parted.geometry.Geometry(device=device, - start=parted.sizeToSectors(common.real_number(start - 20), - "MB", - device.sectorSize), - end=parted.sizeToSectors(start + 20, - "MB", - device.sectorSize)) - end_geo = parted.geometry.Geometry(device=device, - start=parted.sizeToSectors(common.real_number(end - 100), - "MB", - device.sectorSize), - end=parted.sizeToSectors(end, "MB", - device.sectorSize)) + s_geo = parted.geometry.Geometry(device=device, + start=parted.sizeToSectors(common.real_number(start - 20), + "MB", + device.sectorSize), + end=parted.sizeToSectors(start + 20, + "MB", + device.sectorSize)) + e_geo = parted.geometry.Geometry(device=device, + start=parted.sizeToSectors(common.real_number(end - 100), + "MB", + device.sectorSize), + end=parted.sizeToSectors(end, "MB", + device.sectorSize)) min_size = parted.sizeToSectors(common.real_number((end - start) - 250), "MB", device.sectorSize) @@ -277,7 +277,7 @@ def __make_root__(device, start=config["ROOT"]["START"], device.sectorSize) const = parted.Constraint(startAlign=device.optimumAlignment, endAlign=device.optimumAlignment, - startRange=start_geo, endRange=end_geo, + startRange=s_geo, endRange=e_geo, minSize=min_size, maxSize=max_size) geo = parted.geometry.Geometry(start=parted.sizeToSectors(start, "MB", @@ -296,37 +296,38 @@ def __make_root__(device, start=config["ROOT"]["START"], data = disk.getFreeSpaceRegions() sizes = {} for each in data: - sizes[each.length] = each + sizes[each.getSize(unit="b")] = each + sizes_sorted = sorted(sizes) made = False - for each in sizes: - if sizes[each].getSize(unit="b") >= get_min_root_size(): - start_geo = parted.geometry.Geometry(device=device, - start=parted.sizeToSectors(common.real_number(sizes[each].start - 500), - "MB", - device.sectorSize), - end=parted.sizeToSectors(sizes[each].start + 500, - "MB", - device.sectorSize)) - end_geo = parted.geometry.Geometry(device=device, - start=parted.sizeToSectors(common.real_number(sizes[each].end - 500), - "MB", - device.sectorSize), - end=parted.sizeToSectors(sizes[each].end + 500, "MB", - device.sectorSize)) - min_size = parted.sizeToSectors(common.real_number((sizes[each].end - sizes[each].start) - 500), + for each in range(len(sizes_sorted) - 1, -1, -1): + if sizes[sizes_sorted[each]].getSize(unit="b") >= get_min_root_size(): + s_geo = parted.geometry.Geometry(device=device, + start=parted.sizeToSectors(common.real_number(sizes[sizes_sorted[each]].start - 500), + "MB", + device.sectorSize), + end=parted.sizeToSectors(sizes[sizes_sorted[each]].start + 500, + "MB", + device.sectorSize)) + e_geo = parted.geometry.Geometry(device=device, + start=parted.sizeToSectors(common.real_number(sizes[sizes_sorted[each]].end - 500), + "MB", + device.sectorSize), + end=parted.sizeToSectors(sizes[sizes_sorted[each]].end + 500, "MB", + device.sectorSize)) + min_size = parted.sizeToSectors(common.real_number((sizes[sizes_sorted[each]].end - sizes[sizes_sorted[each]].start) - 500), "MB", device.sectorSize) - max_size = parted.sizeToSectors(common.real_number((sizes[each].end - sizes[each].start) + 500), + max_size = parted.sizeToSectors(common.real_number((sizes[sizes_sorted[each]].end - sizes[sizes_sorted[each]].start) + 500), "MB", device.sectorSize) const = parted.Constraint(startAlign=device.optimumAlignment, endAlign=device.optimumAlignment, - startRange=start_geo, endRange=end_geo, + startRange=s_geo, endRange=e_geo, minSize=min_size, maxSize=max_size) new_part = parted.Partition(disk=disk, type=parted.PARTITION_NORMAL, - geometry=sizes[each]) + geometry=sizes[sizes_sorted[each]]) try: disk.addPartition(partition=new_part, constraint=const) except: From 5ee252fb6e67ad966a8999f802832208c5427a73 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Mon, 24 Jan 2022 13:14:27 -0500 Subject: [PATCH 094/100] allow more flexibiltiy to PyParted --- usr/share/system-installer/auto_partitioner.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/usr/share/system-installer/auto_partitioner.py b/usr/share/system-installer/auto_partitioner.py index b72205e3..f4b4023e 100755 --- a/usr/share/system-installer/auto_partitioner.py +++ b/usr/share/system-installer/auto_partitioner.py @@ -302,22 +302,22 @@ def __make_root__(device, start=config["ROOT"]["START"], for each in range(len(sizes_sorted) - 1, -1, -1): if sizes[sizes_sorted[each]].getSize(unit="b") >= get_min_root_size(): s_geo = parted.geometry.Geometry(device=device, - start=parted.sizeToSectors(common.real_number(sizes[sizes_sorted[each]].start - 500), + start=parted.sizeToSectors(common.real_number(sizes[sizes_sorted[each]].start - 2000), "MB", device.sectorSize), - end=parted.sizeToSectors(sizes[sizes_sorted[each]].start + 500, + end=parted.sizeToSectors(sizes[sizes_sorted[each]].start + 2000, "MB", device.sectorSize)) e_geo = parted.geometry.Geometry(device=device, - start=parted.sizeToSectors(common.real_number(sizes[sizes_sorted[each]].end - 500), + start=parted.sizeToSectors(common.real_number(sizes[sizes_sorted[each]].end - 2000), "MB", device.sectorSize), - end=parted.sizeToSectors(sizes[sizes_sorted[each]].end + 500, "MB", + end=parted.sizeToSectors(sizes[sizes_sorted[each]].end + 2000, "MB", device.sectorSize)) - min_size = parted.sizeToSectors(common.real_number((sizes[sizes_sorted[each]].end - sizes[sizes_sorted[each]].start) - 500), + min_size = parted.sizeToSectors(common.real_number((sizes[sizes_sorted[each]].end - sizes[sizes_sorted[each]].start) - 2000), "MB", device.sectorSize) - max_size = parted.sizeToSectors(common.real_number((sizes[sizes_sorted[each]].end - sizes[sizes_sorted[each]].start) + 500), + max_size = parted.sizeToSectors(common.real_number((sizes[sizes_sorted[each]].end - sizes[sizes_sorted[each]].start) + 2000), "MB", device.sectorSize) const = parted.Constraint(startAlign=device.optimumAlignment, From fed27468300ea701dbdf0e29b015bc730fde5e59 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Mon, 24 Jan 2022 13:16:43 -0500 Subject: [PATCH 095/100] Fix occasional key error, print traceback when it occurs again --- usr/share/system-installer/UI/main.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/usr/share/system-installer/UI/main.py b/usr/share/system-installer/UI/main.py index 79d0b798..b6661a6d 100755 --- a/usr/share/system-installer/UI/main.py +++ b/usr/share/system-installer/UI/main.py @@ -31,6 +31,7 @@ import subprocess import gi import auto_partitioner +import traceback gi.require_version('Gtk', '3.0') @@ -986,21 +987,26 @@ def auto_home_setup2(self, widget): continue elif 'children' in device: for child in device['children']: - if not child['type'] == 'part': # if it isn't labeled partition, skip - continue + if "type" not in child.keys(): # if it doesn't have a label, skip + continue + elif not child['type'] == 'part': # if it isn't labeled partition, skip + continue test_child = {'name' : child['name'], 'size' : child['size']} if test_child not in new_dev_list: # make sure child object is not already in dev_list new_dev_list.append(test_child) - elif not device['type'] == 'part': # if it isn't labeled partition, skip + elif "type" not in device.keys(): # if it doesn't have a label, skip + continue + elif device['type'] != 'part': # if it isn't labeled partition, skip continue else: new_device = {'name' : device['name'], 'size' : device['size']} new_dev_list.append(new_device) except KeyError: - pass # todo: use traceback module to print the traceback to stderr + common.eprint(traceback.format_exc()) + print(json.dumps(device, indent=2)) home_cmbbox = Gtk.ComboBoxText.new() From 89ab906af33b4128b6346d7c97f8b6cc4ff6baef Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Mon, 24 Jan 2022 13:17:51 -0500 Subject: [PATCH 096/100] remove ability to use home partitions on same drive as root part This is to prevent a major bug which prevents successful installation from occuring. --- usr/share/system-installer/UI/main.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/usr/share/system-installer/UI/main.py b/usr/share/system-installer/UI/main.py index b6661a6d..c8ce2dab 100755 --- a/usr/share/system-installer/UI/main.py +++ b/usr/share/system-installer/UI/main.py @@ -1008,6 +1008,12 @@ def auto_home_setup2(self, widget): common.eprint(traceback.format_exc()) print(json.dumps(device, indent=2)) + # TEMPORARY: Remove the ability to use a home partition on the same + # drive as where the root partition is + for each in range(len(new_dev_list) - 1, -1, -1): + if self.data["ROOT"][5:] in new_dev_list[each]["name"]: + del new_dev_list[each] + home_cmbbox = Gtk.ComboBoxText.new() # properly format device names and add to combo box From 2c7b44c0eb0bba1ff4495846d6a7e75404252382 Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Mon, 24 Jan 2022 13:32:48 -0500 Subject: [PATCH 097/100] Everyone likes PIE Keep the compiler happy using the PIE flag --- DEBIAN/control | 2 +- build.sh | 2 +- usr/bin/system-installer.cxx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DEBIAN/control b/DEBIAN/control index 0da77c0e..421ad18d 100644 --- a/DEBIAN/control +++ b/DEBIAN/control @@ -1,5 +1,5 @@ Package: system-installer -Version: 2.2.3 +Version: 2.2.5 Maintainer: Thomas Castleman Homepage: https://github.com/drauger-os-development/system-installer Section: admin diff --git a/build.sh b/build.sh index 0cec14d1..40bab416 100755 --- a/build.sh +++ b/build.sh @@ -55,7 +55,7 @@ fi # Pshyc - we're compiling shit now cd usr/bin -g++ -m64 -o system-installer system-installer.cxx $(python3.9-config --ldflags --cflags --embed) +g++ -fPIE -m64 -o system-installer system-installer.cxx $(python3.9-config --ldflags --cflags --embed) cd ../.. ############################################################## # # diff --git a/usr/bin/system-installer.cxx b/usr/bin/system-installer.cxx index bd356ae2..0a1fd750 100644 --- a/usr/bin/system-installer.cxx +++ b/usr/bin/system-installer.cxx @@ -46,7 +46,7 @@ using namespace std; -str VERSION = "2.2.3"; +str VERSION = "2.2.5"; str R = "\033[0;31m"; str G = "\033[0;32m"; str Y = "\033[1;33m"; From b2ed2cad8103f454f7ff58161a3920696b509aaf Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Mon, 24 Jan 2022 13:49:27 -0500 Subject: [PATCH 098/100] minor PEP8 improvements --- usr/share/system-installer/UI/main.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/usr/share/system-installer/UI/main.py b/usr/share/system-installer/UI/main.py index c8ce2dab..274aeeeb 100755 --- a/usr/share/system-installer/UI/main.py +++ b/usr/share/system-installer/UI/main.py @@ -38,9 +38,6 @@ from gi.repository import Gtk - - - def has_special_character(input_string): """Check for special characters""" regex = re.compile(r'[@_!#$%^&*()<>?/\|}{~:]') @@ -553,7 +550,7 @@ def auto_partition(self, button): # Get a list of disks and their capacity self.devices = json.loads(subprocess.check_output(["lsblk", "-n", "-i", "--json", - "-o", "NAME,SIZE,TYPE"]).decode()) + "-o", "NAME,SIZE,TYPE"]).decode()) self.devices = self.devices["blockdevices"] dev = [] for each2 in enumerate(self.devices): @@ -907,9 +904,7 @@ def make_space_parts(self, widget): if "children" in each: for each1 in each["children"]: self.parts.append(each1["name"], - "%s, filesystem: %s, size: %sGB" % (each1["name"], - each1["fstype"], - int(auto_partitioner.bytes_to_gb(each1["size"])))) + f"{each1['name']}, filesystem: {each1['fstype']}, size: {int(auto_partitioner.bytes_to_gb(each1['size']))}GB") self.show_all() def confirm_remove_part(self, widget): From a4b85ef45d7c900dee3bc7d118cee3bfaadf7a6a Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Mon, 24 Jan 2022 14:19:15 -0500 Subject: [PATCH 099/100] more minor PEP8 improvements --- usr/share/system-installer/UI/main.py | 30 ++++++++----------- .../system-installer/auto_partitioner.py | 2 +- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/usr/share/system-installer/UI/main.py b/usr/share/system-installer/UI/main.py index 274aeeeb..d87fa081 100755 --- a/usr/share/system-installer/UI/main.py +++ b/usr/share/system-installer/UI/main.py @@ -949,7 +949,6 @@ def remove_part(self, widget): else: self.make_space("clicked", drive=part[:-1]) - def auto_home_setup(self, widget): """Handle preexisting vs making a new home directory""" if widget.get_active(): @@ -972,31 +971,30 @@ def auto_home_setup2(self, widget): """Provide options for prexisting home partitions""" if widget.get_active() == 1: dev_list = tuple(self.devices) - new_dev_list = [] # this will be the final list that is displayed for the user - + new_dev_list = [] # this will be the final list that is displayed for the user # todo: account for BTRFS drives that have no partitions - for device in dev_list: # we will iterate through the dev list and add devices to the new list + for device in dev_list: # we will iterate through the dev list and add devices to the new list try: - if device == []: # if the device is empty, we skip + if device == []: # if the device is empty, we skip continue elif 'children' in device: for child in device['children']: - if "type" not in child.keys(): # if it doesn't have a label, skip + if "type" not in child.keys(): # if it doesn't have a label, skip continue - elif not child['type'] == 'part': # if it isn't labeled partition, skip + elif not child['type'] == 'part': # if it isn't labeled partition, skip continue - test_child = {'name' : child['name'], 'size' : child['size']} + test_child = {'name': child['name'], 'size': child['size']} - if test_child not in new_dev_list: # make sure child object is not already in dev_list + if test_child not in new_dev_list: # make sure child object is not already in dev_list new_dev_list.append(test_child) - elif "type" not in device.keys(): # if it doesn't have a label, skip + elif "type" not in device.keys(): # if it doesn't have a label, skip continue - elif device['type'] != 'part': # if it isn't labeled partition, skip + elif device['type'] != 'part': # if it isn't labeled partition, skip continue else: - new_device = {'name' : device['name'], 'size' : device['size']} + new_device = {'name': device['name'], 'size': device['size']} new_dev_list.append(new_device) except KeyError: @@ -1072,7 +1070,7 @@ def confirm_auto_part(self, button): self.main_menu("clicked") - def set_up_partitioner_label(self, additional_message = ""): + def set_up_partitioner_label(self, additional_message=""): """prepare top label for display on manual partitioner Keyword arguments: @@ -1099,7 +1097,6 @@ def set_up_partitioner_label(self, additional_message = ""): return label - def input_part(self, button): """Manual Partitioning Input Window""" self.clear_window() @@ -1508,8 +1505,7 @@ def update_subregion(self, widget): """ if widget.get_active_id() is None: return - zones = sorted(os.listdir("/usr/share/zoneinfo/" - + widget.get_active_id())) + zones = sorted(os.listdir("/usr/share/zoneinfo/" + widget.get_active_id())) self.grid.remove(self.grid.get_child_at(2, 7)) self.sub_region = Gtk.ComboBoxText.new() for each7 in zones: @@ -1632,7 +1628,6 @@ def varient_narrower(self, widget): self.show_all() - def on_keyboard_completed(self, button): """Set default keyboard layout if user did not specify one""" if self.model_menu.get_active_id() is not None: @@ -1656,7 +1651,6 @@ def on_keyboard_completed(self, button): self.main_menu("clicked") - def done(self, button): """Check to see if each segment has been completed If it hasn't, print a warning, else diff --git a/usr/share/system-installer/auto_partitioner.py b/usr/share/system-installer/auto_partitioner.py index f4b4023e..2554cf93 100755 --- a/usr/share/system-installer/auto_partitioner.py +++ b/usr/share/system-installer/auto_partitioner.py @@ -285,7 +285,7 @@ def __make_root__(device, start=config["ROOT"]["START"], length=parted.sizeToSectors((end - start), "MB", device.sectorSize), - device=device) + device=device) new_part = parted.Partition(disk=disk, type=parted.PARTITION_NORMAL, geometry=geo) From ec5486bef70e94cd28abc896cd3414ddee62dada Mon Sep 17 00:00:00 2001 From: Thomas Castleman Date: Mon, 24 Jan 2022 17:07:23 -0500 Subject: [PATCH 100/100] make sure root partition is big enough On systems where the root drive is small, and EFI was in use, and a seperate /home partition was being used on a different drive, root partitions where not being made big enough. Fixed that. --- DEBIAN/control | 2 +- usr/bin/system-installer.cxx | 2 +- usr/share/system-installer/auto_partitioner.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DEBIAN/control b/DEBIAN/control index 421ad18d..1d7a0271 100644 --- a/DEBIAN/control +++ b/DEBIAN/control @@ -1,5 +1,5 @@ Package: system-installer -Version: 2.2.5 +Version: 2.2.6 Maintainer: Thomas Castleman Homepage: https://github.com/drauger-os-development/system-installer Section: admin diff --git a/usr/bin/system-installer.cxx b/usr/bin/system-installer.cxx index 0a1fd750..4210db94 100644 --- a/usr/bin/system-installer.cxx +++ b/usr/bin/system-installer.cxx @@ -46,7 +46,7 @@ using namespace std; -str VERSION = "2.2.5"; +str VERSION = "2.2.6"; str R = "\033[0;31m"; str G = "\033[0;32m"; str Y = "\033[1;33m"; diff --git a/usr/share/system-installer/auto_partitioner.py b/usr/share/system-installer/auto_partitioner.py index 2554cf93..0f617208 100755 --- a/usr/share/system-installer/auto_partitioner.py +++ b/usr/share/system-installer/auto_partitioner.py @@ -580,7 +580,7 @@ def partition(root, efi, home, raid_array): # it's elsewhere. We're good. if efi: part1 = __make_efi__(device) - part2 = __make_root__(device) + part2 = __make_root__(device, end="100%") else: part1 = __make_root__(device, start="0%", end="100%") __make_root_boot__(device)