Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/examples/only_hd.py
diff options
context:
space:
mode:
authorWerner Llácer <wllacer@gmail.com>2022-02-05 13:52:14 +0100
committerGitHub <noreply@github.com>2022-02-05 13:52:14 +0100
commitec73bdab4cf124aba16e10293e5e75a3bc89afb8 (patch)
tree1863b408806c853d92c2553e46f3f303bbc01338 /examples/only_hd.py
parent0ec9549dc49a05c5059e34926d366dadfb3aa5b8 (diff)
Routine to properly print and save config data (#888)
* Created a standard function to show/save the config parameters * flake8 complains * Correct definition of btrfs standard layout * Solve issue #936 * Moved output_configs to lib/configuration.py
Diffstat (limited to 'examples/only_hd.py')
-rw-r--r--examples/only_hd.py51
1 files changed, 3 insertions, 48 deletions
diff --git a/examples/only_hd.py b/examples/only_hd.py
index f1bddbb2..7195d810 100644
--- a/examples/only_hd.py
+++ b/examples/only_hd.py
@@ -1,4 +1,3 @@
-import json
import logging
import os
import pathlib
@@ -49,52 +48,6 @@ def ask_user_questions():
"""
ask_harddrives()
-def save_user_configurations():
- user_credentials = {}
- if archinstall.arguments.get('!users'):
- user_credentials["!users"] = archinstall.arguments['!users']
- if archinstall.arguments.get('!superusers'):
- user_credentials["!superusers"] = archinstall.arguments['!superusers']
- if archinstall.arguments.get('!encryption-password'):
- user_credentials["!encryption-password"] = archinstall.arguments['!encryption-password']
-
- user_configuration = json.dumps({
- 'config_version': archinstall.__version__, # Tells us what version was used to generate the config
- **archinstall.arguments, # __version__ will be overwritten by old version definition found in config
- 'version': archinstall.__version__
- } , indent=4, sort_keys=True, cls=archinstall.JSON)
-
- with open("/var/log/archinstall/user_credentials.json", "w") as config_file:
- config_file.write(json.dumps(user_credentials, indent=4, sort_keys=True, cls=archinstall.UNSAFE_JSON))
-
- with open("/var/log/archinstall/user_configuration.json", "w") as config_file:
- config_file.write(user_configuration)
-
- if archinstall.arguments.get('disk_layouts'):
- user_disk_layout = json.dumps(archinstall.arguments['disk_layouts'], indent=4, sort_keys=True, cls=archinstall.JSON)
- with open("/var/log/archinstall/user_disk_layout.json", "w") as disk_layout_file:
- disk_layout_file.write(user_disk_layout)
-
-
-def write_config_files():
- print()
- print('This is your chosen configuration:')
- archinstall.log("-- Guided template chosen (with below config) --", level=logging.DEBUG)
-
- user_configuration = json.dumps({**archinstall.arguments, 'version' : archinstall.__version__} , indent=4, sort_keys=True, cls=archinstall.JSON)
- archinstall.log(user_configuration, level=logging.INFO)
-
- if archinstall.arguments.get('disk_layouts'):
- user_disk_layout = json.dumps(archinstall.arguments['disk_layouts'], indent=4, sort_keys=True, cls=archinstall.JSON)
- archinstall.log(user_disk_layout, level=logging.INFO)
-
- print()
-
- save_user_configurations()
- if archinstall.arguments.get('dry_run'):
- exit(0)
-
-
def perform_disk_operations():
"""
Issue a final warning before we continue with something un-revertable.
@@ -170,9 +123,11 @@ if not archinstall.check_mirror_reachable():
if not archinstall.arguments.get('silent'):
ask_user_questions()
+archinstall.output_configs(archinstall.arguments,show=False if archinstall.arguments.get('silent') else True)
+if archinstall.arguments.get('dry_run'):
+ exit(0)
if not archinstall.arguments.get('silent'):
- write_config_files()
input('Press Enter to continue.')
perform_disk_operations()