Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/installer.py
diff options
context:
space:
mode:
Diffstat (limited to 'archinstall/lib/installer.py')
-rw-r--r--archinstall/lib/installer.py30
1 files changed, 17 insertions, 13 deletions
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index c9d7e9cc..99c5506b 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -34,13 +34,18 @@ class Installer():
:type hostname: str, optional
"""
- def __init__(self, partition, boot_partition, *, base_packages='base base-devel linux linux-firmware efibootmgr nano', profile=None, mountpoint='/mnt', hostname='ArchInstalled'):
+ def __init__(self, partition, boot_partition, *, base_packages='base base-devel linux linux-firmware efibootmgr nano', profile=None, mountpoint='/mnt', hostname='ArchInstalled', logdir=None, logfile=None):
self.profile = profile
self.hostname = hostname
self.mountpoint = mountpoint
self.init_time = time.strftime('%Y-%m-%d_%H-%M-%S')
self.milliseconds = int(str(time.time()).split('.')[1])
+ if logdir:
+ storage['LOG_PATH'] = logdir
+ if logfile:
+ storage['LOG_FILE'] = logfile
+
self.helper_flags = {
'bootloader' : False,
'base' : False,
@@ -54,18 +59,12 @@ class Installer():
self.partition = partition
self.boot_partition = boot_partition
- def log(self, *args, level=LOG_LEVELS.Debug, file=None, **kwargs):
- if not file:
- if 'logfile' not in storage:
- log_root = os.path.join(os.path.expanduser('~/'), '.cache/archinstall')
- if not os.path.isdir(log_root):
- os.makedirs(log_root)
-
- storage['logfile'] = f"{log_root}/install-session_{self.init_time}.{self.milliseconds}.log"
-
- file = storage['logfile']
-
- log(*args, level=level, file=file, **kwargs)
+ def log(self, *args, level=LOG_LEVELS.Debug, **kwargs):
+ """
+ installer.log() wraps output.log() mainly to set a default log-level for this install session.
+ Any manual override can be done per log() call.
+ """
+ log(*args, level=level, **kwargs)
def __enter__(self, *args, **kwargs):
self.partition.mount(self.mountpoint)
@@ -77,6 +76,11 @@ class Installer():
# b''.join(sys_command(f'sync')) # No need to, since the underlaying fs() object will call sync.
# TODO: https://stackoverflow.com/questions/28157929/how-to-safely-handle-an-exception-inside-a-context-manager
if len(args) >= 2 and args[1]:
+ #self.log(self.trace_log.decode('UTF-8'), level=LOG_LEVELS.Debug)
+ self.log(args[1], level=LOG_LEVELS.Error)
+
+ print(f"[!] A log file has been created here: {os.path.join(storage['LOG_PATH'], storage['LOG_FILE'])}")
+ print(f" Please submit this issue (and file) to https://github.com/Torxed/archinstall/issues")
raise args[1]
self.genfstab()