summaryrefslogtreecommitdiffstats
path: root/test/ruby/test_alias.rb
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-07 04:07:11 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-07 04:07:11 +0000
commitb831dce8883fe866e1778b5f2416b6107ee3ed7e (patch)
treee9eef38abd46626fcb04c004225d8e731fce0755 /test/ruby/test_alias.rb
parent07eb740efe5172ed3c9a8fad84088d26d539da01 (diff)
2004-04-07
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@6116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_alias.rb')
0 files changed, 0 insertions, 0 deletions
9 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
from lilo import LiloConfiguration
import iutil
import isys
import string
import os

def onMILO ():
    try:
        f = open ('/proc/cpuinfo', 'r')
    except:
        return
    lines = f.readlines ()
    serial = ""
    for line in lines:
        if string.find (line, "system serial number") >= 0:
            serial = string.strip (string.split (line, ':')[1])

    if serial and len (serial) >= 4 and serial[0:4] == "MILO":
        return 1
    else:
        return 0

def partitionNum (path):
    i = 0
    while path[i] not in string.digits:
        i = i + 1
    return string.atoi (path[i:])

def wholeDevice (path):
    i = 0
    while path[i] not in string.digits:
        i = i + 1
    return path[:i]

class MiloInstall:
    def __init__ (self, todo):
        self.todo = todo

    def writeAboot (self):
        if self.todo.mounts.has_key ('/boot'):
            confprefix = self.todo.instPath + "/boot/etc"
            kernelprefix = '/'
            partition = partitionNum (self.todo.mounts['/boot'][0])
            abootdev = wholeDevice (self.todo.mounts['/boot'][0])
            try:
                os.mkdir (confprefix)
		os.remove(todo.instPath + "/etc/aboot.conf")
                os.symlink("../boot/etc/aboot.conf",
                           self.todo.instPath + "/etc/aboot.conf")
            except:
		pass
        else:
            confprefix = self.todo.instPath + "/etc"
            kernelprefix = '/boot/'
            partition = partitionNum (self.todo.mounts['/'][0])
            abootdev = wholeDevice (self.todo.mounts['/'][0])

        if os.access (confprefix + "/etc/aboot.conf", os.R_OK):
            os.rename (confprefix + "/etc/aboot.conf",
                       confprefix + "/etc/aboot.conf.rpmsave")
        f = open (confprefix + "/etc/aboot.conf", 'w')
        f.write ("# aboot default configurations\n")
        if self.todo.mounts.has_key ('/boot'):
            f.write ("# NOTICE:  You have a /boot partition.  This means that\n")
            f.write ("#          all kernel paths are relative to /boot/\n")

        lines = 0
        rootdev = self.todo.mounts['/'][0]
        for package, tag in (('kernel-smp', 'smp'), ('kernel', '')):
            if (self.todo.hdList.has_key(package) and
                self.todo.hdList[package].selected):
                kernel = self.todo.hdList[package]
                version = "%s-%s" % (kernel['version'], kernel['release'])