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 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))