Exemplo n.º 1
0
 def exec_cmd(cmd):
         ret = 0
         try:
                 ret = subprocess.call(cmd,
                     stdout = file("/dev/null"),
                     stderr = subprocess.STDOUT)
         except OSError, e:
                 emsg(_("pkg: A system error %(e)s was caught "
                     "executing %(cmd)s") %
                     { "e": e, "cmd": " ".join(cmd) })
Exemplo n.º 2
0
 def exec_cmd(cmd):
     ret = 0
     try:
         ret = subprocess.call(cmd,
                               stdout=file("/dev/null"),
                               stderr=subprocess.STDOUT)
     except OSError, e:
         emsg(
             _("pkg: A system error %(e)s was caught "
               "executing %(cmd)s") % {
                   "e": e,
                   "cmd": " ".join(cmd)
               })
Exemplo n.º 3
0
        def update_boot_archive(self):
                """Rebuild the boot archive in the current image.
                Just report errors; failure of pkg command is not needed,
                and bootadm problems should be rare."""
                cmd = [
                    "/sbin/bootadm", "update-archive", "-R",
                    self.img.get_root()
                    ]

                try:
                        ret = subprocess.call(cmd,
                            stdout = open(os.devnull), stderr=subprocess.STDOUT)
                except OSError, e:
                        logger.error(_("pkg: A system error %(e)s was "
                            "caught executing %(cmd)s") % { "e": e,
                            "cmd": " ".join(cmd) })
                        return
Exemplo n.º 4
0
    def update_boot_archive(self):
        """Rebuild the boot archive in the current image.
                Just report errors; failure of pkg command is not needed,
                and bootadm problems should be rare."""
        cmd = ["/sbin/bootadm", "update-archive", "-R", self.img.get_root()]

        try:
            ret = subprocess.call(cmd,
                                  stdout=open(os.devnull),
                                  stderr=subprocess.STDOUT)
        except OSError as e:
            logger.error(
                _("pkg: A system error {e} was "
                  "caught executing {cmd}").format(e=e, cmd=" ".join(cmd)))
            return

        if ret:
            logger.error(
                _("pkg: '{cmd}' failed. \nwith "
                  "a return code of {ret:d}.").format(cmd=" ".join(cmd),
                                                      ret=ret))