from . import logger
from . import step
from . import tui
+from . import util
from .i18n import _
from .errors import *
"language" : lang.default_language,
}
+ # Read OS information
+ self.os = self._read_os_release()
+
# Hardware
self.disks = disk.Disks(self)
# Run it
return step.run(self.tui)
+
+ def _read_os_release(self):
+ """
+ Read /etc/os-release
+ """
+ with open("/etc/os-release") as f:
+ return util.config_read(f)
Shows a very warm welcome message to the user
"""
def run(self, tui):
+ name = self.bricklayer.os.get("NAME")
+
tui.message(
title=_("Welcome"),
text=_("Welcome to the %s installation program.\n\n"
- "Selecting Cancel on any of the following screens will reboot the computer."),
+ "Selecting Cancel on any of the following screens will reboot the "
+ "computer.") % name,
buttons=(_("Start Installation"), _("Cancel"))
)
--- /dev/null
+###############################################################################
+# #
+# Bricklayer - An Installer for IPFire #
+# Copyright (C) 2021 IPFire Development Team #
+# #
+# This program is free software; you can redistribute it and/or #
+# modify it under the terms of the GNU General Public License #
+# as published by the Free Software Foundation; either version 2 #
+# of the License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
+
+def config_read(f):
+ """
+ Read a configuration file in key/value format
+ """
+ res = {}
+
+ # Read lines and split them by key/value
+ for line in f:
+ # Strip any trailing newline
+ line = line.rstrip()
+
+ # Split key/value
+ key, delim, value = line.partition("=")
+
+ # Unquote value
+ if value and value[0] == "\"" and value[-1] == "\"":
+ value = value[1:-1]
+
+ # Store the value
+ res[key] = value
+
+ return res