1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# listed, it was mbr and we should nicely fall back to boot
if bl.defaultDevice not in keys:
log("MBR not suitable as boot device; installing to partition")
bl.defaultDevice = "boot"
bl.setDevice(choices[bl.defaultDevice][0])
elif choices and choices.has_key("mbr"):
bl.setDevice(choices["mbr"][0])
elif choices and choices.has_key("boot"):
bl.setDevice(choices["boot"][0])
bootDev = fsset.getEntryByMountPoint("/")
if not bootDev:
bootDev = fsset.getEntryByMountPoint("/boot")
part = partedUtils.get_partition_by_name(diskSet.disks,
bootDev.device.getDevice())
if part and partedUtils.end_sector_to_cyl(part.geom.dev,
part.geom.end) >= 1024:
bl.above1024 = 1
def writeBootloader(intf, instRoot, fsset, bl, langs, comps):
def dosync():
isys.sync()
isys.sync()
isys.sync()
justConfigFile = not flags.setupFilesystems
if bl.defaultDevice == -1:
return
# now make the upgrade stuff work for kickstart too. ick.
if bl.kickstart == 1 and bl.doUpgradeOnly == 1:
import checkbootloader
(bootType, theDev) = checkbootloader.getBootloaderTypeAndBoot(instRoot)
bl.doUpgradeonly = 1
if bootType == "GRUB":
bl.useGrubVal = 1
bl.setDevice(theDev)
elif bootType == "LILO":
bl.useGrubVal = 0
bl.setDevice(theDev)
else:
bl.doUpgradeOnly = 0
w = intf.waitWindow(_("Bootloader"), _("Installing bootloader..."))
kernelList = []
otherList = []
rootDev = fsset.getEntryByMountPoint('/').device.getDevice()
defaultDev = bl.images.getDefault()
kernelLabel = None
kernelLongLabel = None
for (dev, (label, longlabel, type)) in bl.images.getImages().items():
if dev == rootDev:
kernelLabel = label
kernelLongLabel = longlabel
elif dev == defaultDev:
otherList = [(label, longlabel, dev)] + otherList
else:
otherList.append((label, longlabel, dev))
if kernelLabel is None:
log("unable to find default image, bailing")
plainLabelUsed = 0
for (version, nick) in comps.kernelVersionList():
if plainLabelUsed:
kernelList.append(("%s-%s" %(kernelLabel, nick),
"%s-%s" %(kernelLongLabel, nick),
version))
else:
kernelList.append((kernelLabel, kernelLongLabel, version))
plainLabelUsed = 1
# FIXME: blah, exec-shield breaks grub. turn it off for now
if os.access("/proc/sys/kernel/exec-shield", os.W_OK):
f = open("/proc/sys/kernel/exec-shield", "w")
f.write("0")
f.close()
dosync()
try:
bl.write(instRoot, fsset, bl, langs, kernelList, otherList, defaultDev,
justConfigFile, intf)
w.pop()
except BootyNoKernelWarning:
w.pop()
if intf:
intf.messageWindow(_("Warning"),
_("No kernel packages were installed on your "
"system. Your boot loader configuration "
"will not be changed."))
dosync()
# note that this function no longer actually creates an initrd.
# the kernel's %post does this now
def makeInitrd (kernelTag, instRoot):
if iutil.getArch() == 'ia64':
initrd = "/boot/efi/initrd%s.img" % (kernelTag, )
else:
initrd = "/boot/initrd%s.img" % (kernelTag, )
return initrd
# return instance of the appropriate bootloader for our arch
def getBootloader():
import booty
return booty.getBootloader()
|