Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions archinstall/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,36 @@ def plugin(f, *args, **kwargs) -> None: # type: ignore[no-untyped-def]

def _log_sys_info() -> None:
# Log various information about hardware before starting the installation. This might assist in troubleshooting
debug(f"Hardware model detected: {SysInfo.sys_vendor()} {SysInfo.product_name()}; UEFI mode: {SysInfo.has_uefi()}")
debug(f"Processor model detected: {SysInfo.cpu_model()}")
debug(f"Memory statistics: {SysInfo.mem_available()} available out of {SysInfo.mem_total()} total installed")
debug(f"Virtualization detected: {SysInfo.virtualization()}; is VM: {SysInfo.is_vm()}")
debug(f"Graphics devices detected: {SysInfo._graphics_devices().keys()}")
debug(f'Hardware model detected: {SysInfo.sys_vendor()} {SysInfo.product_name()}; UEFI mode: {SysInfo.has_uefi()}')
debug(f'Processor model detected: {SysInfo.cpu_model()}')
debug(f'Memory statistics: {SysInfo.mem_available()} available out of {SysInfo.mem_total()} total installed')
debug(f'Virtualization detected: {SysInfo.virtualization()}; is VM: {SysInfo.is_vm()}')
debug(f'Graphics devices detected: {SysInfo._graphics_devices().keys()}')

# For support reasons, we'll log the disk layout pre installation to match against post-installation layout
debug(f"Disk states before installing:\n{disk_layouts()}")
debug(f'Disk states before installing:\n{disk_layouts()}')


def _fetch_arch_db() -> None:
info("Fetching Arch Linux package database...")
info('Fetching Arch Linux package database...')
try:
Pacman.run("-Sy")
Pacman.run('-Sy')
except Exception as e:
debug(f"Failed to sync Arch Linux package database: {e}")
debug(f'Failed to sync Arch Linux package database: {e}')
exit(1)


def _check_new_version() -> None:
info("Checking version...")
info('Checking version...')
upgrade = None

try:
upgrade = Pacman.run("-Qu archinstall").decode()
upgrade = Pacman.run('-Qu archinstall').decode()
except Exception as e:
debug(f"Failed determine pacman version: {e}")
debug(f'Failed determine pacman version: {e}')

if upgrade:
text = f"New version available: {upgrade}"
text = f'New version available: {upgrade}'
info(text)
time.sleep(3)

Expand All @@ -65,12 +65,12 @@ def main() -> int:
OR straight as a module: python -m archinstall
In any case we will be attempting to load the provided script to be run from the scripts/ folder
"""
if "--help" in sys.argv or "-h" in sys.argv:
if '--help' in sys.argv or '-h' in sys.argv:
arch_config_handler.print_help()
return 0

if os.getuid() != 0:
print(tr("Archinstall requires root privileges to run. See --help for more."))
print(tr('Archinstall requires root privileges to run. See --help for more.'))
return 1

_log_sys_info()
Expand All @@ -83,7 +83,7 @@ def main() -> int:

script = arch_config_handler.args.script

mod_name = f"archinstall.scripts.{script}"
mod_name = f'archinstall.scripts.{script}'
# by loading the module we'll automatically run the script
importlib.import_module(mod_name)

Expand All @@ -103,11 +103,11 @@ def run_as_a_module() -> None:
Tui.shutdown()

if exc:
err = "".join(traceback.format_exception(exc))
err = ''.join(traceback.format_exception(exc))
error(err)

text = (
"Archinstall experienced the above error. If you think this is a bug, please report it to\n"
'Archinstall experienced the above error. If you think this is a bug, please report it to\n'
'https://github.com/archlinux/archinstall and include the log file "/var/log/archinstall/install.log".\n\n'
"Hint: To extract the log from a live ISO \ncurl -F'file=@/var/log/archinstall/install.log' https://0x0.st\n"
)
Expand All @@ -119,19 +119,19 @@ def run_as_a_module() -> None:


__all__ = [
"FormattedOutput",
"Language",
"Pacman",
"SysInfo",
"Tui",
"arch_config_handler",
"debug",
"disk_layouts",
"error",
"info",
"load_plugin",
"log",
"plugin",
"translation_handler",
"warn",
'FormattedOutput',
'Language',
'Pacman',
'SysInfo',
'Tui',
'arch_config_handler',
'debug',
'disk_layouts',
'error',
'info',
'load_plugin',
'log',
'plugin',
'translation_handler',
'warn',
]
2 changes: 1 addition & 1 deletion archinstall/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import archinstall

if __name__ == "__main__":
if __name__ == '__main__':
archinstall.run_as_a_module()
28 changes: 14 additions & 14 deletions archinstall/default_profiles/applications/pipewire.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@

class PipewireProfile(Profile):
def __init__(self) -> None:
super().__init__("Pipewire", ProfileType.Application)
super().__init__('Pipewire', ProfileType.Application)

@property
@override
def packages(self) -> list[str]:
return [
"pipewire",
"pipewire-alsa",
"pipewire-jack",
"pipewire-pulse",
"gst-plugin-pipewire",
"libpulse",
"wireplumber",
'pipewire',
'pipewire-alsa',
'pipewire-jack',
'pipewire-pulse',
'gst-plugin-pipewire',
'libpulse',
'wireplumber',
]

def _enable_pipewire_for_all(self, install_session: "Installer") -> None:
def _enable_pipewire_for_all(self, install_session: 'Installer') -> None:
from archinstall.lib.args import arch_config_handler

users: list[User] | None = arch_config_handler.config.users
Expand All @@ -34,24 +34,24 @@ def _enable_pipewire_for_all(self, install_session: "Installer") -> None:

for user in users:
# Create the full path for enabling the pipewire systemd items
service_dir = install_session.target / "home" / user.username / ".config" / "systemd" / "user" / "default.target.wants"
service_dir = install_session.target / 'home' / user.username / '.config' / 'systemd' / 'user' / 'default.target.wants'
service_dir.mkdir(parents=True, exist_ok=True)

# Set ownership of the entire user catalogue
install_session.arch_chroot(f"chown -R {user.username}:{user.username} /home/{user.username}")
install_session.arch_chroot(f'chown -R {user.username}:{user.username} /home/{user.username}')

# symlink in the correct pipewire systemd items
install_session.arch_chroot(
f"ln -sf /usr/lib/systemd/user/pipewire-pulse.service /home/{user.username}/.config/systemd/user/default.target.wants/pipewire-pulse.service",
f'ln -sf /usr/lib/systemd/user/pipewire-pulse.service /home/{user.username}/.config/systemd/user/default.target.wants/pipewire-pulse.service',
run_as=user.username,
)
install_session.arch_chroot(
f"ln -sf /usr/lib/systemd/user/pipewire-pulse.socket /home/{user.username}/.config/systemd/user/default.target.wants/pipewire-pulse.socket",
f'ln -sf /usr/lib/systemd/user/pipewire-pulse.socket /home/{user.username}/.config/systemd/user/default.target.wants/pipewire-pulse.socket',
run_as=user.username,
)

@override
def install(self, install_session: "Installer") -> None:
def install(self, install_session: 'Installer') -> None:
super().install(install_session)
install_session.add_additional_packages(self.packages)
self._enable_pipewire_for_all(install_session)
32 changes: 16 additions & 16 deletions archinstall/default_profiles/desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class DesktopProfile(Profile):
def __init__(self, current_selection: list[Profile] = []) -> None:
super().__init__(
"Desktop",
'Desktop',
ProfileType.Desktop,
current_selection=current_selection,
support_greeter=True,
Expand All @@ -25,16 +25,16 @@ def __init__(self, current_selection: list[Profile] = []) -> None:
@override
def packages(self) -> list[str]:
return [
"nano",
"vim",
"openssh",
"htop",
"wget",
"iwd",
"wireless_tools",
"wpa_supplicant",
"smartmontools",
"xdg-utils",
'nano',
'vim',
'openssh',
'htop',
'wget',
'iwd',
'wireless_tools',
'wpa_supplicant',
'smartmontools',
'xdg-utils',
]

@property
Expand Down Expand Up @@ -75,8 +75,8 @@ def do_on_select(self) -> SelectResult:
allow_reset=True,
allow_skip=True,
preview_style=PreviewStyle.RIGHT,
preview_size="auto",
preview_frame=FrameProperties.max("Info"),
preview_size='auto',
preview_frame=FrameProperties.max('Info'),
).run()

match result.type_:
Expand All @@ -90,17 +90,17 @@ def do_on_select(self) -> SelectResult:
return SelectResult.ResetCurrent

@override
def post_install(self, install_session: "Installer") -> None:
def post_install(self, install_session: 'Installer') -> None:
for profile in self.current_selection:
profile.post_install(install_session)

@override
def install(self, install_session: "Installer") -> None:
def install(self, install_session: 'Installer') -> None:
# Install common packages for all desktop environments
install_session.add_additional_packages(self.packages)

for profile in self.current_selection:
info(f"Installing profile {profile.name}...")
info(f'Installing profile {profile.name}...')

install_session.add_additional_packages(profile.packages)
install_session.enable_service(profile.services)
Expand Down
4 changes: 2 additions & 2 deletions archinstall/default_profiles/desktops/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@


class SeatAccess(Enum):
seatd = "seatd"
polkit = "polkit"
seatd = 'seatd'
polkit = 'polkit'
52 changes: 26 additions & 26 deletions archinstall/default_profiles/desktops/awesome.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,56 +9,56 @@

class AwesomeProfile(XorgProfile):
def __init__(self) -> None:
super().__init__("Awesome", ProfileType.WindowMgr)
super().__init__('Awesome', ProfileType.WindowMgr)

@property
@override
def packages(self) -> list[str]:
return super().packages + [
"awesome",
"alacritty",
"xorg-xinit",
"xorg-xrandr",
"xterm",
"feh",
"slock",
"terminus-font",
"gnu-free-fonts",
"ttf-liberation",
"xsel",
'awesome',
'alacritty',
'xorg-xinit',
'xorg-xrandr',
'xterm',
'feh',
'slock',
'terminus-font',
'gnu-free-fonts',
'ttf-liberation',
'xsel',
]

@override
def install(self, install_session: "Installer") -> None:
def install(self, install_session: 'Installer') -> None:
super().install(install_session)

# TODO: Copy a full configuration to ~/.config/awesome/rc.lua instead.
with open(f"{install_session.target}/etc/xdg/awesome/rc.lua") as fh:
with open(f'{install_session.target}/etc/xdg/awesome/rc.lua') as fh:
awesome_lua = fh.read()

# Replace xterm with alacritty for a smoother experience.
awesome_lua = awesome_lua.replace('"xterm"', '"alacritty"')

with open(f"{install_session.target}/etc/xdg/awesome/rc.lua", "w") as fh:
with open(f'{install_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)

# TODO: check if we selected a greeter,
# but for now, awesome is intended to run without one.
with open(f"{install_session.target}/etc/X11/xinit/xinitrc") as xinitrc:
with open(f'{install_session.target}/etc/X11/xinit/xinitrc') as xinitrc:
xinitrc_data = xinitrc.read()

for line in xinitrc_data.split("\n"):
if "twm &" in line:
xinitrc_data = xinitrc_data.replace(line, f"# {line}")
if "xclock" in line:
xinitrc_data = xinitrc_data.replace(line, f"# {line}")
if "xterm" in line:
xinitrc_data = xinitrc_data.replace(line, f"# {line}")
for line in xinitrc_data.split('\n'):
if 'twm &' in line:
xinitrc_data = xinitrc_data.replace(line, f'# {line}')
if 'xclock' in line:
xinitrc_data = xinitrc_data.replace(line, f'# {line}')
if 'xterm' in line:
xinitrc_data = xinitrc_data.replace(line, f'# {line}')

xinitrc_data += "\n"
xinitrc_data += "exec awesome\n"
xinitrc_data += '\n'
xinitrc_data += 'exec awesome\n'

with open(f"{install_session.target}/etc/X11/xinit/xinitrc", "w") as xinitrc:
with open(f'{install_session.target}/etc/X11/xinit/xinitrc', 'w') as xinitrc:
xinitrc.write(xinitrc_data)
12 changes: 6 additions & 6 deletions archinstall/default_profiles/desktops/bspwm.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@

class BspwmProfile(XorgProfile):
def __init__(self) -> None:
super().__init__("Bspwm", ProfileType.WindowMgr)
super().__init__('Bspwm', ProfileType.WindowMgr)

@property
@override
def packages(self) -> list[str]:
# return super().packages + [
return [
"bspwm",
"sxhkd",
"dmenu",
"xdo",
"rxvt-unicode",
'bspwm',
'sxhkd',
'dmenu',
'xdo',
'rxvt-unicode',
]

@property
Expand Down
12 changes: 6 additions & 6 deletions archinstall/default_profiles/desktops/budgie.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@

class BudgieProfile(XorgProfile):
def __init__(self) -> None:
super().__init__("Budgie", ProfileType.DesktopEnv)
super().__init__('Budgie', ProfileType.DesktopEnv)

@property
@override
def packages(self) -> list[str]:
return [
"materia-gtk-theme",
"budgie",
"mate-terminal",
"nemo",
"papirus-icon-theme",
'materia-gtk-theme',
'budgie',
'mate-terminal',
'nemo',
'papirus-icon-theme',
]

@property
Expand Down
Loading
Loading