/[smeserver]/cdrom.image/sme9/product/installclasses/server.py
ViewVC logotype

Diff of /cdrom.image/sme9/product/installclasses/server.py

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

Revision 1.1 by slords, Mon Mar 11 18:03:05 2013 UTC Revision 1.12 by wellsi, Thu Apr 17 00:30:37 2014 UTC
# Line 4  Line 4 
4    
5  import os, iutil  import os, iutil
6    
7    import yuminstall
8    
9  from installclass import BaseInstallClass  from installclass import BaseInstallClass
 from rhel import InstallClass as SMEInstallClass  
10  from kickstart import AnacondaKSScript as Script  from kickstart import AnacondaKSScript as Script
11    
12  from flags import flags  from flags import flags
13  from constants import *  from constants import *
14  from pykickstart.constants import *  from pykickstart.constants import *
15    from storage.partspec import *
16    
17  import gettext  import gettext
18  _ = lambda x: gettext.ldgettext("anaconda", x)  _ = lambda x: gettext.ldgettext("anaconda", x)
# Line 74  class Script: Line 76  class Script:
76          if serial or self.logfile:          if serial or self.logfile:
77              os.chmod("%s" % messages, 0600)              os.chmod("%s" % messages, 0600)
78    
79  class InstallClass(SMEInstallClass):  class InstallClass(BaseInstallClass):
80      # make sure the translation data is read from product.img tree      # make sure the translation data is read from product.img tree
81      if os.path.isdir("/tmp/product/locale"):      if os.path.isdir("/tmp/product/locale"):
82          import gettext          import gettext
# Line 91  class InstallClass(SMEInstallClass): Line 93  class InstallClass(SMEInstallClass):
93      sortPriority = 90000      sortPriority = 90000
94      hidden = 0      hidden = 0
95    
96        bootloaderTimeoutDefault = 5
97      tasks = [(N_("Basic Server"),      tasks = [(N_("Basic Server"),
98                ["base", "core"]),                ["base", "core"]),
99               (N_("Minimal"),               (N_("Minimal"),
# Line 105  class InstallClass(SMEInstallClass): Line 108  class InstallClass(SMEInstallClass):
108              w = anaconda.intf.waitWindow(_("Post Upgrade"),              w = anaconda.intf.waitWindow(_("Post Upgrade"),
109                  _("Performing post-upgrade configuration"))                  _("Performing post-upgrade configuration"))
110              log.info("Running post-upgrade action script")              log.info("Running post-upgrade action script")
111              script = Script( "#!/bin/sh\n/sbin/rsyslogd ; sleep 2; /sbin/e-smith/signal-event post-upgrade\n" )              script = Script( "#!/bin/sh\n/sbin/rsyslogd; sleep 2; /sbin/e-smith/signal-event post-upgrade; touch /forcequotacheck\n" )
112          else:          else:
113              w = anaconda.intf.waitWindow(_("Post Installation"),              w = anaconda.intf.waitWindow(_("Post Installation"),
114                  _("Performing post-installation configuration"))                  _("Performing post-installation configuration"))
115              log.info("Running post-install action script")              log.info("Running post-install action script")
116              script = Script( "#!/bin/sh\n/sbin/rsyslogd ; sleep 2; /sbin/e-smith/signal-event post-install\n" )              script = Script( "#!/bin/sh\n/sbin/rsyslogd; sleep 2; /sbin/e-smith/signal-event post-install; touch /forcequotacheck\n" )
117    
118          script.run(anaconda.rootPath, flags.serial, anaconda.intf)          script.run(anaconda.rootPath, flags.serial, anaconda.intf)
119          if anaconda.intf is not None:          if anaconda.intf is not None:
120              w.pop()              w.pop()
121    
122          SMEInstallClass.postAction(self, anaconda)          BaseInstallClass.postAction(self, anaconda)
123    
124      def setSteps(self, anaconda):      def setSteps(self, anaconda):
125          BaseInstallClass.setSteps(self, anaconda)          BaseInstallClass.setSteps(self, anaconda)
126          #anaconda.dispatch.skipStep("welcome")          anaconda.dispatch.skipStep("welcome")
127          #anaconda.dispatch.skipStep("filtertype")          #anaconda.dispatch.skipStep("filtertype")
128          anaconda.dispatch.skipStep("network")          anaconda.dispatch.skipStep("network")
129          anaconda.dispatch.skipStep("accounts")          anaconda.dispatch.skipStep("accounts")
# Line 129  class InstallClass(SMEInstallClass): Line 132  class InstallClass(SMEInstallClass):
132          anaconda.dispatch.skipStep("firstboot")          anaconda.dispatch.skipStep("firstboot")
133    
134      def setDefaultPartitioning(self, storage, platform):      def setDefaultPartitioning(self, storage, platform):
135          autorequests = [PartSpec(mountpoint="/", fstype=storage.defaultFSType,          autorequests = []
136              size=1024, maxSize=50*1024, grow=True, asVol=True)]  
137            # If user specifies "nolvm", then asVol = False; otherwise, asVol = True
138            # If asVol = False below, then LVM won't be used
139    
140            asVol_flag = not flags.cmdline.has_key("nolvm")
141    
142            # If user specifies "noraid", then useRAID = False; otherwise, useRAID = True
143            # If useRAID = False below, then RAID1 won't be used
144    
145            if flags.cmdline.has_key("noraid"):
146                raidLevel = "none"
147            else:
148                raidLevel = "1"
149                if flags.cmdline.has_key("raid") and flags.cmdline["raid"] in ["none","0","1","5","6"]:
150                    raidLevel = flags.cmdline["raid"]
151    
152            fstype = "ext4"
153            if flags.cmdline.has_key("ext3"):
154                fstype = "ext3"
155    
156            # /boot
157            # Manually specify fstype = ext3/ext4 and size = 250 MB
158            # (Platform default is fstype ext4 and size = 500 MB)
159    
160            autorequests.append(PartSpec(mountpoint="/boot", fstype=fstype, size=250, raidLevel="1",
161                                weight=platform.weight(mountpoint="/boot")))
162    
163          bootreq = platform.setDefaultPartitioning()          # /
164          if bootreq:          # Manually specify fstype = ext3/ext4 and size = 2048 MB, but growable
165              autorequests.extend(bootreq)  
166            autorequests.append(PartSpec(mountpoint="/", fstype=fstype, size=2048, raidLevel=raidLevel,
167                                grow=True, asVol=asVol_flag))
168    
169            # swap
170            # Manually specify fstype = swap and minswap < size < maxswap (growable)
171    
172          (minswap, maxswap) = iutil.swapSuggestion()          (minswap, maxswap) = iutil.swapSuggestion()
173          autorequests.append(PartSpec(fstype="swap", size=minswap, maxSize=maxswap,          autorequests.append(PartSpec(fstype="swap", size=minswap, maxSize=maxswap, raidLevel=raidLevel,
174              grow=True, asVol=True))                              grow=True, asVol=asVol_flag))
175    
176          storage.autoPartitionRequests = autorequests          storage.autoPartitionRequests = autorequests
177    
178      def setInstallData(self, anaconda):      def setInstallData(self, anaconda):
179          SMEInstallClass.setInstallData(self, anaconda)          BaseInstallClass.setInstallData(self, anaconda)
180          anaconda.id.security.setSELinux(SELINUX_DISABLED)          anaconda.id.security.setSELinux(SELINUX_DISABLED)
181          anaconda.id.storage.clearPartType = CLEARPART_TYPE_ALL          self.setDefaultPartitioning(
182                                   anaconda.id.storage,
183                                   anaconda.platform)
184    
185      def productMatches(self, oldprod):      def productMatches(self, oldprod):
186            log.info("oldprod %s productName %s" % (oldprod, productName));
187          if oldprod is None:          if oldprod is None:
188              return False              return False
189    
190          if oldprod.startswith(productName):          if oldprod.startswith(productName):
191              return True              return True
192    
193            productUpgrades = {
194                "SME Server": ("Mitel Networks", "SME Server", "e-smith server", ),
195            }
196    
197            if productUpgrades.has_key(productName):
198                acceptable = productUpgrades[productName]
199            else:
200                acceptable = ()
201    
202            for p in acceptable:
203                if oldprod.startswith(p):
204                    return True
205    
206          return False          return False
207    
208        def versionMatches(self, oldver):
209            log.info("oldver %s productVersion %s" % (oldver, productVersion));
210            return True;
211    
212        def getBackend(self):
213            return yuminstall.YumBackend
214    
215      def __init__(self):      def __init__(self):
216          SMEInstallClass.__init__(self)          BaseInstallClass.__init__(self)


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