/[smeserver]/cdrom.image/sme7/product/installclasses/smeinstallclass.py
ViewVC logotype

Diff of /cdrom.image/sme7/product/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 61  class InstallClass(BaseInstallClass): Line 61  class InstallClass(BaseInstallClass):
61                       "will be repartitioned and formated.")                       "will be repartitioned and formated.")
62    
63      sortPriority = 1      sortPriority = 1
     doPartition = False  
     cmdline = {}  
64    
65      parentClass = ( _("Install SME Server"), "smeserver.png" )      parentClass = ( _("Install SME Server"), "smeserver.png" )
66    
# Line 84  class InstallClass(BaseInstallClass): Line 82  class InstallClass(BaseInstallClass):
82    
83          return cmdlineDict          return cmdlineDict
84    
     def mediaPresent(self, device):  
         try:  
             fd = os.open("/dev/%s" % device, os.O_RDONLY)  
         except OSError, (errno, strerror):  
             # error 123 = No medium found  
             if errno == 123:  
                 return False  
             else:  
                 return True  
         else:  
             os.close(fd)  
             return True  
   
85      def setSteps(self, dispatch):      def setSteps(self, dispatch):
86            self.anaconda = dispatch
87            self.cmdline = self.createCmdlineDict()
88    
89          dispatch.setStepList(          dispatch.setStepList(
90                     "betanag",
91                   "language",                   "language",
92                   "keyboard",                   "keyboard",
93                   "findrootparts",                   "findrootparts",
                  "betanag",  
94                   "installtype",                   "installtype",
95                   "partitionobjinit",                   "partitionobjinit",
96                   "autopartitionexecute",                   "autopartitionexecute",
                  "partition",  
97                   "partitiondone",                   "partitiondone",
98                   "bootloadersetup",                   "bootloadersetup",
99                   "languagesupport",                   "languagesupport",
# Line 124  class InstallClass(BaseInstallClass): Line 111  class InstallClass(BaseInstallClass):
111                   "postinstallconfig",                   "postinstallconfig",
112                   "writeconfig",                   "writeconfig",
113                   "instbootloader",                   "instbootloader",
                  "dopostaction",  
114                   "writeksconfig",                   "writeksconfig",
                  "methodcomplete",  
                  "copylogs",  
115                   "setfilecon",                   "setfilecon",
116                     "copylogs",
117                     "dopostaction",
118                     "methodcomplete",
119                   "complete"                   "complete"
120                  )                  )
121    
122          # 'partition' can be used on the command line to force          # 'partition' can be used on the command line to force
123          # verification of partitions.  useful in some cases...          # verification of partitions.  useful in some cases...
124          if self.doPartition or self.cmdline.has_key("partition"):          dispatch.skipStep("partition", skip = (1,0)[self.cmdline.has_key("partition")])
             dispatch.skipStep("partition", skip = 0)  
         else:  
             dispatch.skipStep("partition", skip = 1)  
125    
126      def setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_LINUX, doClear = 1):      def setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_LINUX, doClear = 1):
127          self.cmdline = self.createCmdlineDict()          diskset = self.anaconda.id.diskset
         diskset = partedUtils.DiskSet()  
128    
129          if self.cmdline.has_key("exclude"):          if self.cmdline.has_key("exclude"):
130              alldrives = filter(lambda x:not x in self.cmdline["exclude"].split(","), diskset.driveList())              alldrives = filter(lambda x:not (partedUtils.hasProtectedPartitions(x, self.anaconda) or
131                                                 x in self.cmdline["exclude"].split(",")), diskset.driveList())
132          else:          else:
133              alldrives = diskset.driveList()              alldrives = filter(lambda x:not partedUtils.hasProtectedPartitions(x, self.anaconda), diskset.disks.keys())
134    
135          if self.cmdline.has_key("drives"):          if self.cmdline.has_key("drives"):
136              if self.cmdline["drives"] == "all":              if self.cmdline["drives"] == "all":
137                  drives = filter(lambda x:self.mediaPresent(x), alldrives)                  drives = alldrives
138              else:              else:
139                  drives = filter(lambda x:self.mediaPresent(x) and                  drives = filter(lambda x:x in self.cmdline["drives"].split(","), alldrives)
                                          x in self.cmdline["drives"].split(","), alldrives)  
140          else:          else:
141              drives = filter(lambda x:not isys.driveIsRemovable(x) and              drives = filter(lambda x:not isys.driveUsesModule(x, ["usb-storage", "ub", "sbp2"]), alldrives)
                                      self.mediaPresent(x) and  
                                      not isys.driveUsesModule(x, ["usb-storage", "ub", "sbp2"]), alldrives)  
142    
143          if self.cmdline.has_key("spares"):          if self.cmdline.has_key("spares"):
144              if self.cmdline["spares"] == "none":              if self.cmdline["spares"] == "none":
# Line 186  class InstallClass(BaseInstallClass): Line 167  class InstallClass(BaseInstallClass):
167                  if spares > 1 and not self.cmdline.has_key("spares"):                  if spares > 1 and not self.cmdline.has_key("spares"):
168                      spares = 1                      spares = 1
169                  del drives[2+spares:]                  del drives[2+spares:]
170            elif len(drives) > 1 and len(drives) == len(filter(lambda x:x.startswith('mapper/'), alldrives)):
171                level = -1
172                del drives[1:]
173                spares = 0
174          else:          else:
175              if len(drives) - spares >= 6:              if len(drives) - spares >= 6:
176                  level = 6                  level = 6
# Line 195  class InstallClass(BaseInstallClass): Line 180  class InstallClass(BaseInstallClass):
180                  level = 1                  level = 1
181    
182          if len(drives) >= 1:          if len(drives) >= 1:
             excluded = filter(lambda x:x not in drives, diskset.driveList())  
183              log("Using the following drives: %s" % drives)              log("Using the following drives: %s" % drives)
184              log("Excluding the following drives: %s" % excluded)              excluded = filter(lambda x:x not in drives, diskset.disks.keys())
185                if excluded:
186                    log("Excluding the following drives: %s" % excluded)
187                skipped = filter(lambda x:x not in diskset.disks.keys(), diskset.driveList())
188                if skipped:
189                    log("Skipping the following drives: %s" % skipped)
190              if level >= 1:              if level >= 1:
191                  log("Installing using RAID%s" % level)                  log("Installing using RAID%s" % level)
192                  log("Using %s spare drives" % spares)                  log("Using %s spare drives" % spares)
193                elif level < 0:
194                    log("Detected BIOS raid (skipping raid)")
195              else:              else:
196                  log("Installing without using RAID")                  log("Installing without using RAID")
197    
# Line 315  class InstallClass(BaseInstallClass): Line 306  class InstallClass(BaseInstallClass):
306    
307              partitions.autoClearPartType = CLEARPART_TYPE_ALL              partitions.autoClearPartType = CLEARPART_TYPE_ALL
308              partitions.autoClearPartDrives = drives              partitions.autoClearPartDrives = drives
             self.doPartition = False  
309          else:          else:
310              log("Not useable drives found.  Enabling manual partitioning.")              log("Not useable drives found.  Enabling manual partitioning.")
311              self.doPartition = True              BaseInstallClass.setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_ALL, doClear = True)
312              BaseInstallClass.setDefaultPartitioning(self, partitions, clear, doClear)              self.anaconda.skipStep("partition", skip = 0)
313    
314      def setAsHeadless(self, dispatch, isHeadless = 0):      def setAsHeadless(self, dispatch, isHeadless = 0):
315          if isHeadless == 0:          if isHeadless == 0:
# Line 353  class InstallClass(BaseInstallClass): Line 343  class InstallClass(BaseInstallClass):
343          self.setRootPassword(id, pw="ThisIsGoingToBeDisabledAnyway", isCrypted=0)          self.setRootPassword(id, pw="ThisIsGoingToBeDisabledAnyway", isCrypted=0)
344          self.setZeroMbr(id, zeroMbr=1)          self.setZeroMbr(id, zeroMbr=1)
345          self.setClearParts(id, clear=CLEARPART_TYPE_ALL, initAll=1)          self.setClearParts(id, clear=CLEARPART_TYPE_ALL, initAll=1)
         self.setDefaultPartitioning(id.partitions, doClear=0)  
346          self.setBootloader(id, useLilo=0, location="mbr", linear=1)          self.setBootloader(id, useLilo=0, location="mbr", linear=1)
347    
348      def __init__(self, expert):      def __init__(self, expert):


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