From 1708f1850d5d620e7a44ab4da4a9c5c028f5008b Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 29 Apr 2021 10:01:43 +0200 Subject: Fixes #350 hopefully. This reverts an old hotfix to make systemd-boot work with dualboot variables. This **NEEDS** to be tested together with a Windows installation dual-boot setup, because this is where variable writing caused issues before. --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index a5449662..236b69d8 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -377,7 +377,7 @@ class Installer(): # And in which case we should do some clean up. # Install the boot loader - sys_command(f'/usr/bin/arch-chroot {self.target} bootctl --no-variables --path=/boot install') + sys_command(f'/usr/bin/arch-chroot {self.target} bootctl --path=/boot install') # Modify or create a loader.conf if os.path.isfile(f'{self.target}/boot/loader/loader.conf'): -- cgit v1.2.3-54-g00ecf From acf85f254acc9e72b32c04c53c4517a5dad07df9 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 30 Apr 2021 16:55:33 +0200 Subject: Moved mkinitcpio variables They now live as a installation-session variable. Not just minimal installation. --- archinstall/lib/installer.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 61ac737c..3dfcd32b 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -57,6 +57,11 @@ class Installer(): storage['session'] = self self.partitions = get_partitions_in_use(self.target) + self.MODULES = [] + self.BINARIES = [] + self.FILES = [] + self.HOOKS = ["base", "udev", "autodetect", "keyboard", "keymap", "modconf", "block", "filesystems", "fsck"] + def log(self, *args, level=logging.DEBUG, **kwargs): """ installer.log() wraps output.log() mainly to set a default log-level for this install session. @@ -284,10 +289,7 @@ class Installer(): ## TODO: Perhaps this should be living in the function which dictates ## the partitioning. Leaving here for now. - MODULES = [] - BINARIES = [] - FILES = [] - HOOKS = ["base", "udev", "autodetect", "keyboard", "keymap", "modconf", "block", "filesystems", "fsck"] + for partition in self.partitions: if partition.filesystem == 'btrfs': @@ -300,14 +302,14 @@ class Installer(): # Configure mkinitcpio to handle some specific use cases. if partition.filesystem == 'btrfs': - if 'btrfs' not in MODULES: - MODULES.append('btrfs') - if '/usr/bin/btrfs-progs' not in BINARIES: - BINARIES.append('/usr/bin/btrfs') + if 'btrfs' not in self.MODULES: + self.MODULES.append('btrfs') + if '/usr/bin/btrfs-progs' not in self.BINARIES: + self.BINARIES.append('/usr/bin/btrfs') if self.detect_encryption(partition): - if 'encrypt' not in HOOKS: - HOOKS.insert(HOOKS.index('filesystems'), 'encrypt') + if 'encrypt' not in self.HOOKS: + self.HOOKS.insert(self.HOOKS.index('filesystems'), 'encrypt') if not(hasUEFI()): # TODO: Allow for grub even on EFI self.base_packages.append('grub') @@ -339,10 +341,10 @@ class Installer(): sys_command(f'/usr/bin/arch-chroot {self.target} chmod 700 /root') with open(f'{self.target}/etc/mkinitcpio.conf', 'w') as mkinit: - mkinit.write(f"MODULES=({' '.join(MODULES)})\n") - mkinit.write(f"BINARIES=({' '.join(BINARIES)})\n") - mkinit.write(f"FILES=({' '.join(FILES)})\n") - mkinit.write(f"HOOKS=({' '.join(HOOKS)})\n") + mkinit.write(f"MODULES=({' '.join(self.MODULES)})\n") + mkinit.write(f"BINARIES=({' '.join(self.BINARIES)})\n") + mkinit.write(f"FILES=({' '.join(self.FILES)})\n") + mkinit.write(f"HOOKS=({' '.join(self.HOOKS)})\n") sys_command(f'/usr/bin/arch-chroot {self.target} mkinitcpio -P') self.helper_flags['base'] = True -- cgit v1.2.3-54-g00ecf From cccb6bd5b31f32189bb13c81aa799b9ea7feff58 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 30 Apr 2021 17:04:55 +0200 Subject: Moved/Created mkinitcpio func --- archinstall/lib/installer.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 3dfcd32b..9f04a6f6 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -283,6 +283,14 @@ class Installer(): return False + def mkinitcpio(self, *flags): + with open(f'{self.target}/etc/mkinitcpio.conf', 'w') as mkinit: + mkinit.write(f"MODULES=({' '.join(self.MODULES)})\n") + mkinit.write(f"BINARIES=({' '.join(self.BINARIES)})\n") + mkinit.write(f"FILES=({' '.join(self.FILES)})\n") + mkinit.write(f"HOOKS=({' '.join(self.HOOKS)})\n") + sys_command(f'/usr/bin/arch-chroot {self.target} mkinitcpio {" ".join(flags)}') + def minimal_installation(self): ## Add necessary packages if encrypting the drive ## (encrypted partitions default to btrfs for now, so we need btrfs-progs) @@ -340,12 +348,7 @@ class Installer(): # TODO: Use python functions for this sys_command(f'/usr/bin/arch-chroot {self.target} chmod 700 /root') - with open(f'{self.target}/etc/mkinitcpio.conf', 'w') as mkinit: - mkinit.write(f"MODULES=({' '.join(self.MODULES)})\n") - mkinit.write(f"BINARIES=({' '.join(self.BINARIES)})\n") - mkinit.write(f"FILES=({' '.join(self.FILES)})\n") - mkinit.write(f"HOOKS=({' '.join(self.HOOKS)})\n") - sys_command(f'/usr/bin/arch-chroot {self.target} mkinitcpio -P') + self.mkinitcpio('-P') self.helper_flags['base'] = True -- cgit v1.2.3-54-g00ecf From 33a3f803913eab8f503d6b131d7679fa663acbb2 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 30 Apr 2021 17:11:25 +0200 Subject: Adding support for kernel params --- archinstall/lib/installer.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 9f04a6f6..b9857ccd 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -61,6 +61,7 @@ class Installer(): self.BINARIES = [] self.FILES = [] self.HOOKS = ["base", "udev", "autodetect", "keyboard", "keymap", "modconf", "block", "filesystems", "fsck"] + self.KERNEL_PARAMS = [] def log(self, *args, level=logging.DEBUG, **kwargs): """ @@ -425,10 +426,10 @@ class Installer(): # TODO: We need to detect if the encrypted device is a whole disk encryption, # or simply a partition encryption. Right now we assume it's a partition (and we always have) log(f"Identifying root partition by PART-UUID on {real_device}: '{real_device.uuid}'.", level=logging.DEBUG) - entry.write(f'options cryptdevice=PARTUUID={real_device.uuid}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp\n') + entry.write(f'options cryptdevice=PARTUUID={real_device.uuid}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp {" ".join(self.KERNEL_PARAMS)}\n') else: log(f"Identifying root partition by PART-UUID on {root_partition}, looking for '{root_partition.uuid}'.", level=logging.DEBUG) - entry.write(f'options root=PARTUUID={root_partition.uuid} rw intel_pstate=no_hwp\n') + entry.write(f'options root=PARTUUID={root_partition.uuid} rw intel_pstate=no_hwp {" ".join(self.KERNEL_PARAMS)}\n') self.helper_flags['bootloader'] = bootloader return True -- cgit v1.2.3-54-g00ecf From 4ff35663b80e1bb40c44d4ceee85700ef428cab0 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 12 May 2021 13:55:41 +0200 Subject: Replaced the magic __builtin__ global variable. This should fix mypy complaints while still retaining the same functionality, kinda. It's less automatic but it's also less of dark magic, which makes sense for anyone but me. --- archinstall/lib/installer.py | 9 +-------- profiles/52-54-00-12-34-56.py | 2 +- profiles/applications/awesome.py | 8 ++++---- profiles/applications/cockpit.py | 4 ++-- profiles/applications/docker.py | 4 ++-- profiles/applications/httpd.py | 4 ++-- profiles/applications/lighttpd.py | 4 ++-- profiles/applications/mariadb.py | 6 +++--- profiles/applications/nginx.py | 4 ++-- profiles/applications/postgresql.py | 6 +++--- profiles/applications/sshd.py | 4 ++-- profiles/applications/tomcat.py | 4 ++-- profiles/awesome.py | 12 ++++++------ profiles/budgie.py | 6 +++--- profiles/cinnamon.py | 6 +++--- profiles/deepin.py | 6 +++--- profiles/desktop.py | 8 +++----- profiles/gnome.py | 6 +++--- profiles/i3.py | 10 +++++----- profiles/kde.py | 6 +++--- profiles/lxqt.py | 6 +++--- profiles/mate.py | 6 +++--- profiles/server.py | 2 +- profiles/sway.py | 4 ++-- profiles/xfce4.py | 6 +++--- profiles/xorg.py | 22 ++++++---------------- 26 files changed, 73 insertions(+), 92 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 331762b4..e5120ff1 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -452,14 +452,7 @@ class Installer(): return self.pacstrap(*packages) def install_profile(self, profile): - # TODO: Replace this with a import archinstall.session instead in the profiles. - # The tricky thing with doing the import archinstall.session instead is that - # profiles might be run from a different chroot, and there's no way we can - # guarantee file-path safety when accessing the installer object that way. - # Doing the __builtins__ replacement, ensures that the global variable "installation" - # is always kept up to date. It's considered a nasty hack - but it's a safe way - # of ensuring 100% accuracy of archinstall session variables. - __builtins__['installation'] = self + storage['installation_session'] = self if type(profile) == str: profile = Profile(self, profile) diff --git a/profiles/52-54-00-12-34-56.py b/profiles/52-54-00-12-34-56.py index a3347760..28cd14f6 100644 --- a/profiles/52-54-00-12-34-56.py +++ b/profiles/52-54-00-12-34-56.py @@ -5,7 +5,7 @@ import urllib.request __packages__ = ['nano', 'wget', 'git'] if __name__ == '52-54-00-12-34-56': - awesome = archinstall.Application(installation, 'postgresql') + awesome = archinstall.Application(archinstall.storage['installation_session'], 'postgresql') awesome.install() """ diff --git a/profiles/applications/awesome.py b/profiles/applications/awesome.py index a63c707b..d5a8e793 100644 --- a/profiles/applications/awesome.py +++ b/profiles/applications/awesome.py @@ -2,11 +2,11 @@ import archinstall __packages__ = ["awesome", "xorg-xrandr", "xterm", "feh", "slock", "terminus-font", "gnu-free-fonts", "ttf-liberation", "xsel"] -installation.install_profile('xorg') +archinstall.storage['installation_session'].install_profile('xorg') -installation.add_additional_packages(__packages__) +archinstall.storage['installation_session'].add_additional_packages(__packages__) -with open(f'{installation.target}/etc/X11/xinit/xinitrc', 'r') as xinitrc: +with open(f"{archinstall.storage['installation_session'].target}/etc/X11/xinit/xinitrc", 'r') as xinitrc: xinitrc_data = xinitrc.read() for line in xinitrc_data.split('\n'): @@ -20,5 +20,5 @@ for line in xinitrc_data.split('\n'): xinitrc_data += '\n' xinitrc_data += 'exec awesome\n' -with open(f'{installation.target}/etc/X11/xinit/xinitrc', 'w') as xinitrc: +with open(f"{archinstall.storage['installation_session'].target}/etc/X11/xinit/xinitrc", 'w') as xinitrc: xinitrc.write(xinitrc_data) diff --git a/profiles/applications/cockpit.py b/profiles/applications/cockpit.py index f1cea1d2..8a0ede9d 100644 --- a/profiles/applications/cockpit.py +++ b/profiles/applications/cockpit.py @@ -4,6 +4,6 @@ import archinstall # which packages will be installed by this profile __packages__ = ["cockpit", "udisks2", "packagekit"] -installation.add_additional_packages(__packages__) +archinstall.storage['installation_session'].add_additional_packages(__packages__) -installation.enable_service('cockpit.socket') +archinstall.storage['installation_session'].enable_service('cockpit.socket') diff --git a/profiles/applications/docker.py b/profiles/applications/docker.py index afa3f8fb..afbde1a5 100644 --- a/profiles/applications/docker.py +++ b/profiles/applications/docker.py @@ -4,6 +4,6 @@ import archinstall # which packages will be installed by this profile __packages__ = ["docker"] -installation.add_additional_packages(__packages__) +archinstall.storage['installation_session'].add_additional_packages(__packages__) -installation.enable_service('docker') +archinstall.storage['installation_session'].enable_service('docker') diff --git a/profiles/applications/httpd.py b/profiles/applications/httpd.py index 00d64b6e..23b3fefa 100644 --- a/profiles/applications/httpd.py +++ b/profiles/applications/httpd.py @@ -4,6 +4,6 @@ import archinstall # which packages will be installed by this profile __packages__ = ["apache"] -installation.add_additional_packages(__packages__) +archinstall.storage['installation_session'].add_additional_packages(__packages__) -installation.enable_service('httpd') +archinstall.storage['installation_session'].enable_service('httpd') diff --git a/profiles/applications/lighttpd.py b/profiles/applications/lighttpd.py index a1e6a371..71158861 100644 --- a/profiles/applications/lighttpd.py +++ b/profiles/applications/lighttpd.py @@ -4,6 +4,6 @@ import archinstall # which packages will be installed by this profile __packages__ = ["lighttpd"] -installation.add_additional_packages(__packages__) +archinstall.storage['installation_session'].add_additional_packages(__packages__) -installation.enable_service('lighttpd') +archinstall.storage['installation_session'].enable_service('lighttpd') diff --git a/profiles/applications/mariadb.py b/profiles/applications/mariadb.py index e458a45a..bdde18b5 100644 --- a/profiles/applications/mariadb.py +++ b/profiles/applications/mariadb.py @@ -4,8 +4,8 @@ import archinstall # which packages will be installed by this profile __packages__ = ["mariadb"] -installation.add_additional_packages(__packages__) +archinstall.storage['installation_session'].add_additional_packages(__packages__) -installation.arch_chroot("mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql") +archinstall.storage['installation_session'].arch_chroot("mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql") -installation.enable_service('mariadb') +archinstall.storage['installation_session'].enable_service('mariadb') diff --git a/profiles/applications/nginx.py b/profiles/applications/nginx.py index 50eb0506..6f63b15c 100644 --- a/profiles/applications/nginx.py +++ b/profiles/applications/nginx.py @@ -4,6 +4,6 @@ import archinstall # which packages will be installed by this profile __packages__ = ["nginx"] -installation.add_additional_packages(__packages__) +archinstall.storage['installation_session'].add_additional_packages(__packages__) -installation.enable_service('nginx') +archinstall.storage['installation_session'].enable_service('nginx') diff --git a/profiles/applications/postgresql.py b/profiles/applications/postgresql.py index fcdce824..3f8c6950 100644 --- a/profiles/applications/postgresql.py +++ b/profiles/applications/postgresql.py @@ -4,8 +4,8 @@ import archinstall # which packages will be installed by this profile __packages__ = ["postgresql"] -installation.add_additional_packages(__packages__) +archinstall.storage['installation_session'].add_additional_packages(__packages__) -installation.arch_chroot("initdb -D /var/lib/postgres/data", runas='postgres') +archinstall.storage['installation_session'].arch_chroot("initdb -D /var/lib/postgres/data", runas='postgres') -installation.enable_service('postgresql') \ No newline at end of file +archinstall.storage['installation_session'].enable_service('postgresql') \ No newline at end of file diff --git a/profiles/applications/sshd.py b/profiles/applications/sshd.py index 234638d5..4199ecb0 100644 --- a/profiles/applications/sshd.py +++ b/profiles/applications/sshd.py @@ -4,6 +4,6 @@ import archinstall # which packages will be installed by this profile __packages__ = ["openssh"] -installation.add_additional_packages(__packages__) +archinstall.storage['installation_session'].add_additional_packages(__packages__) -installation.enable_service('sshd') +archinstall.storage['installation_session'].enable_service('sshd') diff --git a/profiles/applications/tomcat.py b/profiles/applications/tomcat.py index 9c521390..ae6d1c2a 100644 --- a/profiles/applications/tomcat.py +++ b/profiles/applications/tomcat.py @@ -7,6 +7,6 @@ import archinstall # which packages will be installed by this profile __packages__ = ["tomcat10"] -installation.add_additional_packages(__packages__) +archinstall.storage['installation_session'].add_additional_packages(__packages__) -installation.enable_service('tomcat10') +archinstall.storage['installation_session'].enable_service('tomcat10') diff --git a/profiles/awesome.py b/profiles/awesome.py index a5dedccd..8ee113f4 100644 --- a/profiles/awesome.py +++ b/profiles/awesome.py @@ -30,23 +30,23 @@ def _prep_function(*args, **kwargs): # or through conventional import awesome if __name__ == 'awesome': # Install the application awesome from the template under /applications/ - awesome = archinstall.Application(installation, 'awesome') + awesome = archinstall.Application(archinstall.storage['installation_session'], 'awesome') awesome.install() - installation.add_additional_packages(__packages__) + archinstall.storage['installation_session'].add_additional_packages(__packages__) # TODO: Copy a full configuration to ~/.config/awesome/rc.lua instead. - with open(f'{installation.target}/etc/xdg/awesome/rc.lua', 'r') as fh: + with open(f'{archinstall.storage['installation_session'].target}/etc/xdg/awesome/rc.lua', 'r') as fh: awesome_lua = fh.read() ## Replace xterm with alacritty for a smoother experience. awesome_lua = awesome_lua.replace('"xterm"', '"alacritty"') - with open(f'{installation.target}/etc/xdg/awesome/rc.lua', 'w') as fh: + with open(f'{archinstall.storage['installation_session'].target}/etc/xdg/awesome/rc.lua', 'w') as fh: fh.write(awesome_lua) ## TODO: Configure the right-click-menu to contain the above packages that were installed. (as a user config) ## Remove some interfering nemo settings - installation.arch_chroot("gsettings set org.nemo.desktop show-desktop-icons false") - installation.arch_chroot("xdg-mime default nemo.desktop inode/directory application/x-gnome-saved-search") + archinstall.storage['installation_session'].arch_chroot("gsettings set org.nemo.desktop show-desktop-icons false") + archinstall.storage['installation_session'].arch_chroot("xdg-mime default nemo.desktop inode/directory application/x-gnome-saved-search") diff --git a/profiles/budgie.py b/profiles/budgie.py index fc061cd2..dbbd3a9d 100644 --- a/profiles/budgie.py +++ b/profiles/budgie.py @@ -28,9 +28,9 @@ def _prep_function(*args, **kwargs): # or through conventional import budgie if __name__ == 'budgie': # Install dependency profiles - installation.install_profile('xorg') + archinstall.storage['installation_session'].install_profile('xorg') # Install the Budgie packages - installation.add_additional_packages(__packages__) + archinstall.storage['installation_session'].add_additional_packages(__packages__) - installation.enable_service('lightdm') # Light Display Manager + archinstall.storage['installation_session'].enable_service('lightdm') # Light Display Manager diff --git a/profiles/cinnamon.py b/profiles/cinnamon.py index 4ca9cfed..89798671 100644 --- a/profiles/cinnamon.py +++ b/profiles/cinnamon.py @@ -27,9 +27,9 @@ def _prep_function(*args, **kwargs): # or through conventional import cinnamon if __name__ == 'cinnamon': # Install dependency profiles - installation.install_profile('xorg') + archinstall.storage['installation_session'].install_profile('xorg') # Install the Cinnamon packages - installation.add_additional_packages(__packages__) + archinstall.storage['installation_session'].add_additional_packages(__packages__) - installation.enable_service('lightdm') # Light Display Manager + archinstall.storage['installation_session'].enable_service('lightdm') # Light Display Manager diff --git a/profiles/deepin.py b/profiles/deepin.py index ce59a699..47fbe13f 100644 --- a/profiles/deepin.py +++ b/profiles/deepin.py @@ -28,10 +28,10 @@ def _prep_function(*args, **kwargs): # or through conventional import deepin if __name__ == 'deepin': # Install dependency profiles - installation.install_profile('xorg') + archinstall.storage['installation_session'].install_profile('xorg') # Install the Deepin packages - installation.add_additional_packages(__packages__) + archinstall.storage['installation_session'].add_additional_packages(__packages__) # Enable autostart of Deepin for all users - installation.enable_service('lightdm') + archinstall.storage['installation_session'].enable_service('lightdm') diff --git a/profiles/desktop.py b/profiles/desktop.py index 2aea6d30..d4c13239 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -48,9 +48,7 @@ if __name__ == 'desktop': """ # Install common packages for all desktop environments - installation.add_additional_packages(__packages__) - - # TODO: Remove magic variable 'installation' and place it - # in archinstall.storage or archinstall.session/archinstall.installation - installation.install_profile(archinstall.storage['_desktop_profile']) + archinstall.storage['installation_session'].add_additional_packages(__packages__) + + archinstall.storage['installation_session'].install_profile(archinstall.storage['_desktop_profile']) diff --git a/profiles/gnome.py b/profiles/gnome.py index 77c90859..e6cc75c0 100644 --- a/profiles/gnome.py +++ b/profiles/gnome.py @@ -29,11 +29,11 @@ def _prep_function(*args, **kwargs): # or through conventional import gnome if __name__ == 'gnome': # Install dependency profiles - installation.install_profile('xorg') + archinstall.storage['installation_session'].install_profile('xorg') # Install the GNOME packages - installation.add_additional_packages(__packages__) + archinstall.storage['installation_session'].add_additional_packages(__packages__) - installation.enable_service('gdm') # Gnome Display Manager + archinstall.storage['installation_session'].enable_service('gdm') # Gnome Display Manager # We could also start it via xinitrc since we do have Xorg, # but for gnome that's deprecated and wayland is preferred. diff --git a/profiles/i3.py b/profiles/i3.py index 8492d36f..e99bc549 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -48,16 +48,16 @@ if __name__ == 'i3': """ # Install common packages for all i3 configurations - installation.add_additional_packages(__packages__[:4]) + archinstall.storage['installation_session'].add_additional_packages(__packages__[:4]) # Install dependency profiles - installation.install_profile('xorg') + archinstall.storage['installation_session'].install_profile('xorg') # gaps is installed by deafult so we are overriding it here with lightdm - installation.add_additional_packages(__packages__[4:]) + archinstall.storage['installation_session'].add_additional_packages(__packages__[4:]) # Auto start lightdm for all users - installation.enable_service('lightdm') + archinstall.storage['installation_session'].enable_service('lightdm') # install the i3 group now - installation.add_additional_packages(archinstall.storage['_i3_configuration']) + archinstall.storage['installation_session'].add_additional_packages(archinstall.storage['_i3_configuration']) diff --git a/profiles/kde.py b/profiles/kde.py index c8efdcde..aac5ade4 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -37,10 +37,10 @@ def _post_install(*args, **kwargs): # or through conventional import kde if __name__ == 'kde': # Install dependency profiles - installation.install_profile('xorg') + archinstall.storage['installation_session'].install_profile('xorg') # Install the KDE packages - installation.add_additional_packages(__packages__) + archinstall.storage['installation_session'].add_additional_packages(__packages__) # Enable autostart of KDE for all users - installation.enable_service('sddm') + archinstall.storage['installation_session'].enable_service('sddm') diff --git a/profiles/lxqt.py b/profiles/lxqt.py index d0727a90..025d033d 100644 --- a/profiles/lxqt.py +++ b/profiles/lxqt.py @@ -28,9 +28,9 @@ def _prep_function(*args, **kwargs): # or through conventional import lxqt if __name__ == 'lxqt': # Install dependency profiles - installation.install_profile('xorg') + archinstall.storage['installation_session'].install_profile('xorg') # Install the LXQt packages - installation.add_additional_packages(__packages__) + archinstall.storage['installation_session'].add_additional_packages(__packages__) - installation.enable_service('sddm') # SDDM Display Manager + archinstall.storage['installation_session'].enable_service('sddm') # SDDM Display Manager diff --git a/profiles/mate.py b/profiles/mate.py index 2cfe7305..e2421ed8 100644 --- a/profiles/mate.py +++ b/profiles/mate.py @@ -27,9 +27,9 @@ def _prep_function(*args, **kwargs): # or through conventional import mate if __name__ == 'mate': # Install dependency profiles - installation.install_profile('xorg') + archinstall.storage['installation_session'].install_profile('xorg') # Install the MATE packages - installation.add_additional_packages(__packages__) + archinstall.storage['installation_session'].add_additional_packages(__packages__) - installation.enable_service('lightdm') # Light Display Manager + archinstall.storage['installation_session'].enable_service('lightdm') # Light Display Manager diff --git a/profiles/server.py b/profiles/server.py index 9d28054d..d0346ace 100644 --- a/profiles/server.py +++ b/profiles/server.py @@ -24,7 +24,7 @@ if __name__ == 'server': archinstall.log(archinstall.storage['_selected_servers'], level=logging.DEBUG) for server in archinstall.storage['_selected_servers']: archinstall.log(f'Installing {server} ...', level=logging.INFO) - app = archinstall.Application(installation, server) + app = archinstall.Application(archinstall.storage['installation_session'], server) app.install() archinstall.log('If your selections included multiple servers with the same port, you may have to reconfigure them.', fg="yellow", level=logging.INFO) diff --git a/profiles/sway.py b/profiles/sway.py index 8e256a87..e90e5e8d 100644 --- a/profiles/sway.py +++ b/profiles/sway.py @@ -44,7 +44,7 @@ if __name__ == "sway": ) # Install the Sway packages - installation.add_additional_packages(__packages__) + archinstall.storage['installation_session'].add_additional_packages(__packages__) # Install the graphics driver packages - installation.add_additional_packages(_gfx_driver_packages) + archinstall.storage['installation_session'].add_additional_packages(_gfx_driver_packages) diff --git a/profiles/xfce4.py b/profiles/xfce4.py index 8102919b..43da23ac 100644 --- a/profiles/xfce4.py +++ b/profiles/xfce4.py @@ -28,9 +28,9 @@ def _prep_function(*args, **kwargs): # or through conventional import xfce4 if __name__ == 'xfce4': # Install dependency profiles - installation.install_profile('xorg') + archinstall.storage['installation_session'].install_profile('xorg') # Install the XFCE4 packages - installation.add_additional_packages(__packages__) + archinstall.storage['installation_session'].add_additional_packages(__packages__) - installation.enable_service('lightdm') # Light Display Manager + archinstall.storage['installation_session'].enable_service('lightdm') # Light Display Manager diff --git a/profiles/xorg.py b/profiles/xorg.py index 7546a01b..19ca92d7 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -28,22 +28,12 @@ def _prep_function(*args, **kwargs): if __name__ == 'xorg': try: if "nvidia" in _gfx_driver_packages: - if "linux-zen" in installation.base_packages or "linux-lts" in installation.base_packages: - installation.add_additional_packages("dkms")#I've had kernel regen fail if it wasn't installed before nvidia-dkms - installation.add_additional_packages("xorg-server xorg-xinit nvidia-dkms") + if "linux-zen" in archinstall.storage['installation_session'].base_packages or "linux-lts" in archinstall.storage['installation_session'].base_packages: + archinstall.storage['installation_session'].add_additional_packages("dkms")#I've had kernel regen fail if it wasn't installed before nvidia-dkms + archinstall.storage['installation_session'].add_additional_packages("xorg-server xorg-xinit nvidia-dkms") else: - installation.add_additional_packages(f"xorg-server xorg-xinit {' '.join(_gfx_driver_packages)}") + archinstall.storage['installation_session'].add_additional_packages(f"xorg-server xorg-xinit {' '.join(_gfx_driver_packages)}") else: - installation.add_additional_packages(f"xorg-server xorg-xinit {' '.join(_gfx_driver_packages)}") + archinstall.storage['installation_session'].add_additional_packages(f"xorg-server xorg-xinit {' '.join(_gfx_driver_packages)}") except: - installation.add_additional_packages(f"xorg-server xorg-xinit") # Prep didn't run, so there's no driver to install - - # with open(f'{installation.mountpoint}/etc/X11/xinit/xinitrc', 'a') as X11: - # X11.write('setxkbmap se\n') - - # with open(f'{installation.mountpoint}/etc/vconsole.conf', 'a') as vconsole: - # vconsole.write('KEYMAP={keyboard_layout}\n'.format(**arguments)) - # vconsole.write('FONT=lat9w-16\n') - - # awesome = archinstall.Application(installation, 'awesome') - # awesome.install() \ No newline at end of file + archinstall.storage['installation_session'].add_additional_packages(f"xorg-server xorg-xinit") # Prep didn't run, so there's no driver to install \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 1674b7088d66873712dea57f99d3221daad4db0b Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 14 May 2021 16:13:03 +0200 Subject: Fixes string index error. --- archinstall/lib/profiles.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index 1feba1cd..9225a129 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -36,7 +36,7 @@ def list_profiles(filter_irrelevant_macs=True, subpath='', filter_top_level_prof description = '' with open(os.path.join(root, file), 'r') as fh: first_line = fh.readline() - if first_line[0] == '#': + if len(first_line) and first_line[0] == '#': description = first_line[1:].strip() cache[file[:-3]] = {'path' : os.path.join(root, file), 'description' : description, 'tailored' : tailored} -- cgit v1.2.3-54-g00ecf From 22750cefc89e6439d14a5df105af17e4e85eb3cc Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 14 May 2021 16:55:47 +0200 Subject: Quotation error. --- profiles/awesome.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/profiles/awesome.py b/profiles/awesome.py index 8ee113f4..7b305eb2 100644 --- a/profiles/awesome.py +++ b/profiles/awesome.py @@ -36,13 +36,13 @@ if __name__ == 'awesome': archinstall.storage['installation_session'].add_additional_packages(__packages__) # TODO: Copy a full configuration to ~/.config/awesome/rc.lua instead. - with open(f'{archinstall.storage['installation_session'].target}/etc/xdg/awesome/rc.lua', 'r') as fh: + with open(f"{archinstall.storage['installation_session'].target}/etc/xdg/awesome/rc.lua", 'r') as fh: awesome_lua = fh.read() ## Replace xterm with alacritty for a smoother experience. awesome_lua = awesome_lua.replace('"xterm"', '"alacritty"') - with open(f'{archinstall.storage['installation_session'].target}/etc/xdg/awesome/rc.lua', 'w') as fh: + with open(f"{archinstall.storage['installation_session'].target}/etc/xdg/awesome/rc.lua", 'w') as fh: fh.write(awesome_lua) ## TODO: Configure the right-click-menu to contain the above packages that were installed. (as a user config) -- cgit v1.2.3-54-g00ecf From 1fd432326b760c8638582c9050c95304f6010485 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 14 May 2021 19:34:01 +0200 Subject: Added debugging --- archinstall/lib/disk.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index fd08ea63..5028a3a9 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -321,6 +321,9 @@ class Partition(): if log_formatting: log(f'Formatting {path} -> {filesystem}', level=logging.INFO) + if path == '/dev/sda1' and filesystem == 'vfat': + raise ValueError("Debugging breakpoint!") + if filesystem == 'btrfs': o = b''.join(sys_command(f'/usr/bin/mkfs.btrfs -f {path}')) if b'UUID' not in o: -- cgit v1.2.3-54-g00ecf From 1abe2c762e12a6d2a70b892a0d45bb041403270d Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 14 May 2021 19:48:39 +0200 Subject: Removed targeted /boot formatting. This should be handled and marked earlier in the locig, the partitioning logic should only honor the marked partitions and their status. No need to explicitly format /boot since - if it's meant to be formatted - it should already be marked. --- examples/guided.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/guided.py b/examples/guided.py index 40bebabf..4c8af245 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -283,8 +283,6 @@ def perform_installation_steps(): partition.format() else: archinstall.log(f"Did not format {partition} because .safe_to_format() returned False or .allow_formatting was False.", level=logging.DEBUG) - if hasUEFI(): - fs.find_partition('/boot').format('vfat')# we don't have a boot partition in bios mode if archinstall.arguments.get('!encryption-password', None): # First encrypt and unlock, then format the desired partition inside the encrypted part. -- cgit v1.2.3-54-g00ecf From 2761e675a1e8073d0b150d9c01e5f74c4ac771c8 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 14 May 2021 19:48:58 +0200 Subject: Removed debugging --- archinstall/lib/disk.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index 5028a3a9..fd08ea63 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -321,9 +321,6 @@ class Partition(): if log_formatting: log(f'Formatting {path} -> {filesystem}', level=logging.INFO) - if path == '/dev/sda1' and filesystem == 'vfat': - raise ValueError("Debugging breakpoint!") - if filesystem == 'btrfs': o = b''.join(sys_command(f'/usr/bin/mkfs.btrfs -f {path}')) if b'UUID' not in o: -- cgit v1.2.3-54-g00ecf From 4b6a7514c9259def27c7de80d91efd7905366bdb Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 14 May 2021 21:05:18 +0200 Subject: Adding in a default timeout to systemd-boot, but only if no other timeout was specified. Also fixes a regression bug with line endings in the loader configuration. --- archinstall/lib/installer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index ed2d516a..6c87b088 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -397,8 +397,11 @@ class Installer(): for line in loader_data: if line[:8] == 'default ': loader.write(f'default {self.init_time}\n') + elif line[:8] == '#timeout' and 'timeout 5' not in loader_data: + # We add in the default timeout to support dual-boot + loader.write(f"{line[1:]}\n") else: - loader.write(f"{line}") + loader.write(f"{line}\n") ## For some reason, blkid and /dev/disk/by-uuid are not getting along well. ## And blkid is wrong in terms of LUKS. -- cgit v1.2.3-54-g00ecf From 0df6eced77ce54177a9a38f1d6d2bc3fb8f91fc9 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 14 May 2021 21:09:06 +0200 Subject: Adding a fallback systemd-boot install if writing variables failed. --- archinstall/lib/installer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 6c87b088..03b49f77 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -381,7 +381,9 @@ class Installer(): # And in which case we should do some clean up. # Install the boot loader - sys_command(f'/usr/bin/arch-chroot {self.target} bootctl --path=/boot install') + if sys_command(f'/usr/bin/arch-chroot {self.target} bootctl --path=/boot install').exit_code != 0: + # Fallback, try creating the boot loader without touching the EFI variables + sys_command(f'/usr/bin/arch-chroot {self.target} bootctl --no-variables --path=/boot install') # Modify or create a loader.conf if os.path.isfile(f'{self.target}/boot/loader/loader.conf'): -- cgit v1.2.3-54-g00ecf From 7f81281f5950eafd381826d7dde7b5661bd0c35b Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 14 May 2021 21:29:49 +0200 Subject: Removed dupe formatter There should be no reason to call `.format()` here, since the steps above take care of all formatting. --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index 4c8af245..0ae253a0 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -292,8 +292,8 @@ def perform_installation_steps(): unlocked_device.format(fs.find_partition('/').filesystem) unlocked_device.mount('/mnt') else: - fs.find_partition('/').format(fs.find_partition('/').filesystem) fs.find_partition('/').mount('/mnt') + if hasUEFI(): fs.find_partition('/boot').mount('/mnt/boot') -- cgit v1.2.3-54-g00ecf From bd9992be29c5fa5b5a47e67d2dbd250b9a5a8828 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 14 May 2021 21:22:30 -0400 Subject: Don't list __init__.py files in profile list --- archinstall/lib/profiles.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index 9225a129..42fd4c24 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -26,6 +26,8 @@ def list_profiles(filter_irrelevant_macs=True, subpath='', filter_top_level_prof for PATH_ITEM in storage['PROFILE_PATH']: for root, folders, files in os.walk(os.path.abspath(os.path.expanduser(PATH_ITEM+subpath))): for file in files: + if file == '__init__.py': + continue if os.path.splitext(file)[1] == '.py': tailored = False if len(mac := re.findall('(([a-zA-z0-9]{2}[-:]){5}([a-zA-z0-9]{2}))', file)): -- cgit v1.2.3-54-g00ecf From a0a695b9e59c31357980357286d96950ccdd937e Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 14 May 2021 22:29:29 -0400 Subject: Fix microcode not getting added to base_packages before install --- archinstall/lib/installer.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 03b49f77..576000c8 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -320,12 +320,9 @@ class Installer(): if 'encrypt' not in self.HOOKS: self.HOOKS.insert(self.HOOKS.index('filesystems'), 'encrypt') - if not(hasUEFI()): # TODO: Allow for grub even on EFI + if not(hasUEFI()): self.base_packages.append('grub') - self.pacstrap(self.base_packages) - self.helper_flags['base-strapped'] = True - #self.genfstab() if not isVM(): vendor = cpuVendor() if vendor == "AuthenticAMD": @@ -334,10 +331,14 @@ class Installer(): self.base_packages.append("intel-ucode") else: self.log("Unknown cpu vendor not installing ucode") + + self.pacstrap(self.base_packages) + self.helper_flags['base-strapped'] = True + with open(f"{self.target}/etc/fstab", "a") as fstab: fstab.write( "\ntmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0\n" - ) # Redundant \n at the start? who knows? + ) # Redundant \n at the start? who knows? ## TODO: Support locale and timezone #os.remove(f'{self.target}/etc/localtime') -- cgit v1.2.3-54-g00ecf From 60858634f1afb2b1d5bcc0fbb9e4b0bccdedc876 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 14 May 2021 22:39:23 -0400 Subject: Fix microcode not getting added to base_packages before install Update installer.py --- archinstall/lib/installer.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 03b49f77..68d058f0 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -320,12 +320,9 @@ class Installer(): if 'encrypt' not in self.HOOKS: self.HOOKS.insert(self.HOOKS.index('filesystems'), 'encrypt') - if not(hasUEFI()): # TODO: Allow for grub even on EFI + if not(hasUEFI()): self.base_packages.append('grub') - self.pacstrap(self.base_packages) - self.helper_flags['base-strapped'] = True - #self.genfstab() if not isVM(): vendor = cpuVendor() if vendor == "AuthenticAMD": @@ -334,6 +331,10 @@ class Installer(): self.base_packages.append("intel-ucode") else: self.log("Unknown cpu vendor not installing ucode") + + self.pacstrap(self.base_packages) + self.helper_flags['base-strapped'] = True + with open(f"{self.target}/etc/fstab", "a") as fstab: fstab.write( "\ntmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0\n" -- cgit v1.2.3-54-g00ecf From ea46693608a8f3e4a21325a8d65d2c2d78b83c69 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 14 May 2021 23:04:26 -0400 Subject: Add deepin to desktop profile list so it is selectable --- profiles/desktop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/desktop.py b/profiles/desktop.py index d4c13239..eca8803e 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -16,7 +16,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4', 'lxqt', 'i3', 'budgie', 'mate'] + supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4', 'lxqt', 'i3', 'budgie', 'mate', 'deepin'] desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ', allow_empty_input=False, sort=True) -- cgit v1.2.3-54-g00ecf From b07320aec4e5edceed4ab3b5895648ef9f7ba938 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sat, 15 May 2021 00:00:23 -0400 Subject: Fix deepin; missing lightdm packages --- profiles/deepin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/deepin.py b/profiles/deepin.py index 47fbe13f..757597f3 100644 --- a/profiles/deepin.py +++ b/profiles/deepin.py @@ -4,7 +4,7 @@ import archinstall, os is_top_level_profile = False -__packages__ = ["deepin", "deepin-terminal", "deepin-editor"] +__packages__ = ["deepin", "deepin-terminal", "deepin-editor", "lightdm", "lightdm-gtk-greeter"] def _prep_function(*args, **kwargs): """ -- cgit v1.2.3-54-g00ecf From 5c6019124a2645b57cf2d51964e6720ec1d6bab7 Mon Sep 17 00:00:00 2001 From: Marcus Pereira Date: Sat, 15 May 2021 08:29:25 -0300 Subject: rename package name --- profiles/awesome.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/awesome.py b/profiles/awesome.py index 7b305eb2..ee812eb3 100644 --- a/profiles/awesome.py +++ b/profiles/awesome.py @@ -6,7 +6,7 @@ is_top_level_profile = False # New way of defining packages for a profile, which is iterable and can be used out side # of the profile to get a list of "what packages will be installed". -__packages__ = ['nemo', 'gpicview-gtk3', 'main', 'alacritty'] +__packages__ = ['nemo', 'gpicview', 'main', 'alacritty'] def _prep_function(*args, **kwargs): """ -- cgit v1.2.3-54-g00ecf