Runs a single step
"""
# Initialize the step
- step = stepcls(self)
+ step = stepcls(self, tui=self.tui)
# Skip this step if it isn't enabled
if not step.enabled:
return
# Run it
- return step.run(self.tui)
+ return step.run()
def _read_os_release(self):
"""
"""
Installs the bootloader
"""
- def run(self, tui):
+ def run(self):
# Find all packages that need to be installed
packages = []
for bootloader in self.bricklayer.bootloaders:
packages += bootloader.packages
# Install them
- self.install_packages(tui, packages)
+ self.install_packages(packages)
# Install all bootloaders
for bootloader in self.bricklayer.bootloaders:
- with tui.progress(
+ with self.tui.progress(
_("Installing Bootloader"),
_("Installing bootloader \"%s\"...") % _(bootloader.name),
):
# Scan for disks
self.disks.scan()
- def run(self, tui):
+ def run(self):
# Create a dictionary with all disks
disks = { disk : "%s" % disk for disk in self.disks.supported }
# Show an error if no suitable disks were found
if not disks:
- tui.error(
+ self.tui.error(
_("No Disks Found"),
_("No supported disks were found")
)
while True:
# Select disks
- selection = tui.select(
+ selection = self.tui.select(
_("Disk Selection"),
_("Please select all disks for installation"),
disks, default=selection, multi=True, width=60,
# Is at least one disk selected?
if not selection:
- tui.error(
+ self.tui.error(
_("No Disk Selected"),
_("Please select a disk to continue the installation"),
buttons=[_("Back")],
"""
Calculates the partition layout
"""
- def run(self, tui):
+ def run(self):
# This probably will be fast enough that we do not need to show anything
# Perform the job
"""
Creates the desired partition layout on disk
"""
- def run(self, tui):
+ def run(self):
log.debug("Creating partitions")
- with tui.progress(
+ with self.tui.progress(
_("Creating Partition Layout"),
_("Creating partition layout..."),
):
"""
Formats all newly created partitions
"""
- def run(self, tui):
+ def run(self):
for disk in self.bricklayer.disks.selected:
for partition in disk.partitions:
- with tui.progress(
+ with self.tui.progress(
_("Creating Filesystems"),
_("Formatting partition \"%s\"...") % (partition.name or partition.path)
):
"""
Mount all filesystems
"""
- def run(self, tui):
- with tui.progress(
+ def run(self):
+ with self.tui.progress(
_("Mounting Filesystems"),
_("Mounting filesystems..."),
):
"""
Umount all filesystems
"""
- def run(self, tui):
- with tui.progress(
+ def run(self):
+ with self.tui.progress(
_("Umounting Filesystems"),
_("Umounting filesystems..."),
):
from . import step
class InstallPackages(step.Step):
- def run(self, tui):
+ def run(self):
# Get list of all packages to be installed
packages = self.bricklayer.settings.get("packages", [])
- self.install_packages(tui, packages)
+ self.install_packages(packages)
# This enables or disables this step
enabled = True
- def __init__(self, bricklayer):
+ def __init__(self, bricklayer, tui):
self.bricklayer = bricklayer
+ self.tui = tui
log.debug("Initializing step %s" % self.__class__.__name__)
"""
pass
- def run(self, tui):
+ def run(self):
"""
Run this step - to be overlayed
"""
pass
- def install_packages(self, tui, packages):
+ def install_packages(self, packages):
# Nothing to do if there are no packages
if not packages:
return
# Set up Pakfire
- with tui.progress(
+ with self.tui.progress(
_("Setting Up Pakfire"),
_("Pakfire is being set up..."),
):
with p as p:
# Resolve package dependencies
- with tui.progress(
+ with self.tui.progress(
_("Resolving Dependencies"),
_("Resolving package dependencies..."),
):
text.append("\n".join(lines))
- tui.error(
+ self.tui.error(
_("Dependency Problem"),
_(
"A problem has occured during resolving package dependencies:\n\n%s",
log.info("%s" % transaction.dump())
# Run the transaction
- with tui.progress(
+ with self.tui.progress(
_("Installing Packages"),
_("Installing packages..."),
):
"""
Shows a very warm welcome message to the user
"""
- def run(self, tui):
+ def run(self):
name = self.bricklayer.os.get("NAME")
current_language = self.bricklayer.settings.get("language")
# Let the user select
- lang = tui.select(
+ lang = self.tui.select(
_("Willkommen, Bienvenue, Welcome!"),
_("Select the language you wish to use for the installation"),
i18n.supported_languages, default=current_language,
"""
Shows a message that the installation is complete
"""
- def run(self, tui):
- tui.message(
+ def run(self):
+ self.tui.message(
_("Congratulations"),
_(
"The installation has been completed successfully."
# Only enabled in unattended mode
return self.bricklayer.unattended
- def run(self, tui):
+ def run(self):
seconds = 10
- p = tui.progress(
+ p = self.tui.progress(
_("Unattended Installation"),
_("Unattended installation is starting in %s seconds") % seconds,
max_value=seconds * 10,
class RootPassword(InteractiveStep):
- def run(self, tui):
- password = tui.passwd(
+ def run(self):
+ password = self.tui.passwd(
_("Root Password"),
_("Please enter the password for the 'root' user"),
)
log = logging.getLogger("bricklayer.timezones")
class SelectTimezone(step.InteractiveStep):
- def run(self, tui):
+ def run(self):
# Get a list of all available timezones
timezones = {
tz : tz for tz in sorted(pytz.all_timezones)
# Which timezone is currently selected?
timezone = self.bricklayer.settings.get("timezone", "UTC")
- timezone = tui.select(
+ timezone = self.tui.select(
_("Timezone"),
_("Please select the timezone:"),
timezones, default=timezone,