Exemplo n.º 1
0
def doInstall(storage, payload, ksdata, instClass):
    """Perform an installation.  This method takes the ksdata as prepared by
       the UI (the first hub, in graphical mode) and applies it to the disk.
       The two main tasks for this are putting filesystems onto disks and
       installing packages onto those filesystems.
    """
    willRunRealmd = ksdata.realm.join_realm
    willInstallBootloader = not flags.flags.dirInstall and (
        not ksdata.bootloader.disabled and ksdata.bootloader != "none")

    # First save system time to HW clock.
    if flags.can_touch_runtime_system("save system time to HW clock"):
        timezone.save_hw_clock(ksdata.timezone)

    # We really only care about actions that affect filesystems, since
    # those are the ones that take the most time.
    steps = len(storage.devicetree.findActions(action_type="create", object_type="format")) + \
            len(storage.devicetree.findActions(action_type="resize", object_type="format"))

    # Update every 10% of packages installed.  We don't know how many packages
    # we are installing until it's too late (see realmd later on) so this is
    # the best we can do.
    steps += 11

    # pre setup phase, post install
    steps += 2

    # realmd, maybe
    if willRunRealmd:
        steps += 1

    # bootloader, maybe
    if willInstallBootloader:
        steps += 1

    # This should be the only thread running, wait for the others to finish if not.
    if threadMgr.running > 1:
        progress_init(steps + 1)

        with progress_report(
                _("Waiting for %s threads to finish") %
            (threadMgr.running - 1)):
            for message in ("Thread %s is running" % n
                            for n in threadMgr.names):
                log.debug(message)
            threadMgr.wait_all()
    else:
        progress_init(steps)

    with progress_report(_("Setting up the installation environment")):
        ksdata.firstboot.setup(storage, ksdata, instClass)
        ksdata.addons.setup(storage, ksdata, instClass)

    storage.updateKSData()  # this puts custom storage info into ksdata

    # Do partitioning.
    payload.preStorage()

    # callbacks for blivet
    message_clbk = lambda clbk_data: progress_message(clbk_data.msg)
    step_clbk = lambda clbk_data: progress_step(clbk_data.msg)
    entropy_wait_clbk = lambda clbk_data: wait_for_entropy(
        clbk_data.msg, clbk_data.min_entropy, ksdata)
    callbacks_reg = callbacks.create_new_callbacks_register(
        create_format_pre=message_clbk,
        create_format_post=step_clbk,
        resize_format_pre=message_clbk,
        resize_format_post=step_clbk,
        wait_for_entropy=entropy_wait_clbk)

    turnOnFilesystems(storage,
                      mountOnly=flags.flags.dirInstall,
                      callbacks=callbacks_reg)
    payload.writeStorageEarly()

    # Run %pre-install scripts with the filesystem mounted and no packages
    with progress_report(_("Running pre-installation scripts")):
        runPreInstallScripts(ksdata.scripts)

    # Do packaging.

    # Discover information about realms to join,
    # to determine additional packages
    if willRunRealmd:
        with progress_report(_("Discovering realm to join")):
            ksdata.realm.setup()

    # Check for additional packages
    ksdata.authconfig.setup()
    ksdata.firewall.setup()
    ksdata.network.setup()

    # make name resolution work for rpm scripts in chroot
    if flags.can_touch_runtime_system("copy /etc/resolv.conf to sysroot"):
        network.copyFileToPath("/etc/resolv.conf", iutil.getSysroot())

    # anaconda requires storage packages in order to make sure the target
    # system is bootable and configurable, and some other packages in order
    # to finish setting up the system.
    packages = storage.packages + ksdata.realm.packages
    packages += ksdata.authconfig.packages + ksdata.firewall.packages + ksdata.network.packages

    if willInstallBootloader:
        packages += storage.bootloader.packages

    # don't try to install packages from the install class' ignored list and the
    # explicitly excluded ones (user takes the responsibility)
    packages = [
        p for p in packages if p not in instClass.ignoredPackages
        and p not in ksdata.packages.excludedList
    ]
    payload.preInstall(packages=packages, groups=payload.languageGroups())
    payload.install()

    payload.writeStorageLate()

    # Do bootloader.
    if willInstallBootloader:
        with progress_report(_("Installing boot loader")):
            writeBootLoader(storage, payload, instClass, ksdata)

    with progress_report(_("Performing post-installation setup tasks")):
        payload.postInstall()

    progress_complete()
Exemplo n.º 2
0
def doInstall(storage, payload, ksdata, instClass):
    """Perform an installation.  This method takes the ksdata as prepared by
       the UI (the first hub, in graphical mode) and applies it to the disk.
       The two main tasks for this are putting filesystems onto disks and
       installing packages onto those filesystems.
    """
    willRunRealmd = ksdata.realm.join_realm
    willInstallBootloader = not flags.flags.dirInstall and (not ksdata.bootloader.disabled
                                                            and ksdata.bootloader != "none")

    # First save system time to HW clock.
    if flags.can_touch_runtime_system("save system time to HW clock"):
        timezone.save_hw_clock(ksdata.timezone)

    # We really only care about actions that affect filesystems, since
    # those are the ones that take the most time.
    steps = len(storage.devicetree.findActions(action_type="create", object_type="format")) + \
            len(storage.devicetree.findActions(action_type="resize", object_type="format"))

    # Update every 10% of packages installed.  We don't know how many packages
    # we are installing until it's too late (see realmd later on) so this is
    # the best we can do.
    steps += 11

    # pre setup phase, post install
    steps += 2

    # realmd, maybe
    if willRunRealmd:
        steps += 1

    # bootloader, maybe
    if willInstallBootloader:
        steps += 1

    # This should be the only thread running, wait for the others to finish if not.
    if threadMgr.running > 1:
        progress_init(steps+1)

        with progress_report(N_("Waiting for %s threads to finish") % (threadMgr.running-1)):
            for message in ("Thread %s is running" % n for n in threadMgr.names):
                log.debug(message)
            threadMgr.wait_all()
    else:
        progress_init(steps)

    with progress_report(N_("Setting up the installation environment")):
        ksdata.firstboot.setup(storage, ksdata, instClass)
        ksdata.addons.setup(storage, ksdata, instClass)

    storage.updateKSData()  # this puts custom storage info into ksdata

    # Do partitioning.
    payload.preStorage()

    # callbacks for blivet
    message_clbk = lambda clbk_data: progress_message(clbk_data.msg)
    step_clbk = lambda clbk_data: progress_step(clbk_data.msg)
    entropy_wait_clbk = lambda clbk_data: wait_for_entropy(clbk_data.msg,
                                                           clbk_data.min_entropy, ksdata)
    callbacks_reg = callbacks.create_new_callbacks_register(create_format_pre=message_clbk,
                                                            create_format_post=step_clbk,
                                                            resize_format_pre=message_clbk,
                                                            resize_format_post=step_clbk,
                                                            wait_for_entropy=entropy_wait_clbk)

    turnOnFilesystems(storage, mountOnly=flags.flags.dirInstall, callbacks=callbacks_reg)
    payload.writeStorageEarly()

    # Run %pre-install scripts with the filesystem mounted and no packages
    with progress_report(N_("Running pre-installation scripts")):
        runPreInstallScripts(ksdata.scripts)

    # Do packaging.

    # Discover information about realms to join,
    # to determine additional packages
    if willRunRealmd:
        with progress_report(N_("Discovering realm to join")):
            ksdata.realm.setup()

    # Check for additional packages
    ksdata.authconfig.setup()
    ksdata.firewall.setup()
    ksdata.network.setup()
    # Setup timezone and add chrony as package if timezone was set in KS
    # and "-chrony" wasn't in packages section and/or --nontp wasn't set.
    ksdata.timezone.setup(ksdata)

    # make name resolution work for rpm scripts in chroot
    if flags.can_touch_runtime_system("copy /etc/resolv.conf to sysroot"):
        network.copyFileToPath("/etc/resolv.conf", iutil.getSysroot())

    # anaconda requires storage packages in order to make sure the target
    # system is bootable and configurable, and some other packages in order
    # to finish setting up the system.
    packages = storage.packages + ksdata.realm.packages
    packages += ksdata.authconfig.packages + ksdata.firewall.packages + ksdata.network.packages

    if willInstallBootloader:
        packages += storage.bootloader.packages

    # don't try to install packages from the install class' ignored list and the
    # explicitly excluded ones (user takes the responsibility)
    packages = [p for p in packages
                if p not in instClass.ignoredPackages and p not in ksdata.packages.excludedList]
    payload.preInstall(packages=packages, groups=payload.languageGroups())
    payload.install()

    payload.writeStorageLate()

    # Do bootloader.
    if willInstallBootloader:
        with progress_report(N_("Installing boot loader")):
            writeBootLoader(storage, payload, instClass, ksdata)

    with progress_report(N_("Performing post-installation setup tasks")):
        payload.postInstall()

    progress_complete()
Exemplo n.º 3
0
def doInstall(storage, payload, ksdata, instClass):
    """Perform an installation.  This method takes the ksdata as prepared by
       the UI (the first hub, in graphical mode) and applies it to the disk.
       The two main tasks for this are putting filesystems onto disks and
       installing packages onto those filesystems.
    """
    willRunRealmd = ksdata.realm.join_realm
    willInstallBootloader = not flags.flags.dirInstall and (not ksdata.bootloader.disabled
                                                            and ksdata.bootloader != "none")

    # First save system time to HW clock.
    if flags.can_touch_runtime_system("save system time to HW clock"):
        timezone.save_hw_clock(ksdata.timezone)

    # We really only care about actions that affect filesystems, since
    # those are the ones that take the most time.
    steps = len(storage.devicetree.findActions(action_type="create", object_type="format")) + \
            len(storage.devicetree.findActions(action_type="resize", object_type="format"))

    # pre setup phase, post install
    steps += 2

    # realmd, maybe
    if willRunRealmd:
        steps += 1

    # bootloader, maybe
    if willInstallBootloader:
        steps += 1

    # This should be the only thread running, wait for the others to finish if not.
    if threadMgr.running > 1:
        progress_init(steps+1)

        with progress_report(_("Waiting for %s threads to finish") % (threadMgr.running-1)):
            map(log.debug, ("Thread %s is running" % n for n in threadMgr.names))
            threadMgr.wait_all()
    else:
        progress_init(steps)

    with progress_report(_("Setting up the installation environment")):
        ksdata.firstboot.setup(storage, ksdata, instClass)
        ksdata.addons.setup(storage, ksdata, instClass)

    storage.updateKSData()  # this puts custom storage info into ksdata

    # Do partitioning.
    payload.preStorage()

    # callbacks for blivet
    message_clbk = lambda clbk_data: progress_message(clbk_data.msg)
    step_clbk = lambda clbk_data: progress_step(clbk_data.msg)
    entropy_wait_clbk = lambda clbk_data: wait_for_entropy(clbk_data.msg,
                                                           clbk_data.min_entropy, ksdata)
    callbacks_reg = callbacks.create_new_callbacks_register(create_format_pre=message_clbk,
                                                            create_format_post=step_clbk,
                                                            resize_format_pre=message_clbk,
                                                            resize_format_post=step_clbk,
                                                            wait_for_entropy=entropy_wait_clbk)

    turnOnFilesystems(storage, mountOnly=flags.flags.dirInstall, callbacks=callbacks_reg)
    write_storage_late = (flags.flags.livecdInstall or ksdata.ostreesetup.seen
                          or ksdata.method.method == "liveimg")
    if not write_storage_late and not flags.flags.dirInstall:
        storage.write()

    # STACKI
    file = open('/proc/cmdline', 'r')
    args = file.readline().split()
    file.close()

    if 'boss' in args:
        import subprocess
        import os

        #
        # if we are a boss, then download the selected rolls
        #
        log.debug('STACKI: Downloading pallets: start')
        bossenv = os.environ.copy()
        bossenv['LD_LIBRARY_PATH'] = '/opt/stack/lib'
        bossenv['DISPLAY'] = ':1'
        s = subprocess.Popen('/opt/stack/bin/boss_download_pallets.py',
            env = bossenv)
        s.wait()
        log.debug('STACKI: Downloading pallets: complete')

        payload.reset()

        #
        # 
        #
        for repo in payload._yum.repos.repos.values():
            log.debug('STACKI: repo.id (%s)' % repo.id)
            # if repo.id not in [ 'stacki', 'os' ]:
                # log.debug('STACKI: disabling repo repo.id (%s)' % repo.id)
                # payload.disableRepo(repo.id)
    else:
        #
        # need to setup a symbolic link in order to store all the packages
        # downloaded by lighttpd
        #
        import os

        cmd = 'rm -rf /install ; '
        cmd += 'mkdir -p /mnt/sysimage/install ; '
        cmd += 'ln -s /mnt/sysimage/install /install'
        os.system(cmd)

    # STACKI

    # Do packaging.

    # Discover information about realms to join,
    # to determine additional packages
    if willRunRealmd:
        with progress_report(_("Discovering realm to join")):
            ksdata.realm.setup()

    # make name resolution work for rpm scripts in chroot
    if flags.can_touch_runtime_system("copy /etc/resolv.conf to sysroot"):
        network.copyFileToPath("/etc/resolv.conf", iutil.getSysroot())

    # Check for additional packages
    ksdata.authconfig.setup()
    ksdata.firewall.setup()

    # anaconda requires storage packages in order to make sure the target
    # system is bootable and configurable, and some other packages in order
    # to finish setting up the system.
    packages = storage.packages + ksdata.realm.packages
    packages += ksdata.authconfig.packages + ksdata.firewall.packages

    if willInstallBootloader:
        packages += storage.bootloader.packages

    if network.is_using_team_device():
        packages.append("teamd")

    # don't try to install packages from the install class' ignored list and the
    # explicitly excluded ones (user takes the responsibility)
    packages = [p for p in packages
                if p not in instClass.ignoredPackages and p not in ksdata.packages.excludedList]
    payload.preInstall(packages=packages, groups=payload.languageGroups())
    payload.install()

    if write_storage_late and not flags.flags.dirInstall:
        if iutil.getSysroot() != iutil.getTargetPhysicalRoot():
            blivet.setSysroot(iutil.getTargetPhysicalRoot(),
                              iutil.getSysroot())

            # Now that we have the FS layout in the target, umount
            # things that were in the legacy sysroot, and put them in
            # the target root, except for the physical /.  First,
            # unmount all target filesystems.
            storage.umountFilesystems()

            # Explicitly mount the root on the physical sysroot
            rootmnt = storage.mountpoints.get('/')
            rootmnt.setup()
            rootmnt.format.setup(options=rootmnt.format.options, chroot=iutil.getTargetPhysicalRoot())

            payload.prepareMountTargets(storage)

            # Everything else goes in the target root, including /boot
            # since the bootloader code will expect to find /boot
            # inside the chroot.
            storage.mountFilesystems(skipRoot=True)
        storage.write()

    # Do bootloader.
    if willInstallBootloader:
        with progress_report(_("Installing boot loader")):
            writeBootLoader(storage, payload, instClass, ksdata)

    with progress_report(_("Performing post-installation setup tasks")):
        payload.postInstall()

    progress_complete()
Exemplo n.º 4
0
def doInstall(storage, payload, ksdata, instClass):
    """Perform an installation.  This method takes the ksdata as prepared by
       the UI (the first hub, in graphical mode) and applies it to the disk.
       The two main tasks for this are putting filesystems onto disks and
       installing packages onto those filesystems.
    """
    # First save system time to HW clock.
    if flags.can_touch_runtime_system("save system time to HW clock"):
        timezone.save_hw_clock(ksdata.timezone)

    # We really only care about actions that affect filesystems, since
    # those are the ones that take the most time.
    steps = len(storage.devicetree.findActions(type="create", object="format")) + \
            len(storage.devicetree.findActions(type="resize", object="format"))
    steps += 6
    # pre setup phase, packages setup, packages, bootloader, realmd,
    # post install
    progressQ.send_init(steps)

    # This should be the only thread running, wait for the others to finish if not.
    if threadMgr.running > 1:
        with progress_report(_("Waiting for %s threads to finish") % (threadMgr.running-1)):
            map(log.debug, ("Thread %s is running" % n for n in threadMgr.names))
            threadMgr.wait_all()

    with progress_report(_("Setting up the installation environment")):
        ksdata.firstboot.setup(storage, ksdata, instClass)
        ksdata.addons.setup(storage, ksdata, instClass)

    storage.updateKSData()  # this puts custom storage info into ksdata

    # Do partitioning.
    payload.preStorage()

    turnOnFilesystems(storage, mountOnly=flags.flags.dirInstall)
    if not flags.flags.livecdInstall and not flags.flags.dirInstall:
        storage.write()

    # Do packaging.

    # Discover information about realms to join,
    # to determine additional packages
    if ksdata.realm.join_realm:
        with progress_report(_("Discovering realm to join")):
            ksdata.realm.setup()

    # anaconda requires storage packages in order to make sure the target
    # system is bootable and configurable, and some other packages in order
    # to finish setting up the system.
    packages = storage.packages
    packages += ["net-firewall/firewalld"]
    packages += ksdata.realm.packages

    # don't try to install packages from the install class' ignored list
    packages = [p for p in packages if p not in instClass.ignoredPackages]
    payload.preInstall(packages=packages, groups=payload.languageGroups())
    payload.install()

    if flags.flags.livecdInstall:
        storage.write()

    with progress_report(_("Performing post-installation setup tasks")):
        payload.postInstall()

    # Do bootloader.
    if not flags.flags.dirInstall:
        with progress_report(_("Installing bootloader")):
            writeBootLoader(storage, payload, instClass, ksdata)

    progressQ.send_complete()
Exemplo n.º 5
0
def doInstall(storage, payload, ksdata, instClass):
    """Perform an installation.  This method takes the ksdata as prepared by
       the UI (the first hub, in graphical mode) and applies it to the disk.
       The two main tasks for this are putting filesystems onto disks and
       installing packages onto those filesystems.
    """
    willRunRealmd = ksdata.realm.join_realm
    willInstallBootloader = not flags.flags.dirInstall and (not ksdata.bootloader.disabled
                                                            and ksdata.bootloader != "none")

    # First save system time to HW clock.
    if flags.can_touch_runtime_system("save system time to HW clock"):
        timezone.save_hw_clock(ksdata.timezone)

    # We really only care about actions that affect filesystems, since
    # those are the ones that take the most time.
    steps = len(storage.devicetree.findActions(action_type="create", object_type="format")) + \
            len(storage.devicetree.findActions(action_type="resize", object_type="format"))

    # pre setup phase, pre install, post install
    steps += 3

    # realmd, maybe
    if willRunRealmd:
        steps += 1

    # bootloader, maybe
    if willInstallBootloader:
        steps += 1

    # This should be the only thread running, wait for the others to finish if not.
    if threadMgr.running > 1:
        progress_init(steps+1)

        with progress_report(_("Waiting for %s threads to finish") % (threadMgr.running-1)):
            map(log.debug, ("Thread %s is running" % n for n in threadMgr.names))
            threadMgr.wait_all()
    else:
        progress_init(steps)

    with progress_report(_("Setting up the installation environment")):
        ksdata.firstboot.setup(storage, ksdata, instClass)
        ksdata.addons.setup(storage, ksdata, instClass, payload)

    # put custom storage info into ksdata, but not if just assigning mount points
    if not ksdata.mount.dataList():
        storage.updateKSData()

    # Do partitioning.
    payload.preStorage()

    # callbacks for blivet
    message_clbk = lambda clbk_data: progress_message(clbk_data.msg)
    step_clbk = lambda clbk_data: progress_step(clbk_data.msg)
    entropy_wait_clbk = lambda clbk_data: wait_for_entropy(clbk_data.msg,
                                                           clbk_data.min_entropy, ksdata)
    callbacks_reg = callbacks.create_new_callbacks_register(create_format_pre=message_clbk,
                                                            create_format_post=step_clbk,
                                                            resize_format_pre=message_clbk,
                                                            resize_format_post=step_clbk,
                                                            wait_for_entropy=entropy_wait_clbk)

    turnOnFilesystems(storage, mountOnly=flags.flags.dirInstall, callbacks=callbacks_reg)
    write_storage_late = (flags.flags.livecdInstall or ksdata.ostreesetup.seen
                          or ksdata.method.method == "liveimg")
    if not write_storage_late and not flags.flags.dirInstall:
        storage.write()

    #
    # STACKI
    #
    # Check to see if we're running as a frontend
    #
    import os

    file = open('/proc/cmdline', 'r')
    args = file.readline().split()
    file.close()

    if 'frontend' in args:
	# If /export does not exist, create a symlink
	# to /state/partition1. If /state/partition1 doesn't
	# exist either, just ignore
	if not os.path.exists('/mnt/sysimage/export'):
		if os.path.exists('/mnt/sysimage/state/partition1'):
			pwd = os.getcwd()
			os.chdir('/mnt/sysimage')
			os.symlink('state/partition1',
				'export')
			os.chdir(pwd)
	
	# Enable all known repos
        for repo in payload._yum.repos.repos.values():
		payload.enableRepo(repo.id)
		log.debug('STACKI: repo.id (%s) - %s' % (repo.id, repo.isEnabled()))

    else:
	#
	# need to setup a symbolic link in order to store all the packages
	# downloaded by lighttpd
	#
	cmd = 'rm -rf /install ; '
	cmd += 'mkdir -p /mnt/sysimage/install ; '
	cmd += 'ln -s /mnt/sysimage/install /install'
	os.system(cmd)

    # STACKI

    # Run %pre-install scripts with the filesystem mounted and no packages
    with progress_report(_("Running pre-installation scripts")):
        runPreInstallScripts(ksdata.scripts)

    # Do packaging.

    # Discover information about realms to join,
    # to determine additional packages
    if willRunRealmd:
        with progress_report(_("Discovering realm to join")):
            ksdata.realm.setup()

    # make name resolution work for rpm scripts in chroot
    if flags.can_touch_runtime_system("copy /etc/resolv.conf to sysroot"):
        network.copyFileToPath("/etc/resolv.conf", iutil.getSysroot())

    # Check for additional packages
    ksdata.authconfig.setup()
    ksdata.firewall.setup()
    # Setup timezone and add chrony as package if timezone was set in KS
    # and "-chrony" wasn't in packages section and/or --nontp wasn't set.
    ksdata.timezone.setup(ksdata)

    # anaconda requires storage packages in order to make sure the target
    # system is bootable and configurable, and some other packages in order
    # to finish setting up the system.
    packages = storage.packages + ksdata.realm.packages
    packages += ksdata.authconfig.packages + ksdata.firewall.packages

    if willInstallBootloader:
        packages += storage.bootloader.packages

    if network.is_using_team_device():
        packages.append("teamd")

    # don't try to install packages from the install class' ignored list and the
    # explicitly excluded ones (user takes the responsibility)
    packages = [p for p in packages
                if p not in instClass.ignoredPackages and p not in ksdata.packages.excludedList]
    payload.preInstall(packages=packages, groups=payload.languageGroups())
    payload.install()

    if write_storage_late and not flags.flags.dirInstall:
        if iutil.getSysroot() != iutil.getTargetPhysicalRoot():
            blivet.setSysroot(iutil.getTargetPhysicalRoot(),
                              iutil.getSysroot())
            # Note this changed for RHEL 7.5; see comments in rpmostreepayload.py.
            payload.prepareMountTargets(storage)

        storage.write()

    # Do bootloader.
    if willInstallBootloader:
        with progress_report(_("Installing boot loader")):
            writeBootLoader(storage, payload, instClass, ksdata)

    with progress_report(_("Performing post-installation setup tasks")):
        payload.postInstall()

    progress_complete()
Exemplo n.º 6
0
def doInstall(storage, payload, ksdata, instClass):
    """Perform an installation.  This method takes the ksdata as prepared by
       the UI (the first hub, in graphical mode) and applies it to the disk.
       The two main tasks for this are putting filesystems onto disks and
       installing packages onto those filesystems.
    """
    from pyanaconda.kickstart import runPostScripts

    # First save system time to HW clock.
    if flags.can_touch_runtime_system("save system time to HW clock"):
        timezone.save_hw_clock(ksdata.timezone)

    # We really only care about actions that affect filesystems, since
    # those are the ones that take the most time.
    steps = len(storage.devicetree.findActions(type="create", object="format")) + \
            len(storage.devicetree.findActions(type="resize", object="format"))

    # pre setup phase, packages setup, packages, bootloader, post install
    steps += 5

    # joining AD/IPA domain
    if ksdata.realm.join_realm:
        steps += 1

    progressQ.send_init(steps)

    # This should be the only thread running, wait for the others to finish if not.
    if threadMgr.running > 1:
        with progress_report(
                _("Waiting for %s threads to finish") %
            (threadMgr.running - 1)):
            map(log.debug,
                ("Thread %s is running" % n for n in threadMgr.names))
            threadMgr.wait_all()

    with progress_report(_("Setting up the installation environment")):
        ksdata.firstboot.setup(storage, ksdata, instClass)
        ksdata.addons.setup(storage, ksdata, instClass)

    storage.updateKSData()  # this puts custom storage info into ksdata

    # Do partitioning.
    payload.preStorage()

    turnOnFilesystems(storage, mountOnly=flags.flags.dirInstall)
    write_storage_late = flags.flags.livecdInstall or ksdata.ostreesetup.osname
    if not write_storage_late and not flags.flags.dirInstall:
        storage.write()

    # Do packaging.

    # Discover information about realms to join,
    # to determine additional packages
    if ksdata.realm.join_realm:
        with progress_report(_("Discovering realm to join")):
            ksdata.realm.setup()

    # anaconda requires storage packages in order to make sure the target
    # system is bootable and configurable, and some other packages in order
    # to finish setting up the system.
    packages = storage.packages + ksdata.realm.packages
    if not ksdata.bootloader.disabled:
        packages += storage.bootloader.packages

    # don't try to install packages from the install class' ignored list
    packages = [p for p in packages if p not in instClass.ignoredPackages]
    payload.preInstall(packages=packages, groups=payload.languageGroups())
    payload.install()

    if write_storage_late:
        if iutil.getSysroot() != ROOT_PATH:
            blivet.targetSysroot = iutil.getSysroot()
            storage.write()
            # Now that we have the FS layout in the target,
            # umount things that were in the legacy sysroot,
            # and put them in the target root, except for the
            # physical /
            storage.umountFilesystems()
            rootmnt = storage.mountpoints.get('/')
            rootmnt.setup()
            # Explicitly mount the root on the physical sysroot
            rootmnt.format.setup(rootmnt.format.options, chroot=ROOT_PATH)
            # But everything else goes in the target root
            storage.mountFilesystems(skipRoot=True)
        else:
            storage.write()

    # Do bootloader.
    if not flags.flags.dirInstall and not ksdata.bootloader.disabled:
        with progress_report(_("Installing bootloader")):
            writeBootLoader(storage, payload, instClass, ksdata)

    with progress_report(_("Performing post-installation setup tasks")):
        payload.postInstall()

    progressQ.send_complete()
Exemplo n.º 7
0
 def wait_for_all_treads():
     for message in ("Thread %s is running" % n for n in threadMgr.names):
         log.debug(message)
     threadMgr.wait_all()
Exemplo n.º 8
0
def doInstall(storage, payload, ksdata, instClass):
    """Perform an installation.  This method takes the ksdata as prepared by
       the UI (the first hub, in graphical mode) and applies it to the disk.
       The two main tasks for this are putting filesystems onto disks and
       installing packages onto those filesystems.
    """
    # First save system time to HW clock.
    if flags.can_touch_runtime_system("save system time to HW clock"):
        timezone.save_hw_clock(ksdata.timezone)

    # We really only care about actions that affect filesystems, since
    # those are the ones that take the most time.
    steps = len(storage.devicetree.findActions(type="create", object="format")) + \
            len(storage.devicetree.findActions(type="resize", object="format"))
    steps += 6
    # pre setup phase, packages setup, packages, bootloader, realmd,
    # post install
    progressQ.send_init(steps)

    # This should be the only thread running, wait for the others to finish if not.
    if threadMgr.running > 1:
        with progress_report(
                _("Waiting for %s threads to finish") %
            (threadMgr.running - 1)):
            map(log.debug,
                ("Thread %s is running" % n for n in threadMgr.names))
            threadMgr.wait_all()

    with progress_report(_("Setting up the installation environment")):
        ksdata.firstboot.setup(storage, ksdata, instClass)
        ksdata.addons.setup(storage, ksdata, instClass)

    storage.updateKSData()  # this puts custom storage info into ksdata

    # Do partitioning.
    payload.preStorage()

    turnOnFilesystems(storage, mountOnly=flags.flags.dirInstall)
    if not flags.flags.livecdInstall and not flags.flags.dirInstall:
        storage.write()

    # Do packaging.

    # Discover information about realms to join,
    # to determine additional packages
    if ksdata.realm.join_realm:
        with progress_report(_("Discovering realm to join")):
            ksdata.realm.setup()

    # anaconda requires storage packages in order to make sure the target
    # system is bootable and configurable, and some other packages in order
    # to finish setting up the system.
    packages = storage.packages + ["authconfig", "firewalld"
                                   ] + ksdata.realm.packages

    # don't try to install packages from the install class' ignored list
    packages = [p for p in packages if p not in instClass.ignoredPackages]
    payload.preInstall(packages=packages, groups=payload.languageGroups())
    payload.install()

    if flags.flags.livecdInstall:
        storage.write()

    with progress_report(_("Performing post-installation setup tasks")):
        payload.postInstall()

    # Do bootloader.
    if not flags.flags.dirInstall:
        with progress_report(_("Installing bootloader")):
            writeBootLoader(storage, payload, instClass, ksdata)

    progressQ.send_complete()
Exemplo n.º 9
0
 def wait_for_all_treads():
     for message in ("Thread %s is running" % n
                     for n in threadMgr.names):
         log.debug(message)
     threadMgr.wait_all()
Exemplo n.º 10
0
def doInstall(storage, payload, ksdata, instClass):
    """Perform an installation.  This method takes the ksdata as prepared by
       the UI (the first hub, in graphical mode) and applies it to the disk.
       The two main tasks for this are putting filesystems onto disks and
       installing packages onto those filesystems.
    """
    willRunRealmd = ksdata.realm.join_realm
    willInstallBootloader = not flags.flags.dirInstall and not ksdata.bootloader.disabled

    # First save system time to HW clock.
    if flags.can_touch_runtime_system("save system time to HW clock"):
        timezone.save_hw_clock(ksdata.timezone)

    # We really only care about actions that affect filesystems, since
    # those are the ones that take the most time.
    steps = len(storage.devicetree.findActions(action_type="create", object_type="format")) + \
            len(storage.devicetree.findActions(action_type="resize", object_type="format"))

    # Update every 10% of packages installed.  We don't know how many packages
    # we are installing until it's too late (see realmd later on) so this is
    # the best we can do.
    steps += 10

    # pre setup phase, post install
    steps += 2

    # realmd, maybe
    if willRunRealmd:
        steps += 1

    # bootloader, maybe
    if willInstallBootloader:
        steps += 1

    # This should be the only thread running, wait for the others to finish if not.
    if threadMgr.running > 1:
        progress_init(steps + 1)

        with progress_report(
                _("Waiting for %s threads to finish") %
            (threadMgr.running - 1)):
            map(log.debug,
                ("Thread %s is running" % n for n in threadMgr.names))
            threadMgr.wait_all()
    else:
        progress_init(steps)

    with progress_report(_("Setting up the installation environment")):
        ksdata.firstboot.setup(storage, ksdata, instClass)
        ksdata.addons.setup(storage, ksdata, instClass)

    storage.updateKSData()  # this puts custom storage info into ksdata

    # Do partitioning.
    payload.preStorage()

    # callbacks for blivet
    message_clbk = lambda clbk_data: progress_message(clbk_data.msg)
    step_clbk = lambda clbk_data: progress_step(clbk_data.msg)
    entropy_wait_clbk = lambda clbk_data: wait_for_entropy(
        clbk_data.msg, clbk_data.min_entropy, ksdata)
    callbacks_reg = callbacks.create_new_callbacks_register(
        create_format_pre=message_clbk,
        create_format_post=step_clbk,
        resize_format_pre=message_clbk,
        resize_format_post=step_clbk,
        wait_for_entropy=entropy_wait_clbk)

    turnOnFilesystems(storage,
                      mountOnly=flags.flags.dirInstall,
                      callbacks=callbacks_reg)
    write_storage_late = (flags.flags.livecdInstall or ksdata.ostreesetup.seen
                          or ksdata.method.method == "liveimg")
    if not write_storage_late and not flags.flags.dirInstall:
        storage.write()

    # STACKIQ
    file = open('/proc/cmdline', 'r')
    args = file.readline().split()
    file.close()

    if 'boss' in args:
        import subprocess

        #
        # if we are a boss, then download the selected rolls
        #
        log.debug('STACKI: Downloading pallets: start')
        s = subprocess.Popen('/opt/stack/bin/boss_download_pallets.py')
        s.wait()
        log.debug('STACKI: Downloading pallets: complete')

        payload.reset()

        #
        #
        #
        for repo in payload._yum.repos.repos.values():
            log.debug('STACKI: repo.id (%s)' % repo.id)
            if repo.id != 'stacki':
                log.debug('STACKI: disabling repo repo.id (%s)' % repo.id)
                payload.disableRepo(repo.id)
    else:
        #
        # need to setup a symbolic link in order to store all the packages
        # downloaded by lighttpd
        #
        import os

        cmd = 'rm -rf /install ; '
        cmd += 'mkdir -p /mnt/sysimage/install ; '
        cmd += 'ln -s /mnt/sysimage/install /install'
        os.system(cmd)

    # STACKIQ

    # Do packaging.

    # Discover information about realms to join,
    # to determine additional packages
    if willRunRealmd:
        with progress_report(_("Discovering realm to join")):
            ksdata.realm.setup()

    # Check for additional packages
    ksdata.authconfig.setup()
    ksdata.firewall.setup()

    # make name resolution work for rpm scripts in chroot
    if flags.can_touch_runtime_system("copy /etc/resolv.conf to sysroot"):
        network.copyFileToPath("/etc/resolv.conf", iutil.getSysroot())

    # anaconda requires storage packages in order to make sure the target
    # system is bootable and configurable, and some other packages in order
    # to finish setting up the system.
    packages = storage.packages + ksdata.realm.packages
    packages += ksdata.authconfig.packages + ksdata.firewall.packages

    if not ksdata.bootloader.disabled:
        packages += storage.bootloader.packages

    if network.is_using_team_device:
        packages.append("teamd")

    # don't try to install packages from the install class' ignored list and the
    # explicitly excluded ones (user takes the responsibility)
    packages = [
        p for p in packages if p not in instClass.ignoredPackages
        and p not in ksdata.packages.excludedList
    ]
    payload.preInstall(packages=packages, groups=payload.languageGroups())
    payload.install()

    if write_storage_late and not flags.flags.dirInstall:
        if iutil.getSysroot() != iutil.getTargetPhysicalRoot():
            blivet.setSysroot(iutil.getTargetPhysicalRoot(),
                              iutil.getSysroot())
            storage.write()

            # Now that we have the FS layout in the target, umount
            # things that were in the legacy sysroot, and put them in
            # the target root, except for the physical /.  First,
            # unmount all target filesystems.
            storage.umountFilesystems()

            # Explicitly mount the root on the physical sysroot
            rootmnt = storage.mountpoints.get('/')
            rootmnt.setup()
            rootmnt.format.setup(options=rootmnt.format.options,
                                 chroot=iutil.getTargetPhysicalRoot())

            payload.prepareMountTargets(storage)

            # Everything else goes in the target root, including /boot
            # since the bootloader code will expect to find /boot
            # inside the chroot.
            storage.mountFilesystems(skipRoot=True)
        else:
            storage.write()

    # Do bootloader.
    if willInstallBootloader:
        with progress_report(_("Installing boot loader")):
            writeBootLoader(storage, payload, instClass, ksdata)

    with progress_report(_("Performing post-installation setup tasks")):
        payload.postInstall()

    progress_complete()
Exemplo n.º 11
0
def doInstall(storage, payload, ksdata, instClass):
    """Perform an installation.  This method takes the ksdata as prepared by
       the UI (the first hub, in graphical mode) and applies it to the disk.
       The two main tasks for this are putting filesystems onto disks and
       installing packages onto those filesystems.
    """
    willRunRealmd = ksdata.realm.join_realm
    willInstallBootloader = not flags.flags.dirInstall and (
        not ksdata.bootloader.disabled and ksdata.bootloader != "none")

    # First save system time to HW clock.
    if flags.can_touch_runtime_system("save system time to HW clock"):
        timezone.save_hw_clock(ksdata.timezone)

    # We really only care about actions that affect filesystems, since
    # those are the ones that take the most time.
    steps = len(storage.devicetree.findActions(action_type="create", object_type="format")) + \
            len(storage.devicetree.findActions(action_type="resize", object_type="format"))

    # pre setup phase, pre install, post install
    steps += 3

    # realmd, maybe
    if willRunRealmd:
        steps += 1

    # bootloader, maybe
    if willInstallBootloader:
        steps += 1

    # This should be the only thread running, wait for the others to finish if not.
    if threadMgr.running > 1:
        progress_init(steps + 1)

        with progress_report(
                _("Waiting for %s threads to finish") %
            (threadMgr.running - 1)):
            map(log.debug,
                ("Thread %s is running" % n for n in threadMgr.names))
            threadMgr.wait_all()
    else:
        progress_init(steps)

    with progress_report(_("Setting up the installation environment")):
        ksdata.firstboot.setup(storage, ksdata, instClass)
        ksdata.addons.setup(storage, ksdata, instClass, payload)

    storage.updateKSData()  # this puts custom storage info into ksdata

    # Do partitioning.
    payload.preStorage()

    # callbacks for blivet
    message_clbk = lambda clbk_data: progress_message(clbk_data.msg)
    step_clbk = lambda clbk_data: progress_step(clbk_data.msg)
    entropy_wait_clbk = lambda clbk_data: wait_for_entropy(
        clbk_data.msg, clbk_data.min_entropy, ksdata)
    callbacks_reg = callbacks.create_new_callbacks_register(
        create_format_pre=message_clbk,
        create_format_post=step_clbk,
        resize_format_pre=message_clbk,
        resize_format_post=step_clbk,
        wait_for_entropy=entropy_wait_clbk)

    turnOnFilesystems(storage,
                      mountOnly=flags.flags.dirInstall,
                      callbacks=callbacks_reg)
    write_storage_late = (flags.flags.livecdInstall or ksdata.ostreesetup.seen
                          or ksdata.method.method == "liveimg")
    if not write_storage_late and not flags.flags.dirInstall:
        storage.write()

    # Run %pre-install scripts with the filesystem mounted and no packages
    with progress_report(_("Running pre-installation scripts")):
        runPreInstallScripts(ksdata.scripts)

    # Do packaging.

    # Discover information about realms to join,
    # to determine additional packages
    if willRunRealmd:
        with progress_report(_("Discovering realm to join")):
            ksdata.realm.setup()

    # make name resolution work for rpm scripts in chroot
    if flags.can_touch_runtime_system("copy /etc/resolv.conf to sysroot"):
        network.copyFileToPath("/etc/resolv.conf", iutil.getSysroot())

    # Check for additional packages
    ksdata.authconfig.setup()
    ksdata.firewall.setup()
    # Setup timezone and add chrony as package if timezone was set in KS
    # and "-chrony" wasn't in packages section and/or --nontp wasn't set.
    ksdata.timezone.setup(ksdata)

    # anaconda requires storage packages in order to make sure the target
    # system is bootable and configurable, and some other packages in order
    # to finish setting up the system.
    packages = storage.packages + ksdata.realm.packages
    packages += ksdata.authconfig.packages + ksdata.firewall.packages

    if willInstallBootloader:
        packages += storage.bootloader.packages

    if network.is_using_team_device():
        packages.append("teamd")

    # don't try to install packages from the install class' ignored list and the
    # explicitly excluded ones (user takes the responsibility)
    packages = [
        p for p in packages if p not in instClass.ignoredPackages
        and p not in ksdata.packages.excludedList
    ]
    payload.preInstall(packages=packages, groups=payload.languageGroups())
    payload.install()

    if write_storage_late and not flags.flags.dirInstall:
        if iutil.getSysroot() != iutil.getTargetPhysicalRoot():
            blivet.setSysroot(iutil.getTargetPhysicalRoot(),
                              iutil.getSysroot())

            # Now that we have the FS layout in the target, umount
            # things that were in the legacy sysroot, and put them in
            # the target root, except for the physical /.  First,
            # unmount all target filesystems.
            storage.umountFilesystems()

            # Explicitly mount the root on the physical sysroot
            rootmnt = storage.mountpoints.get('/')
            rootmnt.setup()
            rootmnt.format.setup(options=rootmnt.format.options,
                                 chroot=iutil.getTargetPhysicalRoot())

            payload.prepareMountTargets(storage)

            # Everything else goes in the target root, including /boot
            # since the bootloader code will expect to find /boot
            # inside the chroot.
            storage.mountFilesystems(skipRoot=True)
        storage.write()

    # Do bootloader.
    if willInstallBootloader:
        with progress_report(_("Installing boot loader")):
            writeBootLoader(storage, payload, instClass, ksdata)

    with progress_report(_("Performing post-installation setup tasks")):
        payload.postInstall()

    progress_complete()