# Path: pyanaconda/constants.py
# ROOT_PATH = "/mnt/sysimage"
# 
# RUNLEVELS = {3: 'multi-user.target', 5: 'graphical.target'}


import os
import logging
from simpleconfig import SimpleConfigFile
from pyanaconda.constants import ROOT_PATH, RUNLEVELS
    def setDefaultRunLevel(self, runlevel):
        if int(runlevel) not in RUNLEVELS:
            raise RuntimeError, "Desktop::setDefaultRunLevel() - Must specify runlevel as 3 or 5!"
        self.runlevel = runlevel

    def getDefaultRunLevel(self):
        return self.runlevel

    def setDefaultDesktop(self, desktop):
        self.info["DESKTOP"] = desktop

    def getDefaultDesktop(self):
        return self.get("DESKTOP")

    def __init__(self):
        super(Desktop, self).__init__()
        self.runlevel = 3

    def write(self):
        if self.getDefaultDesktop():
            f = open(ROOT_PATH + "/etc/sysconfig/desktop", "w")
            f.write(str(self))
            f.close()

        if not os.path.isdir(ROOT_PATH + '/etc/systemd/system'):
            log.warning("there is no /etc/systemd/system directory, cannot update default.target!")
            return
        default_target = ROOT_PATH + '/etc/systemd/system/default.target'
        if os.path.islink(default_target):
            os.unlink(default_target)

# Path: pyanaconda/constants.py
# ROOT_PATH = "/mnt/sysimage"
# 
# RUNLEVELS = {3: 'multi-user.target', 5: 'graphical.target'}


# Path: pyanaconda/desktop.py
import os
import logging
from simpleconfig import SimpleConfigFile
from pyanaconda.constants import ROOT_PATH, RUNLEVELS

    def setDefaultRunLevel(self, runlevel):
        if int(runlevel) not in RUNLEVELS:
            raise RuntimeError, "Desktop::setDefaultRunLevel() - Must specify runlevel as 3 or 5!"
        self.runlevel = runlevel

    def getDefaultRunLevel(self):
        return self.runlevel

    def setDefaultDesktop(self, desktop):
        self.info["DESKTOP"] = desktop

    def getDefaultDesktop(self):
        return self.get("DESKTOP")

    def __init__(self):
        super(Desktop, self).__init__()
        self.runlevel = 3

    def write(self):
        if self.getDefaultDesktop():
            f = open(ROOT_PATH + "/etc/sysconfig/desktop", "w")
            f.write(str(self))
            f.close()

        if not os.path.isdir(ROOT_PATH + '/etc/systemd/system'):
            log.warning("there is no /etc/systemd/system directory, cannot update default.target!")
            return
        default_target = ROOT_PATH + '/etc/systemd/system/default.target'
        if os.path.islink(default_target):
            os.unlink(default_target)

        os.symlink('/lib/systemd/system/%s' % RUNLEVELS[self.runlevel],