diff options
author | jakub <jakub> | 1999-09-29 10:23:02 +0000 |
---|---|---|
committer | jakub <jakub> | 1999-09-29 10:23:02 +0000 |
commit | eb661e6579f31ef588421d122c80a7330d9cb50f (patch) | |
tree | df0f675122d7109eaef974462e835d830f69cfde | |
parent | 62dcf5efc8699d9cc156db0664205e53dad9feb7 (diff) | |
download | anaconda-eb661e6579f31ef588421d122c80a7330d9cb50f.tar.gz anaconda-eb661e6579f31ef588421d122c80a7330d9cb50f.tar.xz anaconda-eb661e6579f31ef588421d122c80a7330d9cb50f.zip |
Further SILO hacks and fixes.
-rw-r--r-- | isys/silo.c | 19 | ||||
-rw-r--r-- | iw/silo.py | 13 | ||||
-rw-r--r-- | silo.py | 112 |
3 files changed, 118 insertions, 26 deletions
diff --git a/isys/silo.c b/isys/silo.c index 554e89068..ee229a75c 100644 --- a/isys/silo.c +++ b/isys/silo.c @@ -105,15 +105,10 @@ prom_getopt(char *var, int *lenp) { static void prom_setopt(char *var, char *value) { DECL_OP(MAX_VAL); - + strcpy (op->oprom_array, var); strcpy (op->oprom_array + strlen (var) + 1, value); - if (ioctl (promfd, OPROMSETOPT, op) < 0) { - printf ("in %s\n", var); - perror ("opepromsetopt"); - printf ("%d\n", errno); - return; - } + ioctl (promfd, OPROMSETOPT, op); } static int @@ -551,7 +546,7 @@ static void get_root_name(void) { prom_getsibling(0); prop = prom_getproperty("name", &len); - if (prop && len > 0 && !strcmp (prop, "aliases")) + if (prop && len > 0) prom_root_name = strdup(prop); } @@ -571,6 +566,7 @@ int init_sbusdisk(void) { void set_prom_vars(char *linuxAlias, char *bootDevice) { int len; + int aliasDone = 0; if (prom_init(O_RDWR)) return; if (linuxAlias && hasaliases) { @@ -584,14 +580,13 @@ void set_prom_vars(char *linuxAlias, char *bootDevice) { enabled = 0; else if (!strcasecmp (use_nvramrc, "true")) enabled = 1; - printf ("use_nvramrc `%s' %d\n", use_nvramrc, len); } if (enabled != -1) { p = prom_getopt ("nvramrc", &len); if (p) { memcpy (nvramrc, p, len); nvramrc [len] = 0; - q = p; + q = nvramrc; while (q) { /* If there is already `devalias linux /some/ugly/prom/path' make sure we fully understand that and remove it. */ @@ -619,11 +614,14 @@ void set_prom_vars(char *linuxAlias, char *bootDevice) { prom_setopt ("nvramrc", nvramrc); if (!enabled) prom_setopt ("use-nvramrc?", "true"); + aliasDone = 1; } } } if (bootDevice) { char *p; + if (aliasDone) + bootDevice = "linux"; p = prom_getopt ("boot-device", &len); if (p) { prom_setopt ("boot-device", bootDevice); @@ -643,6 +641,7 @@ int main(void) { init_sbusdisk(); set_prom_vars ("/sbus@2,0/SUNW,fas@1,8800000/sd@0,0", "linux"); + printf ("prom root name `%s'\n", prom_root_name); for (i = 0; i < hdlen; i++) { if (hd[i].type) printf ("hd%c %x %d %d %d\n", i + 'a', hd[i].prom_node, diff --git a/iw/silo.py b/iw/silo.py index c91f7275d..6a4facc8c 100644 --- a/iw/silo.py +++ b/iw/silo.py @@ -26,7 +26,12 @@ class SiloWindow (InstallWindow): def getNext (self): # XXX - if not self.bootdisk: return None + if not self.bootdisk: + if self.todo.silo.hasUsableFloppy() == 2: + self.todo.bootdisk = 1 + else: + self.todo.bootdisk = 0 + return None if self.bootdisk.get_active (): self.todo.bootdisk = 1 @@ -56,7 +61,7 @@ class SiloWindow (InstallWindow): if (type == 2): return "Linux Native" elif (type == 6): - return "SunOS/Solaris" + return "UFS" else: return "Other" @@ -199,10 +204,12 @@ class SiloWindow (InstallWindow): optionBox = GtkVBox (FALSE, 5) optionBox.set_border_width (5) self.bootdisk = GtkCheckButton (_("Create boot disk")) - if self.todo.silo.hasUsableFloppy(): + floppy = self.todo.silo.hasUsableFloppy() + if floppy == 2: self.bootdisk.set_active (TRUE) else: self.bootdisk.set_active (FALSE) + if floppy == 0: self.bootdisk.set_sensitive (FALSE) optionBox.pack_start (self.bootdisk) @@ -3,12 +3,58 @@ import os from lilo import LiloConfiguration import _silo import iutil +import isys class SiloInstall: def __init__ (self, todo): self.todo = todo - self.linuxAlias = None - self.bootBevice = None + self.linuxAlias = 1 + self.bootBevice = 1 + + def checkUFS(self, dev): + f = open("/proc/mounts","r") + lines = f.readlines () + f.close () + mounted = None + type = None + for line in lines: + fields = string.split (line) + if fields[0] == '/dev/' + dev and fields[2] == 'ufs': + mounted = fields[1] + if not mounted: + try: + os.mkdir ("/tmp/ufsmntpoint") + isys.makeDevInode (dev, "/tmp/" + dev) + isys.mount ("/tmp" + dev, "/tmp/ufsmntpoint", "ufs") + except: + try: + os.remove ("/tmp/" + dev) + except: + pass + return None + root = "/tmp/ufsmntpoint" + else: + root = mounted + if os.access (root + "/etc/system", os.X_OK): + if os.access (root + "/kernel/unix", os.X_OK): + type = "Solaris" + elif os.access (root + "/kernel/genunix", os.X_OK): + type = "Solaris" + # FIXME - test for SunOS. Anyone? + if not mounted: + try: + isys.umount ("/tmp/ufsmntpoint") + except: + pass + try: + os.rmdir ("/tmp/ufsmntpoint") + except: + pass + try: + os.remove ("/tmp/" + dev) + except: + pass + return type def getSiloImages(self): todo = self.todo @@ -28,13 +74,18 @@ class SiloInstall: oldImages[dev] = todo.liloImages[dev] todo.liloImages = {} - foundUfs = 0 + nSolaris = 0 + nSunOS = 0 for (dev, devName, type) in drives: # ext2 partitions get listed if # 1) they're / # 2) they're not mounted # and contain /boot of # some Linux installation + # FIXME: For now only list / and UFS partitions, + # for 6.2 write code which will read and parse silo.conf from other + # Linux partitions and merge it in (after required device + # substitions etc. # only list ext2 and ufs partitions if type != 2 and type != 6: @@ -43,16 +94,24 @@ class SiloInstall: if (mountsByDev.has_key(dev)): if mountsByDev[dev] == '/': todo.liloImages[dev] = ("linux", 2) - else: + elif type == 6: if not oldImages.has_key(dev): todo.liloImages[dev] = ("", type) else: todo.liloImages[dev] = oldImages[dev] - # XXX - if type == 6: - if foundUfs: continue - foundUfs = 1 - todo.liloImages[dev] = ("solaris", type) + ostype = self.checkUFS(dev) + if ostype == "Solaris": + if nSolaris == 0: + todo.liloImages[dev] = ("solaris", type) + else: + todo.liloImages[dev] = ("solaris%d" % nSolaris, type) + nSolaris = nSolaris + 1 + elif ostype == "SunOS": + if nSunOS == 0: + todo.liloImages[dev] = ("sunos", type) + else: + todo.liloImages[dev] = ("sunos%d" % nSunOS, type) + nSunOS = nSunOS + 1 return todo.liloImages @@ -77,7 +136,12 @@ class SiloInstall: f.close () for line in lines: if string.strip (line) == "2 fd": - return 1 + name = _silo.promRootName() + if name and name[0:10] == 'SUNW,Ultra' and string.find(name, "Engine") == -1: + # Seems like SMCC Ultra box. It is highly probable + # the floppies will be unbootable + return 1 + return 2 return 0 def setPROM(self, linuxAlias, bootDevice): @@ -116,8 +180,12 @@ class SiloInstall: args = [ "silo" ] - if (todo.liloDevice != "mbr"): + if todo.liloDevice == "mbr": + device = boothd + else: + device = bootpart args.append("-t") + bootDevice = self.disk2PromPath(device) i = len (bootpart) - 1 while i > 0 and bootpart[i] in string.digits: @@ -136,8 +204,21 @@ class SiloInstall: if (drive == rootDev) and label: main = label elif label: - # FIXME - otherList.append (label, "/dev/" + drive) + i = len(drive) - 1 + while i > 0 and drive[i] in string.digits: + i = i - 1 + prompath = drive[:i+1] + if prompath == boothd: + prompath = drive[i+1:] + else: + prompath = self.disk2PromPath(prompath) + if prompath: + if prompath[:3] == 'sd(': + prompath = prompath + drive[i+1:] + else: + prompath = prompath + ";" + drive[i+1:] + if prompath: + otherList.append (label, prompath) silo.addEntry("default", main) @@ -201,3 +282,8 @@ class SiloInstall: args, stdout = None, root = todo.instPath) + if self.linuxAlias and self.hasAliases(): + linuxAlias = bootDevice + if not self.bootDevice: + bootDevice = None + _silo.setPromVars(linuxAlias,bootDevice) |