/[smeserver]/cdrom.image/updates/checkbootloader.py
ViewVC logotype

Diff of /cdrom.image/updates/checkbootloader.py

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

Revision 1.1 by slords, Sun Jul 3 23:48:44 2005 UTC Revision 1.2 by slords, Wed Apr 5 01:20:27 2006 UTC
# Line 4  Line 4 
4  # being used on the system.  # being used on the system.
5  #  #
6  # Jeremy Katz <katzj@redhat.com>  # Jeremy Katz <katzj@redhat.com>
7    # Peter Jones <pjones@redhat.com>
8  #  #
9  # Copyright 2001 Red Hat, Inc.  # Copyright 2001,2005 Red Hat, Inc.
10  #  #
11  # This software may be freely redistributed under the terms of the GNU  # This software may be freely redistributed under the terms of the GNU
12  # library public license.  # library public license.
# Line 14  Line 15 
15  # along with this program; if not, write to the Free Software  # along with this program; if not, write to the Free Software
16  # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17    
18  import os,sys  import os
19  import string  import string
20    
21  grubConfigFile = "/boot/grub/grub.conf"  grubConfigFile = "/boot/grub/grub.conf"
22  liloConfigFile = "/etc/lilo.conf"  liloConfigFile = "/etc/lilo.conf"
23  yabootConfigFile = "/etc/yaboot.conf"  yabootConfigFile = "/etc/yaboot.conf"
24    siloConfigFile = "/etc/silo.conf"
25    
26    
27  # XXX: this is cut and pasted directly from booty/bootloaderInfo.py  # XXX: this is cut and pasted directly from booty/bootloaderInfo.py
# Line 133  def getBootloaderTypeAndBoot(instRoot = Line 135  def getBootloaderTypeAndBoot(instRoot =
135      haveGrubConf = 1      haveGrubConf = 1
136      haveLiloConf = 1      haveLiloConf = 1
137      haveYabootConf = 1      haveYabootConf = 1
138        haveSiloConf = 1
139            
140      bootDev = None      bootDev = None
141            
# Line 144  def getBootloaderTypeAndBoot(instRoot = Line 147  def getBootloaderTypeAndBoot(instRoot =
147          haveLiloConf = 0          haveLiloConf = 0
148      if not os.access(instRoot + yabootConfigFile, os.R_OK):      if not os.access(instRoot + yabootConfigFile, os.R_OK):
149          haveYabootConf = 0          haveYabootConf = 0
150        if not os.access(instRoot + siloConfigFile, os.R_OK):
151            haveSiloConf = 0
152    
153      if haveGrubConf:      if haveGrubConf:
154          bootDev = None          bootDev = None
# Line 159  def getBootloaderTypeAndBoot(instRoot = Line 164  def getBootloaderTypeAndBoot(instRoot =
164              f.close()              f.close()
165              for line in lines:              for line in lines:
166                  if line.startswith(stanza):                  if line.startswith(stanza):
                     import checkbootloader  
167                      bootDev = getBootDevString(line)                      bootDev = getBootDevString(line)
168                      break                      break
169              if bootDev is not None:              if bootDev is not None:
# Line 194  def getBootloaderTypeAndBoot(instRoot = Line 198  def getBootloaderTypeAndBoot(instRoot =
198          if bootDev:          if bootDev:
199                  return ("YABOOT", bootDev)                  return ("YABOOT", bootDev)
200    
201        if haveSiloConf:
202            bootDev = None
203            # We've never done the /etc/sysconfig/silo thing, but maybe
204            # we should start...
205            for (fn, stanza) in [ ("/etc/sysconfig/silo", "boot="),
206                                  (grubConfigFile, "#boot=") ]:
207                try:
208                    f = open(instRoot + fn, "r")
209                except:
210                    continue
211    
212                lines = f.readlines()
213                f.close()
214                for line in lines:
215                    if line.startswith(stanza):
216                        bootDev = getBootDevString(line)
217                        break
218                if bootDev is not None:
219                    break
220    
221            if bootDev is not None:
222                # XXX SILO sucks just like grub.
223                if getDiskPart(bootDev)[1] != 3:
224                    block = getBootBlock(bootDev, instRoot, 1)
225                    if block[24:28] == "SILO":
226                        return ("SILO", bootDev)
227    
228      return (None, None)      return (None, None)
229    
230  def whichBootLoader(instRoot = "/"):          def whichBootLoader(instRoot = "/"):        


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