# Path: pyanaconda/flags.py
# class Flags(object):
# class BootArgs(OrderedDict):
#     def __setattr__(self, attr, val):
#     def get(self, attr, val=None):
#     def set_cmdline_bool(self, flag):
#     def __init__(self, read_cmdline=True):
#     def read_cmdline(self):
#     def __init__(self, cmdline=None, files=cmdline_files):
#     def read(self, filenames):
#     def readstr(self, cmdline):
#     def getbool(self, arg, default=False):
# def can_touch_runtime_system(msg):
# 
# Path: pyanaconda/iutil.py
# def augmentEnv():
# def _run_program(argv, root='/', stdin=None, stdout=None, env_prune=None, log_output=True, binary_output=False):
#     def chroot():
# def setSysroot(path):
# def getSysroot():
# def execInSysimageRoot(command, argv, **kwargs):
# def execWithRedirect(command, argv, stdin=None, stdout=None,
#                      stderr=None, root='/', env_prune=[], log_output=True, binary_output=False):
# def execWithCapture(command, argv, stdin=None, stderr=None, root='/',
#                     fatal=False, log_output=True):
# def execReadlines(command, argv, stdin=None, root='/', env_prune=None):
#     def queue_lines(out, queue):
#     def chroot():
# def execConsole():
# def getDirSize(dir):
#     def getSubdirSize(dir):
# def mkdirChain(dir):
# def get_active_console(dev="console"):
# def isConsoleOnVirtualTerminal(dev="console"):
# def strip_markup(text):
# def reIPL(ipldev):
# def resetRpmDb():
# def parseNfsUrl(nfsurl):
# def add_po_path(module, dir):
# def setup_translations(module):
# def fork_orphan():
# def _run_systemctl(command, service):
# def start_service(service):
# def stop_service(service):
# def restart_service(service):
# def service_running(service):
# def dracut_eject(device):
# def vtActivate(num):
#     def __init__(self, url=None, protocol="http://", host=None, port="3128",
#                  username=None, password=None):
#     def parse_url(self):
#     def parse_components(self):
#     def dict(self):
#     def __str__(self):
# def getdeepattr(obj, name):
# def setdeepattr(obj, name, value):
# def strip_accents(s):
# def cmp_obj_attrs(obj1, obj2, attr_list):
# def dir_tree_map(root, func, files=True, dirs=True):
# def chown_dir_tree(root, uid, gid, from_uid_only=None, from_gid_only=None):
#     def conditional_chown(path, uid, gid, from_uid=None, from_gid=None):
# def is_unsupported_hw():
# def upcase_first_letter(text):
#     def __init__(self, **kwargs):
#     def __getattr__(self, attr):
#     def __setattr__(self, attr, value):
#     def copy(self):
# def get_mount_paths(devnode):
# class ProxyStringError(Exception):
# class ProxyString(object):
# class DataHolder(dict):
# 
# Path: pyanaconda/progress.py
# def progress_report(message):


import shutil
import logging
from . import *
from pyanaconda.constants import *
from pyanaconda.flags import flags
from pyanaconda import iutil
from pyanaconda.i18n import _
from pyanaconda.progress import progressQ
from gi.repository import GLib
from gi.repository import Gio
from blivet.size import Size
from pyanaconda.errors import *
        from gi.repository import OSTree
            # that's where ostree --sysroot expects to find it.  The
            # real fix for the madness is for tools like extlinux to
            # have a --sysroot option too.
            bootmnt.format.teardown()
            bootmnt.teardown()
            bootmnt.format.setup(bootmnt.format.options, chroot=ROOT_PATH)

        # Set up the sysroot bind mount after this so that we have the
        # tmp -> sysroot/tmp when executing %post scripts and the
        # like.
        self._safeExecWithRedirect("mount", ["--bind", ROOT_PATH, os.path.join(iutil.getSysroot(), 'sysroot')])

        # FIXME - Move extlinux.conf to syslinux.cfg, since that's
        # what OSTree knows about.
        sysroot_boot_extlinux = os.path.join(ROOT_PATH, 'boot/extlinux')
        sysroot_boot_syslinux = os.path.join(ROOT_PATH, 'boot/syslinux')
        sysroot_boot_loader = os.path.join(ROOT_PATH, 'boot/loader')
        if os.path.isdir(sysroot_boot_extlinux):
            assert os.path.isdir(sysroot_boot_loader)
            orig_extlinux_conf = os.path.join(sysroot_boot_extlinux, 'extlinux.conf')
            target_syslinux_cfg = os.path.join(sysroot_boot_loader, 'syslinux.cfg')
            log.info("Moving %s -> %s" % (orig_extlinux_conf, target_syslinux_cfg))
            os.rename(orig_extlinux_conf, target_syslinux_cfg)
            # A compatibility bit for OSTree
            os.mkdir(sysroot_boot_syslinux)
            os.symlink('../loader/syslinux.cfg', os.path.join(sysroot_boot_syslinux, 'syslinux.cfg'))
            # And *also* tell syslinux that the config is really in /boot/loader
            os.symlink('loader/syslinux.cfg', os.path.join(ROOT_PATH, 'boot/syslinux.cfg'))

        # FIXME - stub out firewalld

# Path: pyanaconda/flags.py
# class Flags(object):
# class BootArgs(OrderedDict):
#     def __setattr__(self, attr, val):
#     def get(self, attr, val=None):
#     def set_cmdline_bool(self, flag):
#     def __init__(self, read_cmdline=True):
#     def read_cmdline(self):
#     def __init__(self, cmdline=None, files=cmdline_files):
#     def read(self, filenames):
#     def readstr(self, cmdline):
#     def getbool(self, arg, default=False):
# def can_touch_runtime_system(msg):
# 
# Path: pyanaconda/iutil.py
# def augmentEnv():
# def _run_program(argv, root='/', stdin=None, stdout=None, env_prune=None, log_output=True, binary_output=False):
#     def chroot():
# def setSysroot(path):
# def getSysroot():
# def execInSysimageRoot(command, argv, **kwargs):
# def execWithRedirect(command, argv, stdin=None, stdout=None,
#                      stderr=None, root='/', env_prune=[], log_output=True, binary_output=False):
# def execWithCapture(command, argv, stdin=None, stderr=None, root='/',
#                     fatal=False, log_output=True):
# def execReadlines(command, argv, stdin=None, root='/', env_prune=None):
#     def queue_lines(out, queue):
#     def chroot():
# def execConsole():
# def getDirSize(dir):
#     def getSubdirSize(dir):
# def mkdirChain(dir):
# def get_active_console(dev="console"):
# def isConsoleOnVirtualTerminal(dev="console"):
# def strip_markup(text):
# def reIPL(ipldev):
# def resetRpmDb():
# def parseNfsUrl(nfsurl):
# def add_po_path(module, dir):
# def setup_translations(module):
# def fork_orphan():
# def _run_systemctl(command, service):
# def start_service(service):
# def stop_service(service):
# def restart_service(service):
# def service_running(service):
# def dracut_eject(device):
# def vtActivate(num):
#     def __init__(self, url=None, protocol="http://", host=None, port="3128",
#                  username=None, password=None):
#     def parse_url(self):
#     def parse_components(self):
#     def dict(self):
#     def __str__(self):
# def getdeepattr(obj, name):
# def setdeepattr(obj, name, value):
# def strip_accents(s):
# def cmp_obj_attrs(obj1, obj2, attr_list):
# def dir_tree_map(root, func, files=True, dirs=True):
# def chown_dir_tree(root, uid, gid, from_uid_only=None, from_gid_only=None):
#     def conditional_chown(path, uid, gid, from_uid=None, from_gid=None):
# def is_unsupported_hw():
# def upcase_first_letter(text):
#     def __init__(self, **kwargs):
#     def __getattr__(self, attr):
#     def __setattr__(self, attr, value):
#     def copy(self):
# def get_mount_paths(devnode):
# class ProxyStringError(Exception):
# class ProxyString(object):
# class DataHolder(dict):
# 
# Path: pyanaconda/progress.py
# def progress_report(message):


# Path: pyanaconda/packaging/ostreepayload.py
import shutil
import logging
from . import *
from pyanaconda.constants import *
from pyanaconda.flags import flags
from pyanaconda import iutil
from pyanaconda.i18n import _
from pyanaconda.progress import progressQ
from gi.repository import GLib
from gi.repository import Gio
from blivet.size import Size
from pyanaconda.errors import *
        from gi.repository import OSTree

            # that's where ostree --sysroot expects to find it.  The
            # real fix for the madness is for tools like extlinux to
            # have a --sysroot option too.
            bootmnt.format.teardown()
            bootmnt.teardown()
            bootmnt.format.setup(bootmnt.format.options, chroot=ROOT_PATH)

        # Set up the sysroot bind mount after this so that we have the
        # tmp -> sysroot/tmp when executing %post scripts and the
        # like.
        self._safeExecWithRedirect("mount", ["--bind", ROOT_PATH, os.path.join(iutil.getSysroot(), 'sysroot')])

        # FIXME - Move extlinux.conf to syslinux.cfg, since that's
        # what OSTree knows about.
        sysroot_boot_extlinux = os.path.join(ROOT_PATH, 'boot/extlinux')
        sysroot_boot_syslinux = os.path.join(ROOT_PATH, 'boot/syslinux')
        sysroot_boot_loader = os.path.join(ROOT_PATH, 'boot/loader')
        if os.path.isdir(sysroot_boot_extlinux):
            assert os.path.isdir(sysroot_boot_loader)
            orig_extlinux_conf = os.path.join(sysroot_boot_extlinux, 'extlinux.conf')
            target_syslinux_cfg = os.path.join(sysroot_boot_loader, 'syslinux.cfg')
            log.info("Moving %s -> %s" % (orig_extlinux_conf, target_syslinux_cfg))
            os.rename(orig_extlinux_conf, target_syslinux_cfg)
            # A compatibility bit for OSTree
            os.mkdir(sysroot_boot_syslinux)
            os.symlink('../loader/syslinux.cfg', os.path.join(sysroot_boot_syslinux, 'syslinux.cfg'))
            # And *also* tell syslinux that the config is really in /boot/loader
            os.symlink('loader/syslinux.cfg', os.path.join(ROOT_PATH, 'boot/syslinux.cfg'))

        # FIXME - stub out firewalld

        firewalloffline = os.path.join(iutil.getSysroot(), 'usr/bin/firewall-offline-cmd')