index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | archinstall/lib/disk.py | 8 | ||||
-rw-r--r-- | archinstall/lib/hardware.py | 57 | ||||
-rw-r--r-- | archinstall/lib/installer.py | 1 | ||||
-rw-r--r-- | archinstall/lib/user_interaction.py | 12 | ||||
-rw-r--r-- | examples/guided.py | 8 | ||||
-rw-r--r-- | profiles/applications/cockpit.py | 9 | ||||
-rw-r--r-- | profiles/i3.py | 4 | ||||
-rw-r--r-- | profiles/server.py | 30 | ||||
-rw-r--r-- | profiles/sway.py | 36 |
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index 49bef1be..44462a21 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -624,3 +624,11 @@ def get_filesystem_type(path): return b''.join(handle).strip().decode('UTF-8') except SysCallError: return None + +def disk_layouts(): + try: + handle = sys_command(f"lsblk -f -o+TYPE,SIZE -J") + return json.loads(b''.join(handle).decode('UTF-8')) + except SysCallError as err: + log(f"Could not return disk layouts: {err}") + return None
\ No newline at end of file diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py index e9c63e41..185ec1d6 100644 --- a/archinstall/lib/hardware.py +++ b/archinstall/lib/hardware.py @@ -3,24 +3,53 @@ from .general import sys_command from .networking import list_interfaces, enrichIfaceTypes from typing import Optional -__packages__ = ['xf86-video-amdgpu', 'xf86-video-ati', 'xf86-video-intel', 'xf86-video-nouveau', 'xf86-video-fbdev', 'xf86-video-vesa', 'xf86-video-vmware', 'nvidia', 'mesa'] +__packages__ = [ + "mesa", + "xf86-video-amdgpu", + "xf86-video-ati", + "xf86-video-nouveau", + "xf86-video-vmware", + "libva-mesa-driver", + "libva-intel-driver", + "intel-media-driver", + "vulkan-radeon", + "vulkan-intel", + "nvidia", +] AVAILABLE_GFX_DRIVERS = { # Sub-dicts are layer-2 options to be selected # and lists are a list of packages to be installed - 'AMD / ATI' : { - 'amd' : ['xf86-video-amdgpu'], - 'ati' : ['xf86-video-ati'] + "All open-source (default)": [ + "mesa", + "xf86-video-amdgpu", + "xf86-video-ati", + "xf86-video-nouveau", + "xf86-video-vmware", + "libva-mesa-driver", + "libva-intel-driver", + "intel-media-driver", + "vulkan-radeon", + "vulkan-intel", + ], + "AMD / ATI (open-source)": [ + "mesa", + "xf86-video-amdgpu", + "xf86-video-ati", + "libva-mesa-driver", + "vulkan-radeon", + ], + "Intel (open-source)": [ + "mesa", + "libva-intel-driver", + "intel-media-driver", + "vulkan-intel", + ], + "Nvidia": { + "open-source": ["mesa", "xf86-video-nouveau", "libva-mesa-driver"], + "proprietary": ["nvidia"], }, - 'intel' : ['xf86-video-intel'], - 'nvidia' : { - 'open-source' : ['xf86-video-nouveau'], - 'proprietary' : ['nvidia'] - }, - 'mesa' : ['mesa'], - 'fbdev' : ['xf86-video-fbdev'], - 'vesa' : ['xf86-video-vesa'], - 'vmware / virtualbox' : ['xf86-video-vmware'] + "VMware / VirtualBox (open-source)": ["mesa", "xf86-video-vmware"], } def hasWifi()->bool: @@ -65,7 +94,7 @@ def cpuVendor()-> Optional[str]: def isVM() -> bool: try: - subprocess.check_call(["systemd-detect-virt"]) # systemd-detect-virt issues a none 0 exit code if it is not on a virtual machine + subprocess.check_call(["systemd-detect-virt"]) # systemd-detect-virt issues a non-zero exit code if it is not on a virtual machine return True except: return False diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index a7b36481..331762b4 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -433,6 +433,7 @@ class Installer(): self.pacstrap('grub') if hasUEFI(): + self.pacstrap('efibootmgr') o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.target} grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB')) sys_command('/usr/bin/arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg') return True diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index aea708c8..7d3a34d5 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -285,14 +285,14 @@ class MiniCurses(): if response: return response -def ask_for_superuser_account(prompt='Username for required super-user with sudo privileges: ', forced=False): +def ask_for_superuser_account(prompt='Username for required superuser with sudo privileges: ', forced=False): while 1: new_user = input(prompt).strip(' ') if not new_user and forced: # TODO: make this text more generic? # It's only used to create the first sudo user when root is disabled in guided.py - log(' * Since root is disabled, you need to create a least one (super) user!', fg='red') + log(' * Since root is disabled, you need to create a least one superuser!', fg='red') continue elif not new_user and not forced: raise UserError("No superuser was created.") @@ -304,7 +304,7 @@ def ask_for_superuser_account(prompt='Username for required super-user with sudo def ask_for_additional_users(prompt='Any additional users to install (leave blank for no users): '): users = {} - super_users = {} + superusers = {} while 1: new_user = input(prompt).strip(' ') @@ -314,12 +314,12 @@ def ask_for_additional_users(prompt='Any additional users to install (leave blan continue password = get_password(prompt=f'Password for user {new_user}: ') - if input("Should this user be a sudo (super) user (y/N): ").strip(' ').lower() in ('y', 'yes'): - super_users[new_user] = {"!password" : password} + if input("Should this user be a superuser (sudoer) [y/N]: ").strip(' ').lower() in ('y', 'yes'): + superusers[new_user] = {"!password" : password} else: users[new_user] = {"!password" : password} - return users, super_users + return users, superusers def ask_for_a_timezone(): while True: diff --git a/examples/guided.py b/examples/guided.py index c281d033..40bebabf 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -7,6 +7,9 @@ if archinstall.arguments.get('help'): print("See `man archinstall` for help.") exit(0) +# For support reasons, we'll log the disk layout pre installation to match against post-installation layout +archinstall.log(f"Disk states before installing: {archinstall.disk_layouts()}", level=archinstall.LOG_LEVELS.Debug) + def ask_user_questions(): """ First, we'll ask the user for a bunch of user input. @@ -385,5 +388,8 @@ def perform_installation(mountpoint): except: pass + # For support reasons, we'll log the disk layout post installation (crash or no crash) + archinstall.log(f"Disk states after installing: {archinstall.disk_layouts()}", level=archinstall.LOG_LEVELS.Debug) + ask_user_questions() -perform_installation_steps() +perform_installation_steps()
\ No newline at end of file diff --git a/profiles/applications/cockpit.py b/profiles/applications/cockpit.py new file mode 100644 index 00000000..f1cea1d2 --- /dev/null +++ b/profiles/applications/cockpit.py @@ -0,0 +1,9 @@ +import archinstall + +# Define the package list in order for lib to source +# which packages will be installed by this profile +__packages__ = ["cockpit", "udisks2", "packagekit"] + +installation.add_additional_packages(__packages__) + +installation.enable_service('cockpit.socket') diff --git a/profiles/i3.py b/profiles/i3.py index 4d400468..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): """ @@ -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']) diff --git a/profiles/server.py b/profiles/server.py new file mode 100644 index 00000000..9d28054d --- /dev/null +++ b/profiles/server.py @@ -0,0 +1,30 @@ +# Used to select various server application profiles on top of a minimal installation. + +import archinstall, os, logging + +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 + before continuing any further. + """ + 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. + """ + archinstall.log(f'Now installing the selected servers.', level=logging.INFO) + 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.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 db94ae2c..8e256a87 100644 --- a/profiles/sway.py +++ b/profiles/sway.py @@ -4,7 +4,19 @@ import archinstall is_top_level_profile = False -__packages__ = ["sway", "swaylock", "swayidle", "waybar", "dmenu", "light", "grim", "slurp", "pavucontrol", "alacritty"] +__packages__ = [ + "sway", + "swaylock", + "swayidle", + "waybar", + "dmenu", + "light", + "grim", + "slurp", + "pavucontrol", + "alacritty", +] + def _prep_function(*args, **kwargs): """ @@ -13,18 +25,26 @@ def _prep_function(*args, **kwargs): other code in this stage. So it's a safe way to ask the user for more input before any other installer steps start. """ - 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] ") - if choice.lower() in ("n", ""): - raise archinstall.lib.exceptions.HardwareIncompatibilityError("Sway does not support the proprietary nvidia drivers.") - - __builtins__['_gfx_driver_packages'] = archinstall.select_driver() + __builtins__["_gfx_driver_packages"] = archinstall.select_driver() return True + # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("sway", "/somewhere/sway.py") # or through conventional import sway -if __name__ == '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] " + ) + if choice.lower() in ("n", ""): + raise archinstall.lib.exceptions.HardwareIncompatibilityError( + "Sway does not support the proprietary nvidia drivers." + ) + # Install the Sway packages installation.add_additional_packages(__packages__) + + # Install the graphics driver packages + installation.add_additional_packages(_gfx_driver_packages) |