From cef3a3a792a492fa91e464c8dd6d9323546e4e8d Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 29 Apr 2021 12:11:23 -0400 Subject: Fix i3 --- profiles/i3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'profiles/i3.py') diff --git a/profiles/i3.py b/profiles/i3.py index 4d400468..e2db5fc7 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -60,4 +60,4 @@ if __name__ == 'i3': installation.enable_service('lightdm') # install the i3 group now - installation.add_additional_packages(installation, archinstall.storage['_i3_configuration']) \ No newline at end of file + installation.add_additional_packages(archinstall.storage['_i3_configuration']) -- cgit v1.2.3-70-g09d2 From 3c23f5e810b095dbe1714ff1047709c7c8f237d3 Mon Sep 17 00:00:00 2001 From: Ondřej Nekola Date: Thu, 6 May 2021 13:01:43 +0200 Subject: add dmenu dependency to i3 profile dmenu is configured as the default launcher (Penguin-SPACE key) in the default i3 configuartion. --- profiles/i3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'profiles/i3.py') diff --git a/profiles/i3.py b/profiles/i3.py index e2db5fc7..8492d36f 100644 --- a/profiles/i3.py +++ b/profiles/i3.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__ = ['i3lock', 'i3status', 'i3blocks', 'xterm', 'lightdm-gtk-greeter', 'lightdm'] +__packages__ = ['i3lock', 'i3status', 'i3blocks', 'xterm', 'lightdm-gtk-greeter', 'lightdm', 'dmenu'] def _prep_function(*args, **kwargs): """ -- cgit v1.2.3-70-g09d2 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(-) (limited to 'profiles/i3.py') 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-70-g09d2 From ffd5b5f80453a609b76e050d6d4e8309c540c28e Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Sat, 15 May 2021 11:35:18 -0400 Subject: Very selectively fix some PEP 8 issues with profiles --- profiles/52-54-00-12-34-56.py | 4 ++-- profiles/applications/postgresql.py | 2 +- profiles/awesome.py | 3 ++- profiles/budgie.py | 6 ++++-- profiles/cinnamon.py | 15 +++++++++++-- profiles/deepin.py | 1 + profiles/desktop.py | 42 ++++++++++++++++++++++++++++++------- profiles/enlightenment.py | 1 + profiles/gnome.py | 4 +++- profiles/i3.py | 9 +++++--- profiles/kde.py | 2 ++ profiles/lxqt.py | 5 +++-- profiles/mate.py | 4 +++- profiles/minimal.py | 4 +++- profiles/server.py | 4 +++- profiles/sway.py | 4 +--- profiles/xfce4.py | 5 +++-- profiles/xorg.py | 1 + 18 files changed, 86 insertions(+), 30 deletions(-) (limited to 'profiles/i3.py') diff --git a/profiles/52-54-00-12-34-56.py b/profiles/52-54-00-12-34-56.py index 28cd14f6..d4fc3d07 100644 --- a/profiles/52-54-00-12-34-56.py +++ b/profiles/52-54-00-12-34-56.py @@ -7,7 +7,7 @@ __packages__ = ['nano', 'wget', 'git'] if __name__ == '52-54-00-12-34-56': awesome = archinstall.Application(archinstall.storage['installation_session'], 'postgresql') awesome.install() - + """ # Unmount and close previous runs (Mainly only used for re-runs, but won't hurt.) archinstall.sys_command(f'umount -R /mnt', suppress_errors=True) @@ -57,4 +57,4 @@ with archinstall.Filesystem(harddrive) as fs: urllib.request.urlopen(req, timeout=5) except: pass -""" \ No newline at end of file +""" diff --git a/profiles/applications/postgresql.py b/profiles/applications/postgresql.py index 3f8c6950..29546d78 100644 --- a/profiles/applications/postgresql.py +++ b/profiles/applications/postgresql.py @@ -8,4 +8,4 @@ archinstall.storage['installation_session'].add_additional_packages(__packages__ archinstall.storage['installation_session'].arch_chroot("initdb -D /var/lib/postgres/data", runas='postgres') -archinstall.storage['installation_session'].enable_service('postgresql') \ No newline at end of file +archinstall.storage['installation_session'].enable_service('postgresql') diff --git a/profiles/awesome.py b/profiles/awesome.py index ee812eb3..62cb9e00 100644 --- a/profiles/awesome.py +++ b/profiles/awesome.py @@ -8,6 +8,7 @@ is_top_level_profile = False # of the profile to get a list of "what packages will be installed". __packages__ = ['nemo', 'gpicview', 'main', 'alacritty'] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -46,7 +47,7 @@ if __name__ == 'awesome': 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 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 dbbd3a9d..abaf87b0 100644 --- a/profiles/budgie.py +++ b/profiles/budgie.py @@ -4,9 +4,10 @@ import archinstall is_top_level_profile = False -# "It is recommended also to install the gnome group, which contains applications required for the standard GNOME experience." - Arch Wiki +# "It is recommended also to install the gnome group, which contains applications required for the standard GNOME experience." - Arch Wiki __packages__ = ["budgie-desktop", "lightdm", "lightdm-gtk-greeter", "gnome"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -23,6 +24,7 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') + # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("budgie", "/somewhere/budgie.py") # or through conventional import budgie @@ -33,4 +35,4 @@ if __name__ == 'budgie': # Install the Budgie packages archinstall.storage['installation_session'].add_additional_packages(__packages__) - archinstall.storage['installation_session'].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 89798671..0122677a 100644 --- a/profiles/cinnamon.py +++ b/profiles/cinnamon.py @@ -4,7 +4,17 @@ import archinstall is_top_level_profile = False -__packages__ = ["cinnamon", "system-config-printer", "gnome-keyring", "gnome-terminal", "blueberry", "metacity", "lightdm", "lightdm-gtk-greeter"] +__packages__ = [ + "cinnamon", + "system-config-printer", + "gnome-keyring", + "gnome-terminal", + "blueberry", + "metacity", + "lightdm", + "lightdm-gtk-greeter", +] + def _prep_function(*args, **kwargs): """ @@ -22,6 +32,7 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') + # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("cinnamon", "/somewhere/cinnamon.py") # or through conventional import cinnamon @@ -32,4 +43,4 @@ if __name__ == 'cinnamon': # Install the Cinnamon packages archinstall.storage['installation_session'].add_additional_packages(__packages__) - archinstall.storage['installation_session'].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 757597f3..a4778b0d 100644 --- a/profiles/deepin.py +++ b/profiles/deepin.py @@ -6,6 +6,7 @@ is_top_level_profile = False __packages__ = ["deepin", "deepin-terminal", "deepin-editor", "lightdm", "lightdm-gtk-greeter"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer diff --git a/profiles/desktop.py b/profiles/desktop.py index 9e1d8b4c..84c1ac06 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -6,7 +6,19 @@ is_top_level_profile = True # 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__ = ['nano', 'vim', 'openssh', 'htop', 'wget', 'iwd', 'wireless_tools', 'wpa_supplicant', 'smartmontools', 'xdg-utils'] +__packages__ = [ + 'nano', + 'vim', + 'openssh', + 'htop', + 'wget', + 'iwd', + 'wireless_tools', + 'wpa_supplicant', + 'smartmontools', + 'xdg-utils', +] + def _prep_function(*args, **kwargs): """ @@ -16,11 +28,25 @@ 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', 'deepin', 'enlightenment'] + supported_desktops = [ + 'gnome', + 'kde', + 'awesome', + 'sway', + 'cinnamon', + 'xfce4', + 'lxqt', + 'i3', + 'budgie', + 'mate', + 'deepin', + 'enlightenment', + ] + + desktop = archinstall.generic_select( + supported_desktops, 'Select your desired desktop environment: ', allow_empty_input=False, sort=True + ) - desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ', - allow_empty_input=False, sort=True) - # Temporarily store the selected desktop profile # in a session-safe location, since this module will get reloaded # the next time it gets executed. @@ -34,6 +60,7 @@ def _prep_function(*args, **kwargs): else: print(f"Deprecated (??): {desktop} profile has no _prep_function() anymore") + if __name__ == 'desktop': """ This "profile" is a meta-profile. @@ -47,9 +74,8 @@ if __name__ == 'desktop': There are plenty of desktop-turn-key-solutions based on Arch Linux, this is therefore just a helper to get started """ - + # Install common packages for all desktop environments archinstall.storage['installation_session'].add_additional_packages(__packages__) - - archinstall.storage['installation_session'].install_profile(archinstall.storage['_desktop_profile']) + archinstall.storage['installation_session'].install_profile(archinstall.storage['_desktop_profile']) diff --git a/profiles/enlightenment.py b/profiles/enlightenment.py index 6ff334de..4c5a7999 100644 --- a/profiles/enlightenment.py +++ b/profiles/enlightenment.py @@ -6,6 +6,7 @@ is_top_level_profile = False __packages__ = ["enlightenment", "terminology", "lightdm", "lightdm-gtk-greeter"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer diff --git a/profiles/gnome.py b/profiles/gnome.py index e6cc75c0..09fac1bb 100644 --- a/profiles/gnome.py +++ b/profiles/gnome.py @@ -7,6 +7,7 @@ is_top_level_profile = False # Note: GDM should be part of the gnome group, but adding it here for clarity __packages__ = ["gnome", "gnome-tweaks", "gdm"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -24,6 +25,7 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') + # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("gnome", "/somewhere/gnome.py") # or through conventional import gnome @@ -34,6 +36,6 @@ if __name__ == 'gnome': # Install the GNOME packages archinstall.storage['installation_session'].add_additional_packages(__packages__) - archinstall.storage['installation_session'].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 e99bc549..1972ba59 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -8,6 +8,7 @@ is_top_level_profile = False # of the profile to get a list of "what packages will be installed". __packages__ = ['i3lock', 'i3status', 'i3blocks', 'xterm', 'lightdm-gtk-greeter', 'lightdm', 'dmenu'] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -17,8 +18,9 @@ def _prep_function(*args, **kwargs): """ supported_configurations = ['i3-wm', 'i3-gaps'] - desktop = archinstall.generic_select(supported_configurations, 'Select your desired configuration: ', - allow_empty_input=False, sort=True) + desktop = archinstall.generic_select( + supported_configurations, 'Select your desired configuration: ', allow_empty_input=False, sort=True + ) # Temporarily store the selected desktop profile # in a session-safe location, since this module will get reloaded @@ -33,6 +35,7 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') + if __name__ == 'i3': """ This "profile" is a meta-profile. @@ -46,7 +49,7 @@ if __name__ == 'i3': There are plenty of desktop-turn-key-solutions based on Arch Linux, this is therefore just a helper to get started """ - + # Install common packages for all i3 configurations archinstall.storage['installation_session'].add_additional_packages(__packages__[:4]) diff --git a/profiles/kde.py b/profiles/kde.py index aac5ade4..66625074 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -8,6 +8,7 @@ __packages__ = ["plasma-meta", "konsole", "kate", "dolphin", "sddm", "plasma-way # TODO: Remove hard dependency of bash (due to .bash_profile) + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -24,6 +25,7 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') + """ def _post_install(*args, **kwargs): if "nvidia" in _gfx_driver_packages: diff --git a/profiles/lxqt.py b/profiles/lxqt.py index 025d033d..af6337e6 100644 --- a/profiles/lxqt.py +++ b/profiles/lxqt.py @@ -1,4 +1,3 @@ - # A desktop environment using "LXQt" import archinstall @@ -7,6 +6,7 @@ is_top_level_profile = False __packages__ = ["lxqt", "breeze-icons", "oxygen-icons", "xdg-utils", "ttf-freefont", "leafpad", "slock", "sddm"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -23,6 +23,7 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') + # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("lxqt", "/somewhere/lxqt.py") # or through conventional import lxqt @@ -33,4 +34,4 @@ if __name__ == 'lxqt': # Install the LXQt packages archinstall.storage['installation_session'].add_additional_packages(__packages__) - archinstall.storage['installation_session'].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 e2421ed8..351f2250 100644 --- a/profiles/mate.py +++ b/profiles/mate.py @@ -6,6 +6,7 @@ is_top_level_profile = False __packages__ = ["mate", "mate-extra", "lightdm", "lightdm-gtk-greeter"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -22,6 +23,7 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') + # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("mate", "/somewhere/mate.py") # or through conventional import mate @@ -32,4 +34,4 @@ if __name__ == 'mate': # Install the MATE packages archinstall.storage['installation_session'].add_additional_packages(__packages__) - archinstall.storage['installation_session'].enable_service('lightdm') # Light Display Manager + archinstall.storage['installation_session'].enable_service('lightdm') # Light Display Manager diff --git a/profiles/minimal.py b/profiles/minimal.py index 79821a89..8af06a3a 100644 --- a/profiles/minimal.py +++ b/profiles/minimal.py @@ -4,6 +4,7 @@ import archinstall, os is_top_level_profile = True + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -11,7 +12,8 @@ def _prep_function(*args, **kwargs): we don't need to do anything special here, but it needs to exist and return True. """ - return True # Do nothing and just return True + return True # Do nothing and just return True + if __name__ == 'minimal': """ diff --git a/profiles/server.py b/profiles/server.py index d0346ace..36bfd3ab 100644 --- a/profiles/server.py +++ b/profiles/server.py @@ -6,6 +6,7 @@ is_top_level_profile = True available_servers = ["cockpit", "docker", "httpd", "lighttpd", "mariadb", "nginx", "postgresql", "sshd", "tomcat"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -13,9 +14,10 @@ def _prep_function(*args, **kwargs): """ selected_servers = archinstall.generic_multi_select(available_servers, f"Choose which servers to install and enable (leave blank for a minimal installation): ") archinstall.storage['_selected_servers'] = selected_servers - + return True + if __name__ == 'server': """ This "profile" is a meta-profile. diff --git a/profiles/sway.py b/profiles/sway.py index e90e5e8d..686fe868 100644 --- a/profiles/sway.py +++ b/profiles/sway.py @@ -39,9 +39,7 @@ if __name__ == "sway": "The proprietary Nvidia driver is not supported by Sway. It is likely that you will run into issues. Continue anyways? [y/N] " ) if choice.lower() in ("n", ""): - raise archinstall.lib.exceptions.HardwareIncompatibilityError( - "Sway does not support the proprietary nvidia drivers." - ) + raise archinstall.lib.exceptions.HardwareIncompatibilityError("Sway does not support the proprietary nvidia drivers.") # Install the Sway packages archinstall.storage['installation_session'].add_additional_packages(__packages__) diff --git a/profiles/xfce4.py b/profiles/xfce4.py index 43da23ac..ad00c461 100644 --- a/profiles/xfce4.py +++ b/profiles/xfce4.py @@ -1,4 +1,3 @@ - # A desktop environment using "Xfce4" import archinstall @@ -7,6 +6,7 @@ is_top_level_profile = False __packages__ = ["xfce4", "xfce4-goodies", "lightdm", "lightdm-gtk-greeter"] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -23,6 +23,7 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') + # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("xfce4", "/somewhere/xfce4.py") # or through conventional import xfce4 @@ -33,4 +34,4 @@ if __name__ == 'xfce4': # Install the XFCE4 packages archinstall.storage['installation_session'].add_additional_packages(__packages__) - archinstall.storage['installation_session'].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 19ca92d7..e7cf00d0 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -7,6 +7,7 @@ is_top_level_profile = True __packages__ = ['dkms', 'xorg-server', 'xorg-xinit', 'nvidia-dkms', 'xorg-server', *archinstall.lib.hardware.__packages__] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer -- cgit v1.2.3-70-g09d2 From acb754ff2edee96d3dc0c6ca29abd0c60a1a5ace Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Sat, 15 May 2021 11:42:32 -0400 Subject: Try to remove some unused imports --- profiles/deepin.py | 2 +- profiles/desktop.py | 2 +- profiles/i3.py | 2 +- profiles/kde.py | 2 +- profiles/minimal.py | 2 -- profiles/server.py | 2 +- profiles/xorg.py | 1 - 7 files changed, 5 insertions(+), 8 deletions(-) (limited to 'profiles/i3.py') diff --git a/profiles/deepin.py b/profiles/deepin.py index a4778b0d..ebe730e2 100644 --- a/profiles/deepin.py +++ b/profiles/deepin.py @@ -1,6 +1,6 @@ # A desktop environment using "Deepin". -import archinstall, os +import archinstall is_top_level_profile = False diff --git a/profiles/desktop.py b/profiles/desktop.py index 84c1ac06..67514a97 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -1,6 +1,6 @@ # A desktop environment selector. -import archinstall, os +import archinstall is_top_level_profile = True diff --git a/profiles/i3.py b/profiles/i3.py index 1972ba59..418749c0 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -1,6 +1,6 @@ # Common package for i3, lets user select which i3 configuration they want. -import archinstall, os +import archinstall is_top_level_profile = False diff --git a/profiles/kde.py b/profiles/kde.py index 66625074..cdb6a41a 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -1,6 +1,6 @@ # A desktop environment using "KDE". -import archinstall, os +import archinstall is_top_level_profile = False diff --git a/profiles/minimal.py b/profiles/minimal.py index 8af06a3a..13cfd05a 100644 --- a/profiles/minimal.py +++ b/profiles/minimal.py @@ -1,7 +1,5 @@ # Used to do a minimal install -import archinstall, os - is_top_level_profile = True diff --git a/profiles/server.py b/profiles/server.py index 36bfd3ab..ff7b2179 100644 --- a/profiles/server.py +++ b/profiles/server.py @@ -1,6 +1,6 @@ # Used to select various server application profiles on top of a minimal installation. -import archinstall, os, logging +import archinstall, logging is_top_level_profile = True diff --git a/profiles/xorg.py b/profiles/xorg.py index e7cf00d0..34599468 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -1,6 +1,5 @@ # A system with "xorg" installed -import os import archinstall is_top_level_profile = True -- cgit v1.2.3-70-g09d2 From 126c7ebfca16156d4e1c738a5f562ba99a4ab5f2 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Sat, 15 May 2021 14:46:40 -0400 Subject: More formatting fixes to satisfy PEP 8 --- archinstall/__init__.py | 3 ++- archinstall/lib/disk.py | 28 ++++++++++++++++------------ archinstall/lib/general.py | 6 +++--- archinstall/lib/installer.py | 19 +++++++++++-------- archinstall/lib/luks.py | 3 ++- archinstall/lib/networking.py | 1 + archinstall/lib/profiles.py | 4 ++-- archinstall/lib/storage.py | 2 +- archinstall/lib/user_interaction.py | 27 ++++++++++++--------------- docs/conf.py | 5 +---- examples/guided.py | 8 ++------ profiles/desktop.py | 4 +--- profiles/i3.py | 4 +--- profiles/sway.py | 4 +--- 14 files changed, 56 insertions(+), 62 deletions(-) (limited to 'profiles/i3.py') diff --git a/archinstall/__init__.py b/archinstall/__init__.py index f1d8341e..58012a21 100644 --- a/archinstall/__init__.py +++ b/archinstall/__init__.py @@ -34,7 +34,8 @@ for arg in sys.argv[1:]: # TODO: Learn the dark arts of argparse... -# (I summon thee dark spawn of cPython) +# (I summon thee dark spawn of cPython) + def run_as_a_module(): """ diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index 65d1599b..85e8a402 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -17,7 +17,8 @@ MBR = 0b00000010 # libc = ctypes.CDLL(ctypes.util.find_library('c'), use_errno=True) # libc.mount.argtypes = (ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_ulong, ctypes.c_char_p) -class BlockDevice(): + +class BlockDevice: def __init__(self, path, info=None): if not info: # If we don't give any information, we need to auto-fill it. @@ -76,7 +77,8 @@ class BlockDevice(): if self.info['type'] == 'loop': for drive in json.loads(b''.join(sys_command(['losetup', '--json'], hide_from_log=True)).decode('UTF_8'))['loopdevices']: - if not drive['name'] == self.path: continue + if not drive['name'] == self.path: + continue return drive['back-file'] elif self.info['type'] == 'disk': @@ -91,8 +93,8 @@ class BlockDevice(): else: log(f"Unknown blockdevice type for {self.path}: {self.info['type']}", level=logging.DEBUG) - # if not stat.S_ISBLK(os.stat(full_path).st_mode): - # raise DiskError(f'Selected disk "{full_path}" is not a block device.') + # if not stat.S_ISBLK(os.stat(full_path).st_mode): + # raise DiskError(f'Selected disk "{full_path}" is not a block device.') @property def partitions(self): @@ -153,7 +155,7 @@ class BlockDevice(): self.part_cache = OrderedDict() -class Partition(): +class Partition: def __init__(self, path: str, block_device: BlockDevice, part_id=None, size=-1, filesystem=None, mountpoint=None, encrypted=False, autodetect_filesystem=True): if not part_id: part_id = os.path.basename(path) @@ -236,7 +238,7 @@ class Partition(): for blockdevice in json.loads(b''.join(sys_command('lsblk -J')).decode('UTF-8'))['blockdevices']: if (parent := self.find_parent_of(blockdevice, os.path.basename(self.path))): return f"/dev/{parent}" - # raise DiskError(f'Could not find appropriate parent for encrypted partition {self}') + # raise DiskError(f'Could not find appropriate parent for encrypted partition {self}') return self.path def detect_inner_filesystem(self, password): @@ -351,9 +353,9 @@ class Partition(): self.filesystem = 'f2fs' elif filesystem == 'crypto_LUKS': - # from .luks import luks2 - # encrypted_partition = luks2(self, None, None) - # encrypted_partition.format(path) + # from .luks import luks2 + # encrypted_partition = luks2(self, None, None) + # encrypted_partition.format(path) self.filesystem = 'crypto_LUKS' else: @@ -378,7 +380,8 @@ class Partition(): if not self.mountpoint: log(f'Mounting {self} to {target}', level=logging.INFO) if not fs: - if not self.filesystem: raise DiskError(f'Need to format (or define) the filesystem on {self} before mounting.') + if not self.filesystem: + raise DiskError(f'Need to format (or define) the filesystem on {self} before mounting.') fs = self.filesystem pathlib.Path(target).mkdir(parents=True, exist_ok=True) @@ -425,7 +428,7 @@ class Partition(): return True -class Filesystem(): +class Filesystem: # TODO: # When instance of a HDD is selected, check all usages and gracefully unmount them # as well as close any crypto handles. @@ -566,7 +569,8 @@ def all_disks(*args, **kwargs): drives = OrderedDict() # for drive in json.loads(sys_command(f'losetup --json', *args, **lkwargs, hide_from_log=True)).decode('UTF_8')['loopdevices']: for drive in json.loads(b''.join(sys_command('lsblk --json -l -n -o path,size,type,mountpoint,label,pkname,model', *args, **kwargs, hide_from_log=True)).decode('UTF_8'))['blockdevices']: - if not kwargs['partitions'] and drive['type'] == 'part': continue + if not kwargs['partitions'] and drive['type'] == 'part': + continue drives[drive['path']] = BlockDevice(drive['path'], drive) return drives diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py index b65e2593..816fa755 100644 --- a/archinstall/lib/general.py +++ b/archinstall/lib/general.py @@ -170,7 +170,7 @@ class sys_command: 'ended': self.ended, 'started_pprint': '{}-{}-{} {}:{}:{}'.format(*time.localtime(self.started)), 'ended_pprint': '{}-{}-{} {}:{}:{}'.format(*time.localtime(self.ended)) if self.ended else None, - 'exit_code': self.exit_code + 'exit_code': self.exit_code, } def peak(self, output: Union[str, bytes]) -> bool: @@ -256,7 +256,7 @@ class sys_command: original = trigger trigger = bytes(original, 'UTF-8') self.kwargs['events'][trigger] = self.kwargs['events'][original] - del (self.kwargs['events'][original]) + del self.kwargs['events'][original] if type(self.kwargs['events'][trigger]) != bytes: self.kwargs['events'][trigger] = bytes(self.kwargs['events'][trigger], 'UTF-8') @@ -269,7 +269,7 @@ class sys_command: last_trigger_pos = trigger_pos os.write(child_fd, self.kwargs['events'][trigger]) - del (self.kwargs['events'][trigger]) + del self.kwargs['events'][trigger] broke = True break diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index bac19007..139d9d33 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -9,7 +9,7 @@ from .user_interaction import * __packages__ = ["base", "base-devel", "linux-firmware", "linux", "linux-lts", "linux-zen", "linux-hardened"] -class Installer(): +class Installer: """ `Installer()` is the wrapper for most basic installation steps. It also wraps :py:func:`~archinstall.Installer.pacstrap` among other things. @@ -127,7 +127,8 @@ class Installer(): return [step for step, flag in self.helper_flags.items() if flag is False] def pacstrap(self, *packages, **kwargs): - if type(packages[0]) in (list, tuple): packages = packages[0] + if type(packages[0]) in (list, tuple): + packages = packages[0] self.log(f'Installing packages: {packages}', level=logging.INFO) if (sync_mirrors := sys_command('/usr/bin/pacman -Syy')).exit_code == 0: @@ -158,7 +159,8 @@ class Installer(): fh.write(hostname + '\n') def set_locale(self, locale, encoding='UTF-8', *args, **kwargs): - if not len(locale): return True + if not len(locale): + return True with open(f'{self.target}/etc/locale.gen', 'a') as fh: fh.write(f'{locale}.{encoding} {encoding}\n') @@ -168,8 +170,10 @@ class Installer(): return True if sys_command(f'/usr/bin/arch-chroot {self.target} locale-gen').exit_code == 0 else False def set_timezone(self, zone, *args, **kwargs): - if not zone: return True - if not len(zone): return True # Redundant + if not zone: + return True + if not len(zone): + return True # Redundant if (pathlib.Path("/usr") / "share" / "zoneinfo" / zone).exists(): (pathlib.Path(self.target) / "etc" / "localtime").unlink(missing_ok=True) @@ -263,6 +267,7 @@ class Installer(): if enable_services: # If we haven't installed the base yet (function called pre-maturely) if self.helper_flags.get('base', False) is False: + def post_install_enable_networkd_resolved(*args, **kwargs): self.enable_service('systemd-networkd', 'systemd-resolved') @@ -332,9 +337,7 @@ class Installer(): 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? + fstab.write("\ntmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0\n") # Redundant \n at the start? who knows? ## TODO: Support locale and timezone # os.remove(f'{self.target}/etc/localtime') diff --git a/archinstall/lib/luks.py b/archinstall/lib/luks.py index e6e1c897..1cb6777f 100644 --- a/archinstall/lib/luks.py +++ b/archinstall/lib/luks.py @@ -5,7 +5,7 @@ from .general import * from .output import log -class luks2(): +class luks2: def __init__(self, partition, mountpoint, password, key_file=None, auto_unmount=False, *args, **kwargs): self.password = password self.partition = partition @@ -120,6 +120,7 @@ class luks2(): :type mountpoint: str """ from .disk import get_filesystem_type + if '/' in mountpoint: os.path.basename(mountpoint) # TODO: Raise exception instead? diff --git a/archinstall/lib/networking.py b/archinstall/lib/networking.py index 3e5ed4e7..e12d9cc3 100644 --- a/archinstall/lib/networking.py +++ b/archinstall/lib/networking.py @@ -68,6 +68,7 @@ def get_wireless_networks(interface): # TODO: Make this oneliner pritter to check if the interface is scanning or not. if not '_WIFI' in storage or interface not in storage['_WIFI'] or storage['_WIFI'][interface].get('scanning', False) is False: import time + wireless_scan(interface) time.sleep(5) diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index 2f97231c..894b8fcb 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -14,7 +14,7 @@ from .storage import storage def grab_url_data(path): - safe_path = path[:path.find(':') + 1] + ''.join([item if item in ('/', '?', '=', '&') else urllib.parse.quote(item) for item in multisplit(path[path.find(':') + 1:], ('/', '?', '=', '&'))]) + safe_path = path[: path.find(':') + 1] + ''.join([item if item in ('/', '?', '=', '&') else urllib.parse.quote(item) for item in multisplit(path[path.find(':') + 1:], ('/', '?', '=', '&'))]) ssl_context = ssl.create_default_context() ssl_context.check_hostname = False ssl_context.verify_mode = ssl.CERT_NONE @@ -75,7 +75,7 @@ def list_profiles(filter_irrelevant_macs=True, subpath='', filter_top_level_prof if filter_top_level_profiles: for profile in list(cache.keys()): if Profile(None, profile).is_top_level_profile() is False: - del (cache[profile]) + del cache[profile] return cache diff --git a/archinstall/lib/storage.py b/archinstall/lib/storage.py index 53d5e938..42214572 100644 --- a/archinstall/lib/storage.py +++ b/archinstall/lib/storage.py @@ -18,5 +18,5 @@ storage = { 'PROFILE_DB': None, # Used in cases when listing profiles is desired, not mandatory for direct profile grabing. 'LOG_PATH': '/var/log/archinstall', 'LOG_FILE': 'install.log', - 'MOUNT_POINT': '/mnt' + 'MOUNT_POINT': '/mnt', } diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 69689479..f39eea1c 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -23,6 +23,7 @@ from .profiles import Profile # TODO: Some inconsistencies between the selection processes. # Some return the keys from the options, some the values? + def get_terminal_height(): return shutil.get_terminal_size().lines @@ -104,7 +105,7 @@ def print_large_list(options, padding=5, margin_bottom=0, separator=': '): max_num_of_columns = get_terminal_width() // longest_line max_options_in_cells = max_num_of_columns * (get_terminal_height() - margin_bottom) - if (len(options) > max_options_in_cells): + if len(options) > max_options_in_cells: for index, option in enumerate(options): print(f"{index}: {option}") return 1, index @@ -214,8 +215,10 @@ class MiniCurses: self._cursor_x += len(text) def clear(self, x, y): - if x < 0: x = 0 - if y < 0: y = 0 + if x < 0: + x = 0 + if y < 0: + y = 0 # import time # sys.stdout.write(f"Clearing from: {x, y}") @@ -401,8 +404,7 @@ def ask_to_configure_network(): for index, mode in enumerate(modes): print(f"{index}: {mode}") - mode = generic_select(['DHCP', 'IP'], f"Select which mode to configure for {nic} or leave blank for DHCP: ", - options_output=False) + mode = generic_select(['DHCP', 'IP'], f"Select which mode to configure for {nic} or leave blank for DHCP: ", options_output=False) if mode == 'IP': while 1: ip = input(f"Enter the IP and subnet for {nic} (example: 192.168.0.5/24): ").strip() @@ -450,11 +452,10 @@ def ask_for_disk_layout(): options = { 'keep-existing': 'Keep existing partition layout and select which ones to use where', 'format-all': 'Format entire drive and setup a basic partition scheme', - 'abort': 'Abort the installation' + 'abort': 'Abort the installation', } - value = generic_select(options, "Found partitions on the selected drive, (select by number) what you want to do: ", - allow_empty_input=False, sort=True) + value = generic_select(options, "Found partitions on the selected drive, (select by number) what you want to do: ", allow_empty_input=False, sort=True) return next((key for key, val in options.items() if val == value), None) @@ -466,8 +467,7 @@ def ask_for_main_filesystem_format(): 'f2fs': 'f2fs' } - value = generic_select(options, "Select which filesystem your main partition should use (by number or name): ", - allow_empty_input=False) + value = generic_select(options, "Select which filesystem your main partition should use (by number or name): ", allow_empty_input=False) return next((key for key, val in options.items() if val == value), None) @@ -584,8 +584,7 @@ def select_profile(options): print(' -- They might make it easier to install things like desktop environments. --') print(' -- (Leave blank and hit enter to skip this step and continue) --') - selected_profile = generic_select(profiles, 'Enter a pre-programmed profile name if you want to install one: ', - options_output=False) + selected_profile = generic_select(profiles, 'Enter a pre-programmed profile name if you want to install one: ', options_output=False) if selected_profile: return Profile(None, selected_profile) else: @@ -675,9 +674,7 @@ def select_mirror_regions(mirrors, show_top_mirrors=True): print_large_list(regions, margin_bottom=4) print(' -- You can skip this step by leaving the option blank --') - selected_mirror = generic_select(regions, - 'Select one of the above regions to download packages from (by number or full name): ', - options_output=False) + selected_mirror = generic_select(regions, 'Select one of the above regions to download packages from (by number or full name): ', options_output=False) if not selected_mirror: # Returning back empty options which can be both used to # do "if x:" logic as well as do `x.get('mirror', {}).get('sub', None)` chaining diff --git a/docs/conf.py b/docs/conf.py index 9d23f979..88a55e02 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -123,8 +123,5 @@ man_pages = [("index", "archinstall", u"archinstall Documentation", [u"Anton Hvo # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ( - "index", "archinstall", u"archinstall Documentation", - u"Anton Hvornum", "archinstall", "Simple and minimal HTTP server." - ), + ("index", "archinstall", u"archinstall Documentation", u"Anton Hvornum", "archinstall", "Simple and minimal HTTP server."), ] diff --git a/examples/guided.py b/examples/guided.py index 0ddca5a2..f5da9265 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -84,8 +84,7 @@ def ask_user_questions(): # Select a partition # If we provide keys as options, it's better to convert them to list and sort before passing mountpoints_list = sorted(list(partition_mountpoints.keys())) - partition = archinstall.generic_select(mountpoints_list, - "Select a partition by number that you want to set a mount-point for (leave blank when done): ") + partition = archinstall.generic_select(mountpoints_list, "Select a partition by number that you want to set a mount-point for (leave blank when done): ") if not partition: if set(mountpoints_set) & {'/', '/boot'} == {'/', '/boot'}: break @@ -373,10 +372,7 @@ def perform_installation(mountpoint): if archinstall.arguments['profile'] and archinstall.arguments['profile'].has_post_install(): with archinstall.arguments['profile'].load_instructions(namespace=f"{archinstall.arguments['profile'].namespace}.py") as imported: if not imported._post_install(): - archinstall.log( - ' * Profile\'s post configuration requirements was not fulfilled.', - fg='red' - ) + archinstall.log(' * Profile\'s post configuration requirements was not fulfilled.', fg='red') exit(1) installation.log("For post-installation tips, see https://wiki.archlinux.org/index.php/Installation_guide#Post-installation", fg="yellow") diff --git a/profiles/desktop.py b/profiles/desktop.py index 67514a97..30bb9a6a 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -43,9 +43,7 @@ def _prep_function(*args, **kwargs): 'enlightenment', ] - desktop = archinstall.generic_select( - supported_desktops, 'Select your desired desktop environment: ', allow_empty_input=False, sort=True - ) + desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ', allow_empty_input=False, sort=True) # Temporarily store the selected desktop profile # in a session-safe location, since this module will get reloaded diff --git a/profiles/i3.py b/profiles/i3.py index 418749c0..c25003f9 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -18,9 +18,7 @@ def _prep_function(*args, **kwargs): """ supported_configurations = ['i3-wm', 'i3-gaps'] - desktop = archinstall.generic_select( - supported_configurations, 'Select your desired configuration: ', allow_empty_input=False, sort=True - ) + desktop = archinstall.generic_select(supported_configurations, 'Select your desired configuration: ', allow_empty_input=False, sort=True) # Temporarily store the selected desktop profile # in a session-safe location, since this module will get reloaded diff --git a/profiles/sway.py b/profiles/sway.py index 686fe868..9afc047d 100644 --- a/profiles/sway.py +++ b/profiles/sway.py @@ -35,9 +35,7 @@ def _prep_function(*args, **kwargs): # or through conventional import sway if __name__ == "sway": if "nvidia" in _gfx_driver_packages: - choice = input( - "The proprietary Nvidia driver is not supported by Sway. It is likely that you will run into issues. Continue anyways? [y/N] " - ) + choice = input("The proprietary Nvidia driver is not supported by Sway. It is likely that you will run into issues. Continue anyways? [y/N] ") if choice.lower() in ("n", ""): raise archinstall.lib.exceptions.HardwareIncompatibilityError("Sway does not support the proprietary nvidia drivers.") -- cgit v1.2.3-70-g09d2 From 3ee38afce1d8f3680245293f8f97353054afd52a Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Sat, 15 May 2021 17:28:27 -0400 Subject: One package per line formatting in profiles - easier to read/maintain --- profiles/applications/awesome.py | 12 +++++++++++- profiles/awesome.py | 7 ++++++- profiles/budgie.py | 7 ++++++- profiles/deepin.py | 8 +++++++- profiles/enlightenment.py | 7 ++++++- profiles/gnome.py | 6 +++++- profiles/i3.py | 10 +++++++++- profiles/kde.py | 10 +++++++++- profiles/lxqt.py | 11 ++++++++++- profiles/server.py | 12 +++++++++++- profiles/xorg.py | 9 ++++++++- 11 files changed, 88 insertions(+), 11 deletions(-) (limited to 'profiles/i3.py') diff --git a/profiles/applications/awesome.py b/profiles/applications/awesome.py index d5a8e793..33526fd7 100644 --- a/profiles/applications/awesome.py +++ b/profiles/applications/awesome.py @@ -1,6 +1,16 @@ import archinstall -__packages__ = ["awesome", "xorg-xrandr", "xterm", "feh", "slock", "terminus-font", "gnu-free-fonts", "ttf-liberation", "xsel"] +__packages__ = [ + "awesome", + "xorg-xrandr", + "xterm", + "feh", + "slock", + "terminus-font", + "gnu-free-fonts", + "ttf-liberation", + "xsel", +] archinstall.storage['installation_session'].install_profile('xorg') diff --git a/profiles/awesome.py b/profiles/awesome.py index aa4702a6..0c1b20ea 100644 --- a/profiles/awesome.py +++ b/profiles/awesome.py @@ -6,7 +6,12 @@ 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', 'main', 'alacritty'] +__packages__ = [ + "nemo", + "gpicview", + "main", + "alacritty", +] def _prep_function(*args, **kwargs): diff --git a/profiles/budgie.py b/profiles/budgie.py index abaf87b0..3e4a85df 100644 --- a/profiles/budgie.py +++ b/profiles/budgie.py @@ -5,7 +5,12 @@ import archinstall is_top_level_profile = False # "It is recommended also to install the gnome group, which contains applications required for the standard GNOME experience." - Arch Wiki -__packages__ = ["budgie-desktop", "lightdm", "lightdm-gtk-greeter", "gnome"] +__packages__ = [ + "budgie-desktop", + "gnome", + "lightdm", + "lightdm-gtk-greeter", +] def _prep_function(*args, **kwargs): diff --git a/profiles/deepin.py b/profiles/deepin.py index ebe730e2..5bc18285 100644 --- a/profiles/deepin.py +++ b/profiles/deepin.py @@ -4,7 +4,13 @@ import archinstall is_top_level_profile = False -__packages__ = ["deepin", "deepin-terminal", "deepin-editor", "lightdm", "lightdm-gtk-greeter"] +__packages__ = [ + "deepin", + "deepin-terminal", + "deepin-editor", + "lightdm", + "lightdm-gtk-greeter", +] def _prep_function(*args, **kwargs): diff --git a/profiles/enlightenment.py b/profiles/enlightenment.py index cfb97836..3850fed0 100644 --- a/profiles/enlightenment.py +++ b/profiles/enlightenment.py @@ -4,7 +4,12 @@ import archinstall is_top_level_profile = False -__packages__ = ["enlightenment", "terminology", "lightdm", "lightdm-gtk-greeter"] +__packages__ = [ + "enlightenment", + "terminology", + "lightdm", + "lightdm-gtk-greeter", +] def _prep_function(*args, **kwargs): diff --git a/profiles/gnome.py b/profiles/gnome.py index 7bf5b7fd..1b3bf327 100644 --- a/profiles/gnome.py +++ b/profiles/gnome.py @@ -5,7 +5,11 @@ import archinstall is_top_level_profile = False # Note: GDM should be part of the gnome group, but adding it here for clarity -__packages__ = ["gnome", "gnome-tweaks", "gdm"] +__packages__ = [ + "gnome", + "gnome-tweaks", + "gdm", +] def _prep_function(*args, **kwargs): diff --git a/profiles/i3.py b/profiles/i3.py index c25003f9..b26745a1 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -6,7 +6,15 @@ 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__ = ['i3lock', 'i3status', 'i3blocks', 'xterm', 'lightdm-gtk-greeter', 'lightdm', 'dmenu'] +__packages__ = [ + 'i3lock', + 'i3status', + 'i3blocks', + 'xterm', + 'lightdm-gtk-greeter', + 'lightdm', + 'dmenu', +] def _prep_function(*args, **kwargs): diff --git a/profiles/kde.py b/profiles/kde.py index 451704b9..c58f4f45 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -4,7 +4,15 @@ import archinstall is_top_level_profile = False -__packages__ = ["plasma-meta", "konsole", "kate", "dolphin", "sddm", "plasma-wayland-session", "egl-wayland"] +__packages__ = [ + "plasma-meta", + "konsole", + "kate", + "dolphin", + "sddm", + "plasma-wayland-session", + "egl-wayland", +] # TODO: Remove hard dependency of bash (due to .bash_profile) diff --git a/profiles/lxqt.py b/profiles/lxqt.py index af6337e6..a241353a 100644 --- a/profiles/lxqt.py +++ b/profiles/lxqt.py @@ -4,7 +4,16 @@ import archinstall is_top_level_profile = False -__packages__ = ["lxqt", "breeze-icons", "oxygen-icons", "xdg-utils", "ttf-freefont", "leafpad", "slock", "sddm"] +__packages__ = [ + "lxqt", + "breeze-icons", + "oxygen-icons", + "xdg-utils", + "ttf-freefont", + "leafpad", + "slock", + "sddm", +] def _prep_function(*args, **kwargs): diff --git a/profiles/server.py b/profiles/server.py index 355be9f5..704c8efe 100644 --- a/profiles/server.py +++ b/profiles/server.py @@ -6,7 +6,17 @@ import archinstall is_top_level_profile = True -available_servers = ["cockpit", "docker", "httpd", "lighttpd", "mariadb", "nginx", "postgresql", "sshd", "tomcat"] +available_servers = [ + "cockpit", + "docker", + "httpd", + "lighttpd", + "mariadb", + "nginx", + "postgresql", + "sshd", + "tomcat", +] def _prep_function(*args, **kwargs): diff --git a/profiles/xorg.py b/profiles/xorg.py index e18a4f03..b8fb2cbb 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -4,7 +4,14 @@ import archinstall is_top_level_profile = True -__packages__ = ['dkms', 'xorg-server', 'xorg-xinit', 'nvidia-dkms', 'xorg-server', *archinstall.lib.hardware.__packages__] +__packages__ = [ + 'dkms', + 'xorg-server', + 'xorg-xinit', + 'nvidia-dkms', + 'xorg-server', + *archinstall.lib.hardware.__packages__, +] def _prep_function(*args, **kwargs): -- cgit v1.2.3-70-g09d2 From da0da729c5f3ef0aaf832229901dda221de654ab Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Tue, 18 May 2021 09:10:24 -0400 Subject: Proofreading: Fix misc. spelling and grammar issues --- CONTRIBUTING.md | 29 +++++++--------- README.md | 66 ++++++++++++++++++++----------------- archinstall/lib/mirrors.py | 4 +-- archinstall/lib/networking.py | 2 +- archinstall/lib/output.py | 4 +-- archinstall/lib/user_interaction.py | 4 +-- docs/examples/python.rst | 4 +-- docs/installing/guided.rst | 2 +- docs/pull_request_template.md | 4 +-- profiles/52-54-00-12-34-56.py | 2 +- profiles/i3.py | 2 +- 11 files changed, 62 insertions(+), 61 deletions(-) (limited to 'profiles/i3.py') diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1d490a44..a92cff91 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,32 +1,28 @@ # Contributing to archinstall -Any contributions through pull requests are welcome as this project aims to be a community based project to ease some -Arch Linux installation steps. Bear in mind that in the future this repo might be transferred to the -official [GitLab repo under Arch Linux](http://gitlab.archlinux.org/archlinux/) *(if GitLab becomes open to the general -public)*. +Any contributions through pull requests are welcome as this project aims to be a community based project to ease some Arch Linux installation steps. +Bear in mind that in the future this repo might be transferred to the official [GitLab repo under Arch Linux](http://gitlab.archlinux.org/archlinux/) + *(if GitLab becomes open to the general public)*. -Therefore guidelines and style changes to the code might come into affect as well as guidelines surrounding bug -reporting and discussions. +Therefore, guidelines and style changes to the code might come into effect as well as guidelines surrounding bug reporting and discussions. ## Branches -`master` is currently the default branch, and that's where all future feature work is being done, this means -that `master` is a living entity and will most likely never be in a fully stable state. For stable releases, please see -the tagged commits. +`master` is currently the default branch, and that's where all future feature work is being done, this means that `master` is a living entity and will most likely never be in a fully stable state. +For stable releases, please see the tagged commits. -Patch releases will be done against their own branches, branched from stable tagged releases and will be named according -to the version it will become on release *(Patches to `v2.1.4` will be done on branch `v2.1.5` for instance)*. +Patch releases will be done against their own branches, branched from stable tagged releases and will be named according to the version it will become on release. + *(Patches to `v2.1.4` will be done on branch `v2.1.5` for instance)*. ## Discussions -Currently, questions, bugs and suggestions should be reported -through [GitHub issue tracker](https://github.com/archlinux/archinstall/issues).
+Currently, questions, bugs and suggestions should be reported through [GitHub issue tracker](https://github.com/archlinux/archinstall/issues).
For less formal discussions there are also a [archinstall Discord server](https://discord.gg/cqXU88y). ## Coding convention -Archinstall's goal is to follow [PEP8](https://www.python.org/dev/peps/pep-0008/) as best as it can with some minor -exceptions.
+ArchInstall's goal is to follow [PEP8](https://www.python.org/dev/peps/pep-0008/) as best as it can with some minor exceptions.
+ The exceptions to PEP8 are: * Archinstall uses [tabs instead of spaces](https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces) simply to make it @@ -46,8 +42,7 @@ There might therefore be older code which does not follow the coding convention ## Submitting Changes -Archinstall uses Github's pull-request workflow and all contributions in terms of code should be done through pull -requests.
+Archinstall uses GitHub's pull-request workflow and all contributions in terms of code should be done through pull requests.
Anyone interested in archinstall may review your code. One of the core developers will merge your pull request when they think it is ready. For every pull request, we aim to promptly either merge it or say why it is not yet ready; if you go diff --git a/README.md b/README.md index 63c8cefe..139dbd48 100644 --- a/README.md +++ b/README.md @@ -2,16 +2,16 @@ drawing # Arch Installer + Just another guided/automated [Arch Linux](https://wiki.archlinux.org/index.php/Arch_Linux) installer with a twist. The installer also doubles as a python library to install Arch Linux and manage services, packages and other things inside the installed system *(Usually from a live medium)*. - * archinstall [discord](https://discord.gg/cqXU88y) server - * archinstall [matrix.org](https://app.element.io/#/room/#archinstall:matrix.org) channel - * archinstall [#archinstall@freenode (IRC)](irc://#archinstall@FreeNode) - * archinstall [documentation](https://python-archinstall.readthedocs.io/en/latest/index.html) - +* archinstall [discord](https://discord.gg/cqXU88y) server +* archinstall [matrix.org](https://app.element.io/#/room/#archinstall:matrix.org) channel +* archinstall [#archinstall@freenode (IRC)](irc://#archinstall@FreeNode) +* archinstall [documentation](https://python-archinstall.readthedocs.io/en/latest/index.html) # Installation & Usage @@ -22,24 +22,27 @@ Or use `pip install --upgrade archinstall` to use as a library. ## Running the [guided](examples/guided.py) installer -Assuming you are on a Arch Linux live-ISO and booted into EFI mode. +Assuming you are on an Arch Linux live-ISO and booted into EFI mode. # python -m archinstall guided # Help? -Submit an issue here on Github, or submit a post in the discord help channel.
+Submit an issue here on GitHub, or submit a post in the discord help channel.
When doing so, attach the `/var/log/archinstall/install.log` to the issue ticket. This helps us help you! # Mission Statement -Archinstall promises to ship a [guided installer](https://github.com/archlinux/archinstall/blob/master/examples/guided.py) that follows the [Arch Principles](https://wiki.archlinux.org/index.php/Arch_Linux#Principles) as well as a library to manage services, packages and other Arch Linux aspects. +Archinstall promises to ship a [guided installer](https://github.com/archlinux/archinstall/blob/master/examples/guided.py) that follows +the [Arch Principles](https://wiki.archlinux.org/index.php/Arch_Linux#Principles) as well as a library to manage services, packages and other Arch Linux aspects. -The guided installer will provide user friendly options along the way, but the keyword here is options, they are optional and will never be forced upon anyone. The guided installer itself is also optional to use if so desired and not forced upon anyone. +The guided installer will provide user-friendly options along the way, but the keyword here is options, they are optional and will never be forced upon anyone. +The guided installer itself is also optional to use if so desired and not forced upon anyone. --- -Archinstall has one fundamental function which is to be a flexible library to manage services, packages and other aspects inside the installed system. This library is in turn used by the provided guided installer but is also for anyone who wants to script their own installations. +Archinstall has one fundamental function which is to be a flexible library to manage services, packages and other aspects inside the installed system. +This library is in turn used by the provided guided installer but is also for anyone who wants to script their own installations. Therefore, Archinstall will try its best to not introduce any breaking changes except for major releases which may break backwards compability after notifying about such changes. @@ -47,7 +50,7 @@ Therefore, Archinstall will try its best to not introduce any breaking changes e You could just copy [guided.py](examples/guided.py) as a starting point. -But assuming you're building your own ISO and want to create an automated install process, or you want to install virtual machines on to local disk images.
+However, assuming you're building your own ISO and want to create an automated installation process, or you want to install virtual machines on to local disk images.
This is probably what you'll need, a [minimal example](examples/minimal.py) of how to install using archinstall as a Python library. ```python @@ -99,33 +102,36 @@ with archinstall.Installer('/mnt') as installation: This installer will perform the following: - * Prompt the user to select a disk and disk-password - * Proceed to wipe the selected disk with a `GPT` partition table on a UEFI system and MBR on a bios system. - * Sets up a default 100% used disk with encryption. - * Installs a basic instance of Arch Linux *(base base-devel linux linux-firmware btrfs-progs efibootmgr)* - * Installs and configures a bootloader to partition 0 on uefi. on bios it sets the root to partition 0. - * Install additional packages *(nano, wget, git)* +* Prompt the user to select a disk and disk-password +* Proceed to wipe the selected disk with a `GPT` partition table on a UEFI system and MBR on a BIOS system. +* Sets up a default 100% used disk with encryption. +* Installs a basic instance of Arch Linux *(base base-devel linux linux-firmware btrfs-progs efibootmgr)* +* Installs and configures a bootloader to partition 0 on uefi. On BIOS, it sets the root to partition 0. +* Install additional packages *(nano, wget, git)* > **Creating your own ISO with this script on it:** Follow [ArchISO](https://wiki.archlinux.org/index.php/archiso)'s guide on how to create your own ISO or use a pre-built [guided ISO](https://hvornum.se/archiso/) to skip the python installation step, or to create auto-installing ISO templates. Further down are examples and cheat sheets on how to create different live ISO's. ## Unattended installation based on MAC address -Archinstall comes with a [unattended](examples/unattended.py) example which will look for a matching profile for the machine it is being run on, based on any local MAC address. For instance, if the machine that [unattended](examples/unattended.py) is run on has the MAC address `52:54:00:12:34:56` it will look for a profile called [profiles/52-54-00-12-34-56.py](profiles/52-54-00-12-34-56.py). If it's found, the unattended installation will commence and source that profile as it's installation proceedure. +Archinstall comes with a [unattended](examples/unattended.py) example which will look for a matching profile for the machine it is being run on, based on any local MAC address. +For instance, if the machine that [unattended](examples/unattended.py) is run on has the MAC address `52:54:00:12:34:56` it will look for a profile called [profiles/52-54-00-12-34-56.py](profiles/52-54-00-12-34-56.py). +If it's found, the unattended installation will commence and source that profile as it's installation procedure. # Testing ## Using a Live ISO Image -If you want to test a commit, branch or bleeding edge release from the repository using the vanilla Arch Live ISO image, you can replace the version of archinstall with a new version and run that with the steps described below. +If you want to test a commit, branch or bleeding edge release from the repository using the vanilla Arch Live ISO image, +you can replace the version of archinstall with a new version and run that with the steps described below: - 1. You need a working network connection - 2. Install the build requirements with `pacman -Sy; pacman -S git python-pip` - *(note that this may or may not work depending on your RAM and current state of the squashfs maximum filesystem free space)* - 3. Uninstall the previous version of archinstall with `pip uninstall archinstall` - 4. Now clone the latest repository with `git clone https://github.com/archlinux/archinstall` - 5. Enter the repository with `cd archinstall` - *At this stage, you can choose to check out a feature branch for instance with `git checkout torxed-v2.2.0`* - 6. Build the project and install it using `python setup.py install` +1. You need a working network connection +2. Install the build requirements with `pacman -Sy; pacman -S git python-pip` + *(note that this may or may not work depending on your RAM and current state of the squashfs maximum filesystem free space)* +3. Uninstall the previous version of archinstall with `pip uninstall archinstall` +4. Now clone the latest repository with `git clone https://github.com/archlinux/archinstall` +5. Enter the repository with `cd archinstall` + *At this stage, you can choose to check out a feature branch for instance with `git checkout torxed-v2.2.0`* +6. Build the project and install it using `python setup.py install` After this, running archinstall with `python -m archinstall` will run against whatever branch you chose in step 5. @@ -141,9 +147,9 @@ This can be done by installing `pacman -S arch-install-scripts util-linux` local # python -m archinstall guided # qemu-system-x86_64 -enable-kvm -machine q35,accel=kvm -device intel-iommu -cpu host -m 4096 -boot order=d -drive file=./testimage.img,format=raw -drive if=pflash,format=raw,readonly,file=/usr/share/ovmf/x64/OVMF_CODE.fd -drive if=pflash,format=raw,readonly,file=/usr/share/ovmf/x64/OVMF_VARS.fd -This will create a *5GB* `testimage.img` and create a loop device which we can use to format and install to.
-`archinstall` is installed and executed in [guided mode](#docs-todo). Once the installation is complete,
-~~you can use qemu/kvm to boot the test media.~~ *(You'd actually need to do some EFI magic in order to point the EFI vars to the partition 0 in the test medium so this won't work entirely out of the box, but gives you a general idea of what we're going for here)* +This will create a *5 GB* `testimage.img` and create a loop device which we can use to format and install to.
+`archinstall` is installed and executed in [guided mode](#docs-todo). Once the installation is complete, ~~you can use qemu/kvm to boot the test media.~~
+*(You'd actually need to do some EFI magic in order to point the EFI vars to the partition 0 in the test medium, so this won't work entirely out of the box, but that gives you a general idea of what we're going for here)* There's also a [Building and Testing](https://github.com/archlinux/archinstall/wiki/Building-and-Testing) guide.
It will go through everything from packaging, building and running *(with qemu)* the installer against a dev branch. diff --git a/archinstall/lib/mirrors.py b/archinstall/lib/mirrors.py index 5050df7d..4ef4fa49 100644 --- a/archinstall/lib/mirrors.py +++ b/archinstall/lib/mirrors.py @@ -10,8 +10,8 @@ def filter_mirrors_by_region(regions, destination='/etc/pacman.d/mirrorlist', tm This function will change the active mirrors on the live medium by filtering which regions are active based on `regions`. - :param region: A series of country codes separated by `,`. For instance `SE,US` for sweden and United States. - :type region: str + :param regions: A series of country codes separated by `,`. For instance `SE,US` for sweden and United States. + :type regions: str """ region_list = [] for region in regions.split(','): diff --git a/archinstall/lib/networking.py b/archinstall/lib/networking.py index 8a2f0edd..dbd510dd 100644 --- a/archinstall/lib/networking.py +++ b/archinstall/lib/networking.py @@ -31,7 +31,7 @@ def check_mirror_reachable(): check = SysCommand("pacman -Sy") return check.exit_code == 0 except: - return False + return False def enrich_iface_types(interfaces: dict): diff --git a/archinstall/lib/output.py b/archinstall/lib/output.py index 8bc6cacb..20b0df8d 100644 --- a/archinstall/lib/output.py +++ b/archinstall/lib/output.py @@ -26,7 +26,7 @@ class Journald(dict): except ModuleNotFoundError: return False - # For backwards compability, convert old style log-levels + # For backwards compatibility, convert old style log-levels # to logging levels (and warn about deprecated usage) # There's some code re-usage here but that should be fine. # TODO: Remove these in a few versions: @@ -135,7 +135,7 @@ def log(*args, **kwargs): # Unless the level is higher than we've decided to output interactively. # (Remember, log files still get *ALL* the output despite level restrictions) if 'level' in kwargs: - # For backwards compability, convert old style log-levels + # For backwards compatibility, convert old style log-levels # to logging levels (and warn about deprecated usage) # There's some code re-usage here but that should be fine. # TODO: Remove these in a few versions: diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index c640cb83..5f849607 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -242,7 +242,7 @@ class MiniCurses: if (mapped_char := mapper.get(char, None)) == 'BACKSPACE': if self._cursor_x <= self.input_pos: - # Don't backspace futher back than the cursor start position during input + # Don't backspace further back than the cursor start position during input return True # Move back to the current known position (BACKSPACE doesn't updated x-pos) sys.stdout.flush() @@ -694,7 +694,7 @@ def select_mirror_regions(mirrors, show_top_mirrors=True): def select_driver(options=AVAILABLE_GFX_DRIVERS): """ - Some what convoluted function, which's job is simple. + Some what convoluted function, whose job is simple. Select a graphics driver from a pre-defined set of popular options. (The template xorg is for beginner users, not advanced, and should diff --git a/docs/examples/python.rst b/docs/examples/python.rst index f6388738..342ec5c7 100644 --- a/docs/examples/python.rst +++ b/docs/examples/python.rst @@ -27,7 +27,7 @@ Lets create a `test_installer` - installer as an example. This is assuming that We begin by creating `./archinstall/examples/test_installer.py`. The placement here is important later. This script can now already be called using `python -m archinstall test_installer` after a successful installation of the library itself. -But the script won't do much. So we'll do something simple like list all the harddrives as an example. +But the script won't do much. So we'll do something simple like list all the hard drives as an example. To do this, we'll begin by importing `archinstall` in our `./archinstall/examples/test_installer.py` and call some functions. @@ -56,4 +56,4 @@ This should now print all available drives on your system. .. note:: - This should work on any system, not just Arch Linux based ones. But note that other functions in the library relies heavily on Arch Linux based commands to execute the installation steps. Such as `arch-chroot`. \ No newline at end of file + This should work on any system, not just Arch Linux based ones. But note that other functions in the library relies heavily on Arch Linux based commands to execute the installation steps. Such as `arch-chroot`. diff --git a/docs/installing/guided.rst b/docs/installing/guided.rst index 8699ae62..88b4e480 100644 --- a/docs/installing/guided.rst +++ b/docs/installing/guided.rst @@ -3,7 +3,7 @@ Guided installation This is the default scripted installation you'll encounter on the official Arch Linux Archinstall package as well as the unofficial ISO found on `https://archlinux.life `_. It will guide your through a very basic installation of Arch Linux. -The installer has two pre-requisits: +The installer has two pre-requisites: * A Physical or Virtual machine to install on * An active internet connection prior to running archinstall diff --git a/docs/pull_request_template.md b/docs/pull_request_template.md index 1cbcf76a..5e6daf51 100644 --- a/docs/pull_request_template.md +++ b/docs/pull_request_template.md @@ -3,11 +3,11 @@ # New features *(v2.2.0)* All future work towards *`v2.2.0`* is done against `master` now.
-Any patch work to existing verions will have to create a new branch against the tagged versions. +Any patch work to existing versions will have to create a new branch against the tagged versions. # Describe your PR -If the changes has been discussed in an Issue, please tag it so we can backtrace from the Issue later on.
+If the changes has been discussed in an Issue, please tag it so that we can backtrace from the issue later on.
If the PR is larger than ~20 lines, please describe it here unless described in an issue. # Testing diff --git a/profiles/52-54-00-12-34-56.py b/profiles/52-54-00-12-34-56.py index e1361073..68e15720 100644 --- a/profiles/52-54-00-12-34-56.py +++ b/profiles/52-54-00-12-34-56.py @@ -23,7 +23,7 @@ with archinstall.Filesystem(harddrive) as fs: fs.use_entire_disk('luks2') if harddrive.partition[1].size == '512M': - raise OSError('Trying to encrypt the boot partition for petes sake..') + raise OSError('Trying to encrypt the boot partition for Pete's sake..') harddrive.partition[0].format('fat32') with archinstall.luks2(harddrive.partition[1], 'luksloop', disk_password) as unlocked_device: diff --git a/profiles/i3.py b/profiles/i3.py index b26745a1..39977b28 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -62,7 +62,7 @@ if __name__ == 'i3': # Install dependency profiles archinstall.storage['installation_session'].install_profile('xorg') - # gaps is installed by deafult so we are overriding it here with lightdm + # gaps is installed by default so we are overriding it here with lightdm archinstall.storage['installation_session'].add_additional_packages(__packages__[4:]) # Auto start lightdm for all users -- cgit v1.2.3-70-g09d2