def bootstrap_target(self): if not self.target.exists(): self.target.mkdir() if not self.target.isdir(): raise InstallTargetError, "%s is not a directory" % self.target if self.defenv.getboolean('installer', 'bootstrap_target'): self.log.info('bootstrapping with debootstrap') self._bootstrap_with_debootstrap(self.base_suite) else: self.log.info('bootstrapping with premade tarball') self._bootstrap_with_tarball(self.base_suite) # here we add the apt keys that are needed aptkeys = AptKeyHandler(self.conn) keys = self.defenv.get_list('archive_keys', 'installer') for key in keys: row = aptkeys.get_row(key) filename = self.target / ('%s.key' % key) if filename.exists(): raise RuntimeError, "%s already exists" % filename keyfile = file(filename, 'w') keyfile.write(row.data) keyfile.close() #self.chroot('apt-key add %s.key' % key) self.chroot(['apt-key', 'add', '%s.key' % key]) os.remove(filename) if filename.exists(): raise RuntimeError, "%s wasn't deleted" % filename self.log.info('added key %s (%s) to apt' % (key, row.keyid))
def bootstrap_target(self): if not self.target.exists(): self.target.mkdir() if not self.target.isdir(): raise InstallTargetError, "%s is not a directory" % self.target if self.defenv.getboolean('installer', 'bootstrap_target'): self.log.info('bootstrapping with debootstrap') self._bootstrap_with_debootstrap(self.base_suite) else: self.log.info('bootstrapping with premade tarball') self._bootstrap_with_tarball(self.base_suite) # here we add the apt keys that are needed aptkeys = AptKeyHandler(self.conn) keys = self.defenv.get_list('archive_keys', 'installer') for key in keys: row = aptkeys.get_row(key) filename = self.target / ('%s.key' % key) if filename.exists(): raise RuntimeError, "%s already exists" % filename keyfile = file(filename, 'w') keyfile.write(row.data) keyfile.close() #self.chroot('apt-key add %s.key' % key) self.chroot(['apt-key', 'add', '%s.key' % key]) os.remove(filename) if filename.exists(): raise RuntimeError, "%s wasn't deleted" % filename self.log.info('added key %s (%s) to apt' % (key, row.keyid))
def bootstrap_target(self): self.check_suite_set() if not self.target.exists(): self.target.mkdir() if not self.target.isdir(): raise InstallTargetError, "%s is not a directory" % self.target if self.defenv.getboolean('installer', 'bootstrap_target'): self.log.info('bootstrapping with debootstrap') self._bootstrap_with_debootstrap(self.base_suite) else: self.log.info('bootstrapping with premade tarball') self._bootstrap_with_tarball(self.base_suite) # here we add the apt keys that are needed # we should probably split this part off into # another process. This step needs to be done # before the ready_base_for_install process, or # at least at the beginning of that process. aptkeys = AptKeyHandler(self.conn) keys = self.defenv.get_list('archive_keys', 'installer') for key in keys: try: row = aptkeys.get_row(key) except NoAptKeyError: msg = "There's no apt key named %s in the database" % key self.log.error(msg) raise UnsatisfiedRequirementsError , msg filename = self.target / ('%s.key' % key) if filename.exists(): msg = "%s already exists" % filename self.log.error(msg) raise RuntimeError , msg keyfile = file(filename, 'w') keyfile.write(row.data) keyfile.close() self.chroot(['apt-key', 'add', '%s.key' % key]) os.remove(filename) if filename.exists(): msg = "%s wasn't deleted" % filename self.log.error(msg) raise RuntimeError , msg self.log.info('added key %s (%s) to apt' % (key, row.keyid))