From dcf178c7e8ae733fa46d680dee392fb4815ba2d9 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Thu, 3 Jun 2021 07:20:16 -0400 Subject: Add some safeguards to create directories before writing files --- archinstall/lib/installer.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'archinstall/lib') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index c2db8337..da6f6a9b 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -2,8 +2,8 @@ from .disk import * from .hardware import * from .locale_helpers import verify_keyboard_layout, verify_x11_keyboard_layout from .mirrors import * -from .storage import storage from .plugins import plugins +from .storage import storage from .user_interaction import * # Any package that the Installer() is responsible for (optional and the default ones) @@ -54,7 +54,6 @@ class Installer: for kernel in kernels: self.base_packages.append(kernel) - self.post_base_install = [] storage['session'] = self @@ -442,6 +441,10 @@ class Installer: # Fallback, try creating the boot loader without touching the EFI variables SysCommand(f'/usr/bin/arch-chroot {self.target} bootctl --no-variables --path=/boot install') + # Ensure that the /boot/loader directory exists before we try to create files in it + if not os.path.exists(f'{self.target}/boot/loader'): + os.makedirs(f'{self.target}/boot/loader') + # Modify or create a loader.conf if os.path.isfile(f'{self.target}/boot/loader/loader.conf'): with open(f'{self.target}/boot/loader/loader.conf', 'r') as loader: @@ -462,6 +465,10 @@ class Installer: else: loader.write(f"{line}\n") + # Ensure that the /boot/loader/entries directory exists before we try to create files in it + if not os.path.exists(f'{self.target}/boot/loader/entries'): + os.makedirs(f'{self.target}/boot/loader/entries') + for kernel in self.kernels: # Setup the loader entry with open(f'{self.target}/boot/loader/entries/{self.init_time}_{kernel}.conf', 'w') as entry: -- cgit v1.2.3-70-g09d2