/[smeserver]/cdrom.image/sme8/updates/installclasses/smeinstallclass.py
ViewVC logotype

Diff of /cdrom.image/sme8/updates/installclasses/smeinstallclass.py

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

Revision 1.5 by slords, Mon Nov 30 23:46:26 2009 UTC Revision 1.6 by slords, Thu Aug 26 22:09:11 2010 UTC
# Line 69  class InstallClass(BaseInstallClass): Line 69  class InstallClass(BaseInstallClass):
69                       "will be repartitioned and formated.")                       "will be repartitioned and formated.")
70    
71      sortPriority = 1      sortPriority = 1
     doPartition = False  
72    
73      parentClass = ( _("Install SME Server"), "smeserver.png" )      parentClass = ( _("Install SME Server"), "smeserver.png" )
74    
75      def requiredDisplayMode(self):      def requiredDisplayMode(self):
76          return 't'          return 't'
77    
     def driveIsRemovable(self, device):  
         try:  
             removable = bool(int(open("/sys/block/%s/removable" % device).read()))  
         except:  
             removable = False  
               
         return removable  
   
78      def setSteps(self, dispatch):      def setSteps(self, dispatch):
79          dispatch.setStepList(          dispatch.setStepList(
80                     "betanag",
81                   "language",                   "language",
82                   "keyboard",                   "keyboard",
83                   "findrootparts",                   "findrootparts",
                  "betanag",  
                  "installtype",  
84                   "partitionobjinit",                   "partitionobjinit",
85                   "autopartitionexecute",                   "autopartitionexecute",
                  "parttype",  
                  "partition",  
86                   "partitiondone",                   "partitiondone",
87                   "bootloadersetup",                   "bootloadersetup",
88                   "timezone",                   "timezone",
# Line 111  class InstallClass(BaseInstallClass): Line 99  class InstallClass(BaseInstallClass):
99                   "postinstallconfig",                   "postinstallconfig",
100                   "writeconfig",                   "writeconfig",
101                   "instbootloader",                   "instbootloader",
                  "dopostaction",  
102                   "writeksconfig",                   "writeksconfig",
                  "methodcomplete",  
                  "copylogs",  
103                   "setfilecon",                   "setfilecon",
104                     "copylogs",
105                     "methodcomplete",
106                     "dopostaction",
107                   "complete"                   "complete"
108                  )                  )
109    
110            dispatch.skipStep("bootloader", permanent = 1)
111          # 'partition' can be used on the command line to force          # 'partition' can be used on the command line to force
112          # verification of partitions.  useful in some cases...          # verification of partitions.  useful in some cases...
113          if self.doPartition or flags.cmdline.has_key("partition"):          dispatch.skipStep("partition", skip = (1,0)[flags.cmdline.has_key("partition")])
             if not self.doPartition:  
                 dispatch.skipStep("parttype", skip = 1)  
             dispatch.skipStep("partition", skip = 0)  
         else:  
             dispatch.skipStep("parttype", skip = 1)  
             dispatch.skipStep("partition", skip = 1)  
114    
115      def setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_LINUX, doClear = 1):      def setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_LINUX, doClear = 1):
116          diskset = partedUtils.DiskSet()          diskset = self.anaconda.id.diskset
117    
118          if flags.cmdline.has_key("exclude"):          if flags.cmdline.has_key("exclude"):
119              alldrives = filter(lambda x:not x in flags.cmdline["exclude"].split(","), diskset.driveList())              alldrives = filter(lambda x:not (partedUtils.hasProtectedPartitions(x, self.anaconda) or
120                                                 x in flags.cmdline["exclude"].split(",")), diskset.disks.keys())
121          else:          else:
122              alldrives = diskset.driveList()              alldrives = filter(lambda x:not partedUtils.hasProtectedPartitions(x, self.anaconda), diskset.disks.keys())
123    
124          if flags.cmdline.has_key("drives"):          if flags.cmdline.has_key("drives"):
125              if flags.cmdline["drives"] == "all":              if flags.cmdline["drives"] == "all":
126                  drives = filter(lambda x:isys.mediaPresent(x), alldrives)                  drives = alldrives
127              else:              else:
128                  drives = filter(lambda x:isys.mediaPresent(x) and                  drives = filter(lambda x:x in flags.cmdline["drives"].split(","), alldrives)
                                          x in flags.cmdline["drives"].split(","), alldrives)  
129          else:          else:
130              drives = filter(lambda x:not self.driveIsRemovable(x) and              drives = filter(lambda x:not isys.driveUsesModule(x, ["usb-storage", "ub", "sbp2"]), alldrives)
                                      isys.mediaPresent(x) and  
                                      not isys.driveUsesModule(x, ["usb-storage", "ub", "sbp2"]), alldrives)  
131    
132          if flags.cmdline.has_key("spares"):          if flags.cmdline.has_key("spares"):
133              if flags.cmdline["spares"] == "none":              if flags.cmdline["spares"] == "none":
# Line 175  class InstallClass(BaseInstallClass): Line 156  class InstallClass(BaseInstallClass):
156                  if spares > 1 and not flags.cmdline.has_key("spares"):                  if spares > 1 and not flags.cmdline.has_key("spares"):
157                      spares = 1                      spares = 1
158                  del drives[2+spares:]                  del drives[2+spares:]
159            elif len(drives) > 1 and len(drives) == len(filter(lambda x:x.startswith('mapper/'), alldrives)):
160                level = -1
161                del drives[1:]
162                spares = 0
163          else:          else:
164              if len(drives) - spares >= 6:              if len(drives) - spares >= 6:
165                  level = 6                  level = 6
# Line 184  class InstallClass(BaseInstallClass): Line 169  class InstallClass(BaseInstallClass):
169                  level = 1                  level = 1
170    
171          if len(drives) >= 1:          if len(drives) >= 1:
             excluded = filter(lambda x:x not in drives, diskset.driveList())  
172              log.info("Using the following drives: %s" % drives)              log.info("Using the following drives: %s" % drives)
173              log.info("Excluding the following drives: %s" % excluded)              excluded = filter(lambda x:x not in drives, diskset.disks.keys())
174                if excluded:
175                    log.info("Excluding the following drives: %s" % excluded)
176                skipped = filter(lambda x:x not in diskset.disks.keys(), diskset.driveList())
177                if skipped:
178                    log.info("Skipping the following drives: %s" % skipped)
179              if level >= 1:              if level >= 1:
180                  log.info("Installing using RAID%s" % level)                  log.info("Installing using RAID%s" % level)
181                  log.info("Using %s spare drives" % spares)                  log.info("Using %s spare drives" % spares)
182                elif level < 0:
183                    log.warning("Detected BIOS raid (skipping raid)")
184              else:              else:
185                  log.warning("Installing without using RAID")                  log.warning("Installing without using RAID")
186    
# Line 304  class InstallClass(BaseInstallClass): Line 295  class InstallClass(BaseInstallClass):
295    
296              partitions.autoClearPartType = CLEARPART_TYPE_ALL              partitions.autoClearPartType = CLEARPART_TYPE_ALL
297              partitions.autoClearPartDrives = drives              partitions.autoClearPartDrives = drives
             self.doPartition = False  
298          else:          else:
299              log.warning("Not useable drives found.  Enabling manual partitioning.")              log.warning("Not useable drives found.  Enabling manual partitioning.")
300              self.doPartition = True              BaseInstallClass.setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_ALL, doClear = True)
301              BaseInstallClass.setDefaultPartitioning(self, partitions, clear, doClear)              self.anaconda.dispatch.skipStep("parttype", skip = 0)
302                self.anaconda.dispatch.skipStep("partition", skip = 0)
303    
304      def setAsHeadless(self, dispatch, isHeadless = 0):      def setAsHeadless(self, dispatch, isHeadless = 0):
305          if isHeadless == 0:          if isHeadless == 0:
# Line 332  class InstallClass(BaseInstallClass): Line 323  class InstallClass(BaseInstallClass):
323    
324      def setInstallData(self, anaconda):      def setInstallData(self, anaconda):
325          BaseInstallClass.setInstallData(self, anaconda)          BaseInstallClass.setInstallData(self, anaconda)
326          self.setDefaultPartitioning(anaconda.id.partitions, CLEARPART_TYPE_ALL)          self.anaconda = anaconda
327          self.setSELinux(anaconda.id, SELINUX_DISABLED)          self.setSELinux(anaconda.id, SELINUX_DISABLED)
328    
329      def setGroupSelection(self, anaconda):      def setGroupSelection(self, anaconda):


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed