def bootstrap(self): """ Will install using debootstrap """ cmds=["debootstrap", "--variant="+self._variant] if config.arch(): cmds.append("--foreign") cmds.append("--arch="+config.arch()) if not config.auth(): cmds.append("--no-check-gpg") keyrings = config.keyrings() for keyring in keyrings: cmds.append("--keyring="+keyring) cmds.append(config.suite()) cmds.append(config.rootfs()) cmds.append(config.source()) cmds.append("/usr/share/debootstrap/scripts/testing") r = host.runner first = [cmds[0], "--print-debs", "--keep-debootstrap-dir" ] + cmds[1:] if r.run(first, stdoutfunc=self._setpaks, stderrfunc=self._stderr) != 0: raise RaptzException("Debootstrap pre stage failed") if r.run(cmds, stdoutfunc=self._stdout, stderrfunc=self._stderr) != 0: raise RaptzException("Debootstrap main stage failed")
def bootstrap(self): # Lets build the multistrap configuration file par = SafeConfigParser() par.add_section("General") par.set("General", "arch", config.arch()) par.set("General", "directory", config.rootfs()) par.set("General", "cleanup", str(True)) par.set("General", "noauth", str(not config.auth())) keyrings = config.keyrings() par.set("General", "bootstrap", " ".join(keyrings.keys())) repros = config.repros() par.set("General", "aptsources", " ".join(repros)) for repro in config.repros(): par.add_section(repro) par.set(repro, "keyring", keyrings[repro]) par.set(repro, "packages", "dash apt apt-utils " + " ".join(config.early_packages()) + " ".join(config.packages())) par.set(repro, "source", config.source(repro)) par.set(repro, "suite", config.suite(repro)) par.set(repro, "components", " ".join(config.components(repro))) par.write(self._msfile) self._msfile.close() r = host.runner cmds = ["multistrap", "-f", self._msfile.name] if r.run(cmds, stdoutfunc=self._stdout, stderrfunc=self._stderr) != 0: raise RaptzException("Multistrap main stage failed")
def from_file(filename): try: j = json.load(open(filename, 'r')) except IOError as e: print "Error opening show:", e return None name = j['name'] start = numbering_from_str(j['start']) airdates = dict((start.from_str(e), datetime.strptime(d, "%Y/%m/%d").date()) for e, d in j.get('airdates', {}).iteritems()) name_matcher = NameMatcher(j.get('match', { 'name': name })) sources = [] for source_name, source_params in j['sources'].iteritems(): params = config.source(source_name) params.update(source_params) source = get_source(source_name, params) if source: sources.append(source) condition = j.get('condition', config.condition) rules = list(flatten(config.bind_rules(j.get('rules')))) if not rules: rules = [config.rule('default')] return Show(name, filename, start, airdates, name_matcher, sources, condition, rules)
def finalize(self): listd = config.rootfs("/etc/apt/sources.list.d") if not os.path.isdir(listd): os.makedirs(listd) for repro in config.repros(): listfile = os.path.join(listd, repro.lower() + ".list") source = config.source(repro) suite = config.suite(repro) comp = " ".join(config.components(repro)) f = open(listfile, "w") f.write("deb %s %s %s\n" % (source, suite, comp)) if config.addsrcs(repro): f.write("deb-src %s %s %s\n" % (source, suite, comp))
def bootstrap(self): """ Will install using debootstrap """ cmds=["cdebootstrap", "--flavour="+self._flavour] if config.arch(): cmds.append("--foreign") cmds.append("--arch="+config.arch()) if not config.auth(): cmds.append("--allow-unauthenticated") keyrings = config.keyrings() for keyring in keyrings: cmds.append("--keyring="+keyring) cmds.append(config.suite()) cmds.append(config.rootfs()) cmds.append(config.source()) # cmds.append("/usr/share/debootstrap/scripts/testing") r = host.runner if r.run(cmds, stdoutfunc=self._stdout, stderrfunc=self._stderr) != 0: raise RaptzException("Debootstrap main stage failed")