# Save the password for now
self.bricklayer.settings["root-password"] = password
+
+
+class ToggleFirstInstallStatus(Step):
+ first_install = True
+
+ @property
+ def enabled(self):
+ # Only enabled in unattended and first install mode
+ return self.bricklayer.unattended or self.bricklayer.first_install
+
+ def run(self):
+ # Path to the marker file
+ path = os.path.join(self.bricklayer.root, ".firstinstall")
+
+ # Create file in unattended mode
+ if self.bricklayer.unattended:
+ with open(path, "w"):
+ pass
+
+ # Remove the file in first install mode
+ elif self.bricklayer.first_install:
+ try:
+ os.unlink(path)
+ except FileNotFoundError:
+ pass