示例#1
0
 def start(self):
     """
     Install new patches from official Slackware mirrors
     """
     try:
         self.store()
         Msg().done()
         if self.upgrade_all:
             print("\nThese packages need upgrading:\n")
             Msg().template(78)
             print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
                 "| Package", " " * 17,
                 "New Version", " " * 8,
                 "Arch", " " * 4,
                 "Build", " " * 2,
                 "Repos", " " * 10,
                 "Size"))
             Msg().template(78)
             print("Upgrading:")
             self.views()
             unit, size = units(self.comp_sum, self.uncomp_sum)
             print("\nInstalling summary")
             print("=" * 79)
             print("{0}Total {1} {2} will be upgraded and {3} will be "
                   "installed.".format(self.meta.color["GREY"],
                                       self.count_upg,
                                       Msg().pkg(self.upgrade_all),
                                       self.count_added))
             print("Need to get {0} {1} of archives.".format(size[0],
                                                             unit[0]))
             print("After this process, {0} {1} of additional disk space "
                   "will be used.{2}".format(size[1], unit[1],
                                             self.meta.color["ENDC"]))
             print("")
             if Msg().answer() in ["y", "Y"]:
                 Download(self.patch_path, self.dwn_links,
                          repo="slack").start()
                 self.upgrade_all = self.utils.check_downloaded(
                     self.patch_path, self.upgrade_all)
                 self.upgrade()
                 self.kernel()
                 if self.meta.slackpkg_log in ["on", "ON"]:
                     self.slackpkg_update()
                 Msg().reference(self.installed, self.upgraded)
                 delete(self.patch_path, self.upgrade_all)
         else:
             slack_arch = ""
             if os.uname()[4] == "x86_64":
                 slack_arch = 64
             print("\nSlackware{0} '{1}' v{2} distribution is up to "
                   "date\n".format(slack_arch, self.version, slack_ver()))
     except KeyboardInterrupt:
         print("")   # new line at exit
         sys.exit(0)
示例#2
0
 def start(self, if_upgrade):
     """
     Install packages from official Slackware distribution
     """
     try:
         # fix if packages is for upgrade
         self.if_upgrade = if_upgrade
         mas_sum = dep_sum = sums = [0, 0, 0]
         Msg().done()
         self.dependencies = self.resolving_deps()
         (self.dep_dwn, self.dep_install, self.dep_comp_sum,
          self.dep_uncomp_sum) = self.store(self.dependencies)
         self.packages = self.clear_masters()
         (self.dwn, self.install, self.comp_sum,
          self.uncomp_sum) = self.store(self.packages)
         if (self.meta.rsl_deps in ["on", "ON"] and
                 self.flag != "--resolve-off"):
             Msg().done()
         if self.install:
             print("\nThe following packages will be automatically "
                   "installed or upgraded \nwith new version:\n")
             self.top_view()
             Msg().upg_inst(self.if_upgrade)
             mas_sum = self.views(self.install, self.comp_sum)
             if self.dependencies:
                 print("Installing for dependencies:")
                 dep_sum = self.views(self.dep_install, self.dep_comp_sum)
             # sums[0] --> installed
             # sums[1] --> upgraded
             # sums[2] --> uninstall
             sums = [sum(i) for i in zip(mas_sum, dep_sum)]
             unit, size = units(self.comp_sum + self.dep_comp_sum,
                                self.uncomp_sum + self.dep_uncomp_sum)
             print("\nInstalling summary")
             print("=" * 79)
             print("{0}Total {1} {2}.".format(self.meta.color["GREY"],
                                              sum(sums),
                                              Msg().pkg(sum(sums))))
             print("{0} {1} will be installed, {2} will be upgraded and "
                   "{3} will be reinstalled.".format(sums[2],
                                                     Msg().pkg(sums[2]),
                                                     sums[1], sums[0]))
             print("Need to get {0} {1} of archives.".format(size[0],
                                                             unit[0]))
             print("After this process, {0} {1} of additional disk "
                   "space will be used.{2}".format(size[1], unit[1],
                                                   self.meta.color["ENDC"]))
             print("")
             if Msg().answer() in ["y", "Y"]:
                 self.install.reverse()
                 Download(self.tmp_path, self.dep_dwn + self.dwn,
                          self.repo).start()
                 self.dep_install = Utils().check_downloaded(
                     self.tmp_path, self.dep_install)
                 self.install = Utils().check_downloaded(
                     self.tmp_path, self.install)
                 ins, upg = self.install_packages()
                 Msg().reference(ins, upg)
                 write_deps(self.deps_dict)
                 delete(self.tmp_path, self.install)
         else:
             Msg().not_found(self.if_upgrade)
     except KeyboardInterrupt:
         print("")   # new line at exit
         sys.exit(0)