Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/configuration.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2022-08-28 22:04:25 +0200
committerGitHub <noreply@github.com>2022-08-28 22:04:25 +0200
commit13703fbb04d7bc7975368b035342e104c26e3f35 (patch)
treefad90fef6678180dfbf0062cc4a357a92fca4ea6 /archinstall/lib/configuration.py
parent65212a46aa43fadb2b0ee88b46b573765d7be9f9 (diff)
Fix permission flags on all the log files created (#1440)
* Changed permissions on the logs stored in /var/log/archinstall. Also cleaned up one of the saves to have the same syntax as the others * Tweaked secondary encryption password detection logic, as it wouldn't take it from the main arguments[] otherwise. * Changed permission on cmd_output.txt * Changed permission on cmd_history.txt
Diffstat (limited to 'archinstall/lib/configuration.py')
-rw-r--r--archinstall/lib/configuration.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/archinstall/lib/configuration.py b/archinstall/lib/configuration.py
index 510f7103..2a43174d 100644
--- a/archinstall/lib/configuration.py
+++ b/archinstall/lib/configuration.py
@@ -1,4 +1,6 @@
+import os
import json
+import stat
import logging
import pathlib
from typing import Optional, Dict
@@ -106,23 +108,33 @@ class ConfigurationOutput:
def save_user_config(self, dest_path :pathlib.Path = None):
if self._is_valid_path(dest_path):
- with open(dest_path / self._user_config_file, 'w') as config_file:
+ target = dest_path / self._user_config_file
+
+ with open(target, 'w') as config_file:
config_file.write(self.user_config_to_json())
+ os.chmod(str(dest_path / self._user_config_file), stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP)
+
def save_user_creds(self, dest_path :pathlib.Path = None):
if self._is_valid_path(dest_path):
if user_creds := self.user_credentials_to_json():
target = dest_path / self._user_creds_file
+
with open(target, 'w') as config_file:
config_file.write(user_creds)
+ os.chmod(str(target), stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP)
+
def save_disk_layout(self, dest_path :pathlib.Path = None):
if self._is_valid_path(dest_path):
if disk_layout := self.disk_layout_to_json():
target = dest_path / self._disk_layout_file
+
with target.open('w') as config_file:
config_file.write(disk_layout)
+ os.chmod(str(target), stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP)
+
def save(self, dest_path :pathlib.Path = None):
if not dest_path:
dest_path = self._default_save_path