Пример #1
0
def exitHandler(rebootData, storage):
    # Clear the list of watched PIDs.
    from pyanaconda.core.process_watchers import WatchProcesses
    WatchProcesses.unwatch_all_processes()

    if flags.usevnc:
        vnc.shutdownServer()

    if "nokill" in kernel_arguments:
        util.vtActivate(1)
        print("anaconda halting due to nokill flag.")
        print("The system will be rebooted when you press Ctrl-Alt-Delete.")
        while True:
            time.sleep(10000)

    if anaconda.dbus_inhibit_id:
        from pyanaconda.screensaver import uninhibit_screensaver
        uninhibit_screensaver(anaconda.dbus_session_connection,
                              anaconda.dbus_inhibit_id)
        anaconda.dbus_inhibit_id = None

    # Unsetup the payload, which most usefully unmounts live images
    if anaconda.payload:
        anaconda.payload.unsetup()

    # Unmount the filesystems.
    if not conf.target.is_hardware:
        anaconda.storage.umount_filesystems(swapoff=False)

    # Tear down disk images.
    if conf.target.is_image:
        anaconda.storage.devicetree.teardown_disk_images()

    # Clean up the PID file
    if pidfile:
        pidfile.close()

    anaconda.dbus_launcher.stop()

    if conf.system.can_reboot:
        from pykickstart.constants import KS_SHUTDOWN, KS_WAIT

        if flags.eject or rebootData.eject:
            for cdrom in (d for d in storage.devices if d.type == "cdrom"):
                if util.get_mount_paths(cdrom.path):
                    util.dracut_eject(cdrom.path)

        if flags.kexec:
            util.execWithRedirect("systemctl", ["--no-wall", "kexec"])
            while True:
                time.sleep(10000)
        elif rebootData.action == KS_SHUTDOWN:
            util.execWithRedirect("systemctl", ["--no-wall", "poweroff"])
        elif rebootData.action == KS_WAIT:
            util.execWithRedirect("systemctl", ["--no-wall", "halt"])
        else:  # reboot action is KS_REBOOT or None
            util.execWithRedirect("systemctl", ["--no-wall", "reboot"])
Пример #2
0
def exitHandler(rebootData):
    # Clear the list of watched PIDs.
    from pyanaconda.core.process_watchers import WatchProcesses
    WatchProcesses.unwatch_all_processes()

    if flags.usevnc:
        vnc.shutdownServer()

    if "nokill" in kernel_arguments:
        util.vtActivate(1)
        print("anaconda halting due to nokill flag.")
        print("The system will be rebooted when you press Ctrl-Alt-Delete.")
        while True:
            time.sleep(10000)

    if anaconda.dbus_inhibit_id:
        from pyanaconda.screensaver import uninhibit_screensaver
        uninhibit_screensaver(anaconda.dbus_session_connection, anaconda.dbus_inhibit_id)
        anaconda.dbus_inhibit_id = None

    # Unsetup the payload, which most usefully unmounts live images
    if anaconda.payload:
        anaconda.payload.unsetup()

    # Collect all optical media.
    from pyanaconda.modules.common.constants.objects import DEVICE_TREE
    from pyanaconda.modules.common.structures.storage import DeviceData
    device_tree = STORAGE.get_proxy(DEVICE_TREE)
    optical_media = []

    for device_name in device_tree.FindOpticalMedia():
        device_data = DeviceData.from_structure(
            device_tree.GetDeviceData(device_name)
        )
        optical_media.append(device_data.path)

    # Tear down the storage module.
    storage_proxy = STORAGE.get_proxy()

    for task_path in storage_proxy.TeardownWithTasks():
        task_proxy = STORAGE.get_proxy(task_path)
        sync_run_task(task_proxy)

    # Stop the DBus session.
    anaconda.dbus_launcher.stop()

    # Clean up the PID file
    if pidfile:
        pidfile.close()

    # Reboot the system.
    if conf.system.can_reboot:
        from pykickstart.constants import KS_SHUTDOWN, KS_WAIT

        if flags.eject or rebootData.eject:
            for device_path in optical_media:
                if util.get_mount_paths(device_path):
                    util.dracut_eject(device_path)

        if flags.kexec:
            util.execWithRedirect("systemctl", ["--no-wall", "kexec"])
            while True:
                time.sleep(10000)
        elif rebootData.action == KS_SHUTDOWN:
            util.execWithRedirect("systemctl", ["--no-wall", "poweroff"])
        elif rebootData.action == KS_WAIT:
            util.execWithRedirect("systemctl", ["--no-wall", "halt"])
        else:  # reboot action is KS_REBOOT or None
            util.execWithRedirect("systemctl", ["--no-wall", "reboot"])
Пример #3
0
def exitHandler(rebootData, storage):
    # Clear the list of watched PIDs.
    iutil.unwatchAllProcesses()

    # stop and save coverage here b/c later the file system may be unavailable
    if coverage is not None:
        cov.stop()
        if os.path.isdir('/mnt/sysimage/root'):
            cov.save()

    if flags.usevnc:
        vnc.shutdownServer()

    if "nokill" in flags.cmdline:
        iutil.vtActivate(1)
        print("anaconda halting due to nokill flag.")
        print("The system will be rebooted when you press Ctrl-Alt-Delete.")
        while True:
            time.sleep(10000)

    if anaconda.dbus_inhibit_id:
        from pyanaconda.screensaver import uninhibit_screensaver
        uninhibit_screensaver(anaconda.dbus_session_connection, anaconda.dbus_inhibit_id)
        anaconda.dbus_inhibit_id = None

    # Unsetup the payload, which most usefully unmounts live images
    if anaconda.payload:
        anaconda.payload.unsetup()

    if image_count or flags.dirInstall:
        anaconda.storage.umount_filesystems(swapoff=False)
        devicetree = anaconda.storage.devicetree
        devicetree.teardown_all()
        for imageName in devicetree.disk_images:
            dev = devicetree.get_device_by_name(imageName)
            for loop in dev.parents:
                loop.controllable = True
            dev.deactivate(recursive=True)

    # Clean up the PID file
    if pidfile:
        pidfile.close()

    if not flags.imageInstall and not flags.livecdInstall \
       and not flags.dirInstall:
        from pykickstart.constants import KS_SHUTDOWN, KS_WAIT

        if flags.eject or rebootData.eject:
            for cdrom in (d for d in storage.devices if d.type == "cdrom"):
                if iutil.get_mount_paths(cdrom.path):
                    iutil.dracut_eject(cdrom.path)

        if flags.kexec:
            iutil.execWithRedirect("systemctl", ["--no-wall", "kexec"])
            while True:
                time.sleep(10000)
        elif rebootData.action == KS_SHUTDOWN:
            iutil.execWithRedirect("systemctl", ["--no-wall", "poweroff"])
        elif rebootData.action == KS_WAIT:
            iutil.execWithRedirect("systemctl", ["--no-wall", "halt"])
        else:  # reboot action is KS_REBOOT or None
            iutil.execWithRedirect("systemctl", ["--no-wall", "reboot"])
Пример #4
0
def exitHandler(rebootData, storage):
    # Clear the list of watched PIDs.
    iutil.unwatchAllProcesses()

    # stop and save coverage here b/c later the file system may be unavailable
    if coverage is not None:
        cov.stop()
        if os.path.isdir('/mnt/sysimage/root'):
            cov.save()

    if flags.usevnc:
        vnc.shutdownServer()

    if "nokill" in flags.cmdline:
        iutil.vtActivate(1)
        print("anaconda halting due to nokill flag.")
        print("The system will be rebooted when you press Ctrl-Alt-Delete.")
        while True:
            time.sleep(10000)

    if anaconda.dbus_inhibit_id:
        from pyanaconda.screensaver import uninhibit_screensaver
        uninhibit_screensaver(anaconda.dbus_session_connection, anaconda.dbus_inhibit_id)
        anaconda.dbus_inhibit_id = None

    # Unsetup the payload, which most usefully unmounts live images
    if anaconda.payload:
        anaconda.payload.unsetup()

    if image_count or flags.dirInstall:
        anaconda.storage.umount_filesystems(swapoff=False)
        devicetree = anaconda.storage.devicetree
        devicetree.teardown_all()
        for imageName in devicetree.disk_images:
            dev = devicetree.get_device_by_name(imageName)
            for loop in dev.parents:
                loop.controllable = True
            dev.deactivate(recursive=True)

    # Clean up the PID file
    if pidfile:
        pidfile.close()

    if not flags.imageInstall and not flags.livecdInstall \
       and not flags.dirInstall:
        from pykickstart.constants import KS_SHUTDOWN, KS_WAIT

        if flags.eject or rebootData.eject:
            for cdrom in (d for d in storage.devices if d.type == "cdrom"):
                if iutil.get_mount_paths(cdrom.path):
                    iutil.dracut_eject(cdrom.path)

        if flags.kexec:
            iutil.execWithRedirect("systemctl", ["--no-wall", "kexec"])
            while True:
                time.sleep(10000)
        elif rebootData.action == KS_SHUTDOWN:
            iutil.execWithRedirect("systemctl", ["--no-wall", "poweroff"])
        elif rebootData.action == KS_WAIT:
            iutil.execWithRedirect("systemctl", ["--no-wall", "halt"])
        else:  # reboot action is KS_REBOOT or None
            iutil.execWithRedirect("systemctl", ["--no-wall", "reboot"])