Beispiel #1
0
def will_be_installed(pkg):
    try:
        casper_path = os.path.join("/cdrom", get_casper("LIVE_MEDIA_PATH", "casper").lstrip("/"))
        manifest = open(os.path.join(casper_path, "filesystem.manifest-desktop"))
        try:
            for line in manifest:
                if line.strip() == "" or line.startswith("#"):
                    continue
                if line.split()[0] == pkg:
                    return True
        finally:
            manifest.close()
    except IOError:
        return True
Beispiel #2
0
def will_be_installed(pkg):
    try:
        casper_path = os.path.join(
            '/cdrom', get_casper('LIVE_MEDIA_PATH', 'casper').lstrip('/'))
        manifest = open(os.path.join(casper_path,
                                     'filesystem.manifest-desktop'))
        try:
            for line in manifest:
                if line.strip() == '' or line.startswith('#'):
                    continue
                if line.split()[0] == pkg:
                    return True
        finally:
            manifest.close()
    except IOError:
        return True
Beispiel #3
0
    def __init__(self):
        """Initial attributes."""

        self.update_proc = None

        if os.path.isdir('/rofs'):
            self.source = '/rofs'
        elif os.path.isdir('/UNIONFS'):
            # Klaus Knopper says this may not actually work very well
            # because it'll copy the WHOLE WORLD (~12GB).
            self.source = '/UNIONFS'
        else:
            self.source = '/var/lib/ubiquity/source'
        self.target = '/target'
        self.casper_path = os.path.join(
            '/cdrom', get_casper('LIVE_MEDIA_PATH', 'casper').lstrip('/'))
        self.db = debconf.Debconf()
        self.blacklist = {}

        if 'UBIQUITY_OEM_USER_CONFIG' in os.environ:
            self.source = None
            self.target = '/'
            return

        assert os.path.ismount(self.target), \
            'Failed to mount the target: %s' % str(self.target)

        self.select_language_packs(save=True)
        self.select_ecryptfs()
        if self.db.get('ubiquity/install/generate-blacklist') == 'true':
            self.db.progress('START', 0, 100, 'ubiquity/install/title')
            self.db.progress('INFO', 'ubiquity/install/blacklist')
            self.generate_blacklist()

        apt_pkg.InitConfig()
        apt_pkg.Config.set("Dir", self.target)
        apt_pkg.Config.set("Dir::State::status",
                           os.path.join(self.target, 'var/lib/dpkg/status'))
        apt_pkg.Config.set("APT::GPGV::TrustedKeyring",
                           os.path.join(self.target, 'etc/apt/trusted.gpg'))
        apt_pkg.Config.set("Acquire::gpgv::Options::",
                           "--ignore-time-conflict")
        apt_pkg.Config.set("DPkg::Options::", "--root=%s" % self.target)
        # We don't want apt-listchanges or dpkg-preconfigure, so just clear
        # out the list of pre-installation hooks.
        apt_pkg.Config.clear("DPkg::Pre-Install-Pkgs")
        apt_pkg.InitSystem()
Beispiel #4
0
    def __init__(self):
        """Initial attributes."""

        self.update_proc = None

        if os.path.isdir('/rofs'):
            self.source = '/rofs'
        elif os.path.isdir('/UNIONFS'):
            # Klaus Knopper says this may not actually work very well
            # because it'll copy the WHOLE WORLD (~12GB).
            self.source = '/UNIONFS'
        else:
            self.source = '/var/lib/ubiquity/source'
        self.target = '/target'
        self.casper_path = os.path.join(
            '/cdrom', get_casper('LIVE_MEDIA_PATH', 'casper').lstrip('/'))
        self.db = debconf.Debconf()
        self.blacklist = {}

        if 'UBIQUITY_OEM_USER_CONFIG' in os.environ:
            self.source = None
            self.target = '/'
            return

        assert os.path.ismount(self.target), \
            'Failed to mount the target: %s' % str(self.target)

        self.select_language_packs(save=True)
        self.select_ecryptfs()
        if self.db.get('ubiquity/install/generate-blacklist') == 'true':
            self.db.progress('START', 0, 100, 'ubiquity/install/title')
            self.db.progress('INFO', 'ubiquity/install/blacklist')
            self.generate_blacklist()

        apt_pkg.init_config()
        apt_pkg.config.set("Dir", self.target)
        apt_pkg.config.set("Dir::State::status",
                           os.path.join(self.target, 'var/lib/dpkg/status'))
        apt_pkg.config.set("APT::GPGV::TrustedKeyring",
                           os.path.join(self.target, 'etc/apt/trusted.gpg'))
        apt_pkg.config.set("Acquire::gpgv::Options::",
                           "--ignore-time-conflict")
        apt_pkg.config.set("DPkg::Options::", "--root=%s" % self.target)
        # We don't want apt-listchanges or dpkg-preconfigure, so just clear
        # out the list of pre-installation hooks.
        apt_pkg.config.clear("DPkg::Pre-Install-Pkgs")
        apt_pkg.init_system()
Beispiel #5
0
def will_be_installed(pkg):
    try:
        casper_path = os.path.join(
            '/cdrom',
            get_casper('LIVE_MEDIA_PATH', 'casper').lstrip('/'))
        manifest = open(
            os.path.join(casper_path, 'filesystem.manifest-desktop'))
        try:
            for line in manifest:
                if line.strip() == '' or line.startswith('#'):
                    continue
                if line.split()[0] == pkg:
                    return True
        finally:
            manifest.close()
    except IOError:
        return True
Beispiel #6
0
 def __init__(self):
     self.target = '/target'
     self.casper_path = os.path.join(
         '/cdrom',
         get_casper('LIVE_MEDIA_PATH', 'casper').lstrip('/'))
Beispiel #7
0
import sys
import syslog
import traceback

from apt.cache import Cache
from apt.progress.base import InstallProgress
from apt.progress.text import AcquireProgress
import apt_pkg
import debconf

from ubiquity import misc, osextras
from ubiquity.casper import get_casper

minimal_install_rlist_path = os.path.join(
    '/cdrom',
    get_casper('LIVE_MEDIA_PATH', 'casper').lstrip('/'),
    'filesystem.manifest-minimal-remove')


def debconf_disconnect():
    """Disconnect from debconf. This is only to be used as a subprocess
    preexec_fn helper."""
    os.environ['DEBIAN_FRONTEND'] = 'noninteractive'
    if 'DEBIAN_HAS_FRONTEND' in os.environ:
        del os.environ['DEBIAN_HAS_FRONTEND']
    if 'DEBCONF_USE_CDEBCONF' in os.environ:
        # Probably not a good idea to use this in /target too ...
        del os.environ['DEBCONF_USE_CDEBCONF']


def reconfigure_preexec():
 def __init__(self):
     self.target = '/target'
     self.casper_path = os.path.join(
         '/cdrom', get_casper('LIVE_MEDIA_PATH', 'casper').lstrip('/'))