]> git.ipfire.org Git - people/ms/bricklayer.git/commitdiff
Add "first install" mode to do configuration later
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 10 May 2021 19:57:33 +0000 (19:57 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 10 May 2021 19:57:33 +0000 (19:57 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/bricklayer
src/python/__init__.py
src/python/step.py
src/python/timezones.py

index f64ba4b73d09c6be4a57705a38c92e3fd9baf9af..b0d3a4c41d51ae8e21a8efbff93e3344df91430b 100644 (file)
@@ -40,6 +40,8 @@ class Cli(object):
                parser = argparse.ArgumentParser(
                        description=_("IPFire Installation Tool CLI"),
                )
+               parser.add_argument("--first-install", action="store_true",
+                       help=_("Runs the \"first install\" setup process"))
                parser.add_argument("--arch", nargs="?", default=self.native_arch,
                        help=_("Select the target architecture"))
                parser.add_argument("--debug", action="store_true",
index e1b1c483d671fadf32cb4eab3898bbaf70e056cb..8f2686fd8d6a8ee547980619ee87e25c7d40109d 100644 (file)
@@ -45,8 +45,9 @@ class Bricklayer(object):
        """
                Bricklayer's base class
        """
-       def __init__(self, arch, debug=False, unattended=False, disks=[]):
+       def __init__(self, arch, first_install=False, debug=False, unattended=False, disks=[]):
                self.arch = arch
+               self.first_install = first_install
                self.unattended = unattended
 
                # Enable debug logging
@@ -182,6 +183,10 @@ class Bricklayer(object):
                # Initialize the step
                step = stepcls(self, tui=self.tui)
 
+               # Skip this step if it isn't enabled in first install mode
+               if self.first_install and not step.first_install:
+                       return
+
                # Skip this step if it isn't enabled
                if not step.enabled:
                        return
index c00c94a5e39cb55c63a6ed8f117f127c2130d95f..b4eefe845df203f4d547e17a25118f161041fc84 100644 (file)
@@ -39,6 +39,9 @@ class Step(object):
        # This enables or disables this step
        enabled = True
 
+       # Should this be run in first-install mode?
+       first_install = False
+
        def __init__(self, bricklayer, tui):
                self.bricklayer = bricklayer
                self.tui = tui
@@ -131,6 +134,8 @@ class Welcome(InteractiveStep):
        """
                Shows a very warm welcome message to the user
        """
+       first_install = True
+
        def run(self):
                name = self.bricklayer.os.get("NAME")
                current_language = self.bricklayer.settings.get("language")
@@ -156,6 +161,8 @@ class Congratulations(InteractiveStep):
        """
                Shows a message that the installation is complete
        """
+       first_install = True
+
        def run(self):
                self.tui.message(
                        _("Congratulations"),
@@ -170,6 +177,7 @@ class Congratulations(InteractiveStep):
                        width=50,
                )
 
+
 class UnattendedWarning(Step):
        @property
        def enabled(self):
@@ -193,6 +201,8 @@ class UnattendedWarning(Step):
 
 
 class RootPassword(InteractiveStep):
+       first_install = True
+
        def run(self):
                password = self.tui.passwd(
                        _("Root Password"),
index adb15bfa8c99a4182ec36d8201afae626dd10dd1..7e3b245c52939df6853b345f02d3fec0541f2645 100644 (file)
@@ -28,6 +28,8 @@ from .i18n import _
 log = logging.getLogger("bricklayer.timezones")
 
 class SelectTimezone(step.InteractiveStep):
+       first_install = True
+
        def run(self):
                # Get a list of all available timezones
                timezones = {