From b98850819bdbdb23e354bb5bf5d5383cf807d22d Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 4 Nov 2020 22:41:50 +0100 Subject: Added multiple log features. * [Reintroduced](https://github.com/Torxed/archinstall/blob/f64a605449f59c677dff39962f1cb46616d893b7/archinstall.py#L57-L71) log levels * Created a global log file definition * Optional support for `python-systemd`'s journald handler. * Optional file output that has a globally configurable definition, that archinstall will honor in `archinstall.storage['logfile']`. --- examples/guided.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index 70c2050d..ee57e2b5 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -1,5 +1,13 @@ +import getpass, time, json, sys, signal, os import archinstall -import getpass, time, json, sys, signal + +# Setup a global log file. +# Archinstall will honor storage['logfile'] in most of it's functions log handle. +log_root = os.path.join(os.path.expanduser('~/'), '.cache/archinstall') +if not os.path.isdir(log_root): + os.makedirs(log_root) + +archinstall.storage['logfile'] = f"{log_root}/install-session_{self.init_time}.{self.milliseconds}.log" """ This signal-handler chain (and global variable) @@ -29,7 +37,7 @@ def perform_installation(device, boot_partition, language, mirrors): # Certain services might be running that affects the system during installation. # Currently, only one such service is "reflector.service" which updates /etc/pacman.d/mirrorlist # We need to wait for it before we continue since we opted in to use a custom mirror/region. - archinstall.log(f'Waiting for automatic mirror selection has completed before using custom mirrors.') + installation.log(f'Waiting for automatic mirror selection has completed before using custom mirrors.') while 'dead' not in (status := archinstall.service_state('reflector')): time.sleep(1) @@ -136,6 +144,9 @@ while 1: if type(profile) != str: # Got a imported profile archinstall.storage['_guided']['profile'] = profile[0] # The second return is a module, and not a handle/object. if not profile[1]._prep_function(): + # TODO: See how we can incorporate this into + # the general log flow. As this is pre-installation + # session setup. Which creates the installation.log file. archinstall.log( ' * Profile\'s preparation requirements was not fulfilled.', bg='black', -- cgit v1.2.3-70-g09d2 From f794cad7bb8ca104e9bdebca9e3a2ca1c124d8b8 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 4 Nov 2020 23:36:54 +0000 Subject: Forgot to remove self. reference when copying some code. --- examples/guided.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index ee57e2b5..8295c849 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -7,7 +7,9 @@ log_root = os.path.join(os.path.expanduser('~/'), '.cache/archinstall') if not os.path.isdir(log_root): os.makedirs(log_root) -archinstall.storage['logfile'] = f"{log_root}/install-session_{self.init_time}.{self.milliseconds}.log" +init_time = time.strftime('%Y-%m-%d %H:%M:%S') +milliseconds = int(str(time.time()).split('.')[1]) +archinstall.storage['logfile'] = f"{log_root}/install-session_{init_time}.{milliseconds}.log" """ This signal-handler chain (and global variable) -- cgit v1.2.3-70-g09d2 From c22e986874c60e7baffc503023070ec6ffbdda72 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 5 Nov 2020 00:05:03 +0000 Subject: Added the overall guided config into the installer log. This applies to the guided template only. --- examples/guided.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'examples/guided.py') diff --git a/examples/guided.py b/examples/guided.py index 8295c849..0ecad27a 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -175,9 +175,11 @@ while 1: except archinstall.RequirementError as e: print(e) + print() print('This is your chosen configuration:') -print(json.dumps(archinstall.storage['_guided'], indent=4, sort_keys=True, cls=archinstall.JSON)) +archinstall.log("-- Guided template chosen (with below config) --", level=archinstall.LOG_LEVELS.Debug) +archinstall.log(json.dumps(archinstall.storage['_guided'], indent=4, sort_keys=True, cls=archinstall.JSON), level=archinstall.LOG_LEVELS.Info) print() """ -- cgit v1.2.3-70-g09d2 From ee9af976ca700f96480f2f1396ed861d78013204 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 8 Nov 2020 10:56:29 +0100 Subject: Updated documentation Related to the new log features. --- README.md | 5 +++++ archinstall/lib/installer.py | 2 +- docs/help/discord.rst | 14 ++++++++++++++ docs/help/issues.rst | 31 +++++++++++++++++++++++++++++++ examples/guided.py | 2 +- 5 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 docs/help/discord.rst create mode 100644 docs/help/issues.rst (limited to 'examples/guided.py') diff --git a/README.md b/README.md index 8d574369..c6e0c839 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,11 @@ This installer will perform the following: > **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. +# Help + +Submit an issue on Github, or submit a post in the discord help channel.
+When doing so, attach any `install-session_*.log` to the issue ticket which can be found under `~/.cache/archinstall/`. + # Testing To test this without a live ISO, the simplest approach is to use a local image and create a loop device.
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 79621058..775de50a 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -37,7 +37,7 @@ class Installer(): self.profile = profile self.hostname = hostname self.mountpoint = mountpoint - self.init_time = time.strftime('%Y-%m-%d %H:%M:%S') + self.init_time = time.strftime('%Y-%m-%d_%H-%M-%S') self.milliseconds = int(str(time.time()).split('.')[1]) self.helper_flags = { diff --git a/docs/help/discord.rst b/docs/help/discord.rst new file mode 100644 index 00000000..996f721c --- /dev/null +++ b/docs/help/discord.rst @@ -0,0 +1,14 @@ +.. _help.discord: + +Discord +======= + +There's a discord channel which is frequent by some `contributors `_. + +To join the server, head over to `discord.com/archinstall `_'s server and join in. +There's not many rules other than common sense and treat others with respect. + +There's the `@Party Animals` role if you want notifications of new releases which is posted in the `#Release Party` channel. +Another thing is the `@Contributors` role which you can get by writing `!verify` and verify that you're a contributor. + +Hop in, I hope to see you there! : ) \ No newline at end of file diff --git a/docs/help/issues.rst b/docs/help/issues.rst new file mode 100644 index 00000000..594cc77a --- /dev/null +++ b/docs/help/issues.rst @@ -0,0 +1,31 @@ +.. _help.issues: + +Issue tracker +============= + +Issues should be reported over at `GitHub/issues `_. + +General questions, enhancements and security issues can be reported over there too. +For quick issues or if you need help, head over the to the Discord server which has a help channel. + +Submitting a help ticket +======================== + +When submitting a help ticket, please include the *install-session_\*.log* found under *~/.cache/archinstall/* on the installation medium. + +.. code::bash + + cd ~/.cache/archinstall + . + ├── install-session_2020-11-08_10-43-50.665316.log + └── workers + ├── 1edc2abd08261603fb78a1f6083dc74654ea6625d167744221f6bd3dec4bcd5b + ├── a7c8c2ceea27df2b483c493995556c86bc3e4a1befd0f6709ef6a56ff91d23f4 + └── fadaf96c1164684cc16b374f703f7d3b959545e1ec1fb5471ace9835bf105752 + +| You can submit the *install-session_2020-11-08_10-43-50.665316.log* in this example to the support personel. +| They might ask you for individual worker files as well, they contain the raw output from the individual commands executed such *pacman -S ...* etc. + +.. warning:: + + Worker log-files *may* contain sensitive information such as **passwords** and **private information**. Never submit these logs without going through them manually making sure they're good for submission. Or submit parts of it that's relevant to the issue itself. diff --git a/examples/guided.py b/examples/guided.py index 0ecad27a..652852e0 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -7,7 +7,7 @@ log_root = os.path.join(os.path.expanduser('~/'), '.cache/archinstall') if not os.path.isdir(log_root): os.makedirs(log_root) -init_time = time.strftime('%Y-%m-%d %H:%M:%S') +init_time = time.strftime('%Y-%m-%d_%H-%M-%S') milliseconds = int(str(time.time()).split('.')[1]) archinstall.storage['logfile'] = f"{log_root}/install-session_{init_time}.{milliseconds}.log" -- cgit v1.2.3-70-g09d2