コード例 #1
0
  def _install_config(self):
    if self._cfg.is_test:
      sleep(1)
    else:
      rootmp = sltl.getMountPoint("/dev/{0}".format(self._cfg.main_partition))
      rcfont_file = open('{0}/etc/rc.d/rc.font'.format(rootmp), 'w')
      rcfont_file.write("""
#!/bin/sh
#
#This selects your default screen font from among the ones in
# /usr/share/kbd/consolefonts.
#
#setfont -v ter-v16n
unicode_start ter-v16n""")
      rcfont_file.close()
      os.chmod('{0}/etc/rc.d/rc.font'.format(rootmp), 0755)
      for f in ('var/log/setup/setup.04.mkfontdir', 'var/log/setup/setup.07.update-desktop-database', 'var/log/setup/setup.07.update-mime-database', 'var/log/setup/setup.08.gtk-update-icon-cache', 'var/log/setup/setup.htmlview'):
        p = "{0}/{1}".format(rootmp, f)
        if os.path.exists(p):
          os.chmod(p, 0755)
          sltl.execCall("cd {0}; ./{1}".format(rootmp, f))
      for f in ('/usr/bin/update-gtk-immodules', '/usr/bin/update-gdk-pixbuf-loaders', '/usr/bin/update-pango-querymodules'):
        p = "{0}/{1}".format(rootmp, f)
        if os.path.exists(p):
          sltl.execChroot(rootmp, f)
      if self._cfg.is_liveclone:
        # Remove some specific live stuff
        sltl.execCall("spkg -d liveclone --root={0}".format(rootmp))
        sltl.execCall("spkg -d salix-live-installer --root={0}".format(rootmp))
        sltl.execCall("spkg -d salix-persistence-wizard --root={0}".format(rootmp))
        sltl.execCall("rm -f {0}/etc/ssh/ssh_host_*".format(rootmp))
        sltl.execCall("rm -f {0}/home/*/Desktop/*startup-guide*desktop".format(rootmp))
        sltl.execCall("rm -f {0}/user/share/applications/*startup-guide*desktop".format(rootmp))
        os.remove("{0}/hooks.salt".format(rootmp))
コード例 #2
0
 def _install_fstab(self):
   if self._cfg.is_test:
     sleep(1)
   else:
     rootmp = sltl.getMountPoint("/dev/{0}".format(self._cfg.main_partition))
     sltl.createFsTab(rootmp)
     sltl.addFsTabEntry(rootmp, 'proc', '/proc', 'proc')
     sltl.addFsTabEntry(rootmp, 'devpts', '/dev/pts', 'devpts')
     sltl.addFsTabEntry(rootmp, 'tmpfs', '/dev/shm', 'tmpfs')
     for d in self._cfg.swap_partitions:
       sltl.addFsTabEntry(rootmp, "/dev/" + d, 'none', 'swap')
     sltl.addFsTabEntry(rootmp, "/dev/" + self._cfg.main_partition, '/', self._cfg.main_format, dumpFlag = 1, fsckOrder = 1)
     for l in (self._cfg.linux_partitions, self._cfg.win_partitions):
       if l:
         for p in l:
           d = p[0]
           fs = p[1]
           if fs == 'none': # tell to not format, so...
             fs = None # ...come back to autodetection
           mp = p[2]
           try:
             os.makedirs(rootmp + mp)
           except os.error:
             pass # directory exists
           sltl.addFsTabEntry(rootmp, "/dev/" + d, mp, fs)
コード例 #3
0
 def _install_linux_partitions(self, msg, step, steps, weights):
   if self._cfg.is_test:
     for p in self._cfg.linux_partitions:
       if self._installation == 'cancelled': return step
       d = p[0]
       self._update_progressbar(msg + "\n - {0}".format(d), step, steps)
       w = weights[d]
       sleep(w)
       step += w
     return step
   else:
     rootmp = sltl.getMountPoint("/dev/{0}".format(self._cfg.main_partition))
     for p in self._cfg.linux_partitions:
       if self._installation == 'cancelled': return step
       d = p[0]
       self._update_progressbar(msg + "\n - {0}".format(d), step, steps)
       full_dev = "/dev/{0}".format(d)
       fs = p[1]
       mp = p[2]
       sltl.umountDevice(full_dev, deleteMountPoint = False)
       if fs != 'none':
         label = sltl.getFsLabel(d)
         if not label:
           label = os.path.basename(p[2])
           if len(label) > 12:
             label = None # for not having problems
         sltl.makeFs(d, fs, label = label, force = True)
       sltl.mountDevice(full_dev, mountPoint = "{root}/{mp}".format(root = rootmp, mp = mp))
       step += weights[d]
     return step
コード例 #4
0
 def _install_users(self):
   if self._cfg.is_test:
     sleep(1)
   else:
     if not self._cfg.keep_live_logins:
       rootmp = sltl.getMountPoint("/dev/{0}".format(self._cfg.main_partition))
       sltl.createSystemUser(self._cfg.new_login, password = self._cfg.new_password, mountPoint = rootmp)
       sltl.changePasswordSystemUser('root', password = self._cfg.new_root_password, mountPoint = rootmp)
コード例 #5
0
 def _install_services(self):
   if self._cfg.is_test:
     sleep(1)
   else:
     rootmp = sltl.getMountPoint("/dev/{0}".format(self._cfg.main_partition))
     f = 'var/log/setup/setup.services'
     p = "{0}/{1}".format(rootmp, f)
     if os.path.exists(p):
       os.chmod(p, 0755)
       sltl.execCall("{0}/{1} {0}".format(rootmp, f))
コード例 #6
0
ファイル: grub2.py プロジェクト: champ1/bootsetup
 def _mountBootPartition(self, bootPartition):
   """
   Return the mount point
   """
   self.__debug("bootPartition = " + bootPartition)
   if sltl.isMounted(bootPartition):
     self.__debug("bootPartition already mounted")
     return sltl.getMountPoint(bootPartition)
   else:
     self.__debug("bootPartition not mounted")
     return sltl.mountDevice(bootPartition)
コード例 #7
0
 def _install_keyboard(self):
   if self._cfg.is_test:
     sleep(1)
   else:
     rootmp = sltl.getMountPoint("/dev/{0}".format(self._cfg.main_partition))
     try:
       os.makedirs(rootmp + '/etc/X11/xorg.conf.d')
     except OSError:
       pass
     sltl.setDefaultKeymap(self._cfg.cur_km, rootmp)
     sltl.setNumLockDefault(self._cfg.cur_use_numlock, rootmp)
     sltl.setIbusDefault(self._cfg.cur_use_ibus, rootmp)
コード例 #8
0
 def _install_datetime(self):
   if self._cfg.is_test:
     sleep(1)
   else:
     rootmp = sltl.getMountPoint("/dev/{0}".format(self._cfg.main_partition))
     tz = self._cfg.cur_tz_continent + '/' + self._cfg.cur_tz_city
     sltl.setDefaultTimeZone(tz, rootmp)
     sltl.setNTPDefault(self._cfg.cur_use_ntp, rootmp)
     if not self._cfg.cur_use_ntp:
       # we need to update the locale date and time.
       dt = (datetime.now() + self._cfg.cur_time_delta).strftime("%Y-%m-%d %H:%M:%S")
       execCall(['/usr/bin/date', '-s', dt], shell=False)
       execCall(['/sbin/hwclock', '--systohc'], shell=False)
コード例 #9
0
ファイル: lilo.py プロジェクト: champ1/bootsetup
 def _mountBootPartition(self):
   """
   Return the mount point
   """
   self.__debug("bootPartition = " + self._bootPartition)
   if sltl.isMounted(self._bootPartition):
     self.__debug("bootPartition already mounted")
     mp = sltl.getMountPoint(self._bootPartition)
   else:
     self.__debug("bootPartition not mounted")
     mp = sltl.mountDevice(self._bootPartition)
   if mp:
     self._mountBootInPartition(mp)
   return mp
コード例 #10
0
 def _install_modules(self, modules, modules_size, msg, step, steps, weight):
   if self._cfg.is_test:
     for m in modules:
       if self._installation == 'cancelled': return step
       self._update_progressbar(msg + "\n - " + _("Installing the {module} module...").format(module = m), step, steps)
       w = weight[m]
       sleep(w)
       step += w
     return step
   else:
     rootmp = sltl.getMountPoint("/dev/{0}".format(self._cfg.main_partition))
     for m in modules:
       if self._installation == 'cancelled': return step
       self._update_progressbar(msg + "\n - " + _("Installing the {module} module...").format(module = m), step, steps)
       size = modules_size[m]
       w = weight[m]
       sltl.installSaLTModule(m, size, rootmp, self._install_module_callback, (step, steps, w))
       step += w
     return step
コード例 #11
0
ファイル: lilo.py プロジェクト: champ1/bootsetup
 def _mountPartitions(self, mountPointList):
   """
   Fill a list of mount points for each partition
   """
   if self._partitions:
     partitionsToMount = [p for p in self._partitions if p[2] == "linux"]
     self.__debug("mount partitions: " + unicode(partitionsToMount))
     for p in partitionsToMount:
       dev = os.path.join("/dev", p[0])
       self.__debug("mount partition " + dev)
       if sltl.isMounted(dev):
         mp = sltl.getMountPoint(dev)
       else:
         mp = sltl.mountDevice(dev)
       self.__debug("mount partition " + dev + " => " + unicode(mp))
       if mp:
         mountPointList[p[0]] = mp
         self._mountBootInPartition(mp)
       else:
         raise Exception("Cannot mount {d}".format(d = dev))
コード例 #12
0
 def _install_locale(self):
   if self._cfg.is_test:
     sleep(1)
   else:
     rootmp = sltl.getMountPoint("/dev/{0}".format(self._cfg.main_partition))
     sltl.setDefaultLocale(self._cfg.cur_locale, rootmp)