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) |
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 |
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"), |
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") |
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 |
|
useRAID_flag = not flags.cmdline.has_key("noraid") |
146 |
|
|
147 |
|
fstype = "ext4" |
148 |
|
if flags.cmdline.has_key("ext3"): |
149 |
|
fstype = "ext3" |
150 |
|
|
151 |
|
# /boot |
152 |
|
# Manually specify fstype = ext3/ext4 and size = 250 MB |
153 |
|
# (Platform default is fstype ext4 and size = 500 MB) |
154 |
|
|
155 |
|
autorequests.append(PartSpec(mountpoint="/boot", fstype=fstype, size=250, useRAID=useRAID_flag, |
156 |
|
weight=platform.weight(mountpoint="/boot"))) |
157 |
|
|
158 |
bootreq = platform.setDefaultPartitioning() |
# / |
159 |
if bootreq: |
# Manually specify fstype = ext3/ext4 and size = 2048 MB, but growable |
160 |
autorequests.extend(bootreq) |
|
161 |
|
autorequests.append(PartSpec(mountpoint="/", fstype=fstype, size=2048, useRAID=useRAID_flag, |
162 |
|
grow=True, asVol=asVol_flag)) |
163 |
|
|
164 |
|
# swap |
165 |
|
# Manually specify fstype = swap and minswap < size < maxswap (growable) |
166 |
|
|
167 |
(minswap, maxswap) = iutil.swapSuggestion() |
(minswap, maxswap) = iutil.swapSuggestion() |
168 |
autorequests.append(PartSpec(fstype="swap", size=minswap, maxSize=maxswap, |
autorequests.append(PartSpec(fstype="swap", size=minswap, maxSize=maxswap, useRAID=useRAID_flag, |
169 |
grow=True, asVol=True)) |
grow=True, asVol=asVol_flag)) |
170 |
|
|
171 |
storage.autoPartitionRequests = autorequests |
storage.autoPartitionRequests = autorequests |
172 |
|
|
173 |
def setInstallData(self, anaconda): |
def setInstallData(self, anaconda): |
174 |
SMEInstallClass.setInstallData(self, anaconda) |
BaseInstallClass.setInstallData(self, anaconda) |
175 |
anaconda.id.security.setSELinux(SELINUX_DISABLED) |
anaconda.id.security.setSELinux(SELINUX_DISABLED) |
176 |
anaconda.id.storage.clearPartType = CLEARPART_TYPE_ALL |
self.setDefaultPartitioning( |
177 |
|
anaconda.id.storage, |
178 |
|
anaconda.platform) |
179 |
|
|
180 |
def productMatches(self, oldprod): |
def productMatches(self, oldprod): |
181 |
|
log.info("oldprod %s productName %s" % (oldprod, productName)); |
182 |
if oldprod is None: |
if oldprod is None: |
183 |
return False |
return False |
184 |
|
|
185 |
if oldprod.startswith(productName): |
if oldprod.startswith(productName): |
186 |
return True |
return True |
187 |
|
|
188 |
|
productUpgrades = { |
189 |
|
"SME Server": ("Mitel Networks", "SME Server", "e-smith server", ), |
190 |
|
} |
191 |
|
|
192 |
|
if productUpgrades.has_key(productName): |
193 |
|
acceptable = productUpgrades[productName] |
194 |
|
else: |
195 |
|
acceptable = () |
196 |
|
|
197 |
|
for p in acceptable: |
198 |
|
if oldprod.startswith(p): |
199 |
|
return True |
200 |
|
|
201 |
return False |
return False |
202 |
|
|
203 |
|
def versionMatches(self, oldver): |
204 |
|
log.info("oldver %s productVersion %s" % (oldver, productVersion)); |
205 |
|
return True; |
206 |
|
|
207 |
|
def getBackend(self): |
208 |
|
return yuminstall.YumBackend |
209 |
|
|
210 |
def __init__(self): |
def __init__(self): |
211 |
SMEInstallClass.__init__(self) |
BaseInstallClass.__init__(self) |