]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/install+setup/install/main.c
Installer lauft durch und IDE Systeme booten :D
[people/pmueller/ipfire-2.x.git] / src / install+setup / install / main.c
index a5fd669ec99ad8f3f75e795c92b5414dc49e194d..e87ebb7e2300ce47c24d415c377eba4ccc6a8765 100644 (file)
@@ -180,7 +180,7 @@ int unattended_setup(struct keyvalue *unattendedkv) {
     if (!(file = fopen("/harddisk/etc/hosts.allow", "w")))
     {
        errorbox("unattended: ERROR writing hosts.allow");
-        return 0;
+       return 0;
     }
     fprintf(file, "sshd : ALL\n");
     fprintf(file, "ALL  : localhost\n");
@@ -681,20 +681,11 @@ int main(int argc, char *argv[])
                errorbox(ctr[TR_UNABLE_TO_MOUNT_LOG_FILESYSTEM]);
                goto EXIT;
        } */
-
-       snprintf(commandstring, STRING_SIZE, "/bin/mount -o ro %s /cdrom", insertdevnode);
        
        snprintf(commandstring, STRING_SIZE, "/bin/tar -C /harddisk -xvjf /cdrom/" SNAME "-" VERSION ".tbz2");
        
-       /* if (runcommandwithprogress(60, 4, title, commandstring, 4600,
-        *      ctr[TR_INSTALLING_FILES]))
-        * {
-        *      errorbox(ctr[TR_UNABLE_TO_INSTALL_FILES]);
-        *      goto EXIT;
-        * }
-        */
-
-       if (runcommandwithstatus(commandstring, ctr[TR_INSTALLING_FILES]))
+       if (runcommandwithprogress(60, 4, title, commandstring, INST_FILECOUNT,
+               ctr[TR_INSTALLING_FILES]))
        {
                errorbox(ctr[TR_UNABLE_TO_INSTALL_FILES]);
                goto EXIT;
@@ -746,12 +737,72 @@ int main(int argc, char *argv[])
          goto EXIT;
        }
 
-       /*  
-         Allow the user to restore their configuration from a floppy.
-         It uses tar.  If the tar fails for any reason, show user an
-         error and go back to the restore/skip question. This gives
-         the user the chance to have another go. */
-                               
+       /* if we detected SCSI then fixup */
+       if ((handle = fopen("/scsidriver", "r")))
+       {
+               char *driver;
+                       fgets(line, STRING_SIZE-1, handle);
+                       fclose(handle);
+               line[strlen(line) - 1] = 0;
+               driver = strtok(line, ".");
+               fprintf(flog, "Detected SCSI driver %s\n",driver);
+               if (strlen(driver) > 1) {
+                       fprintf(flog, "Fixing up ipfirerd.img\n");
+                       mysystem("/bin/chroot /harddisk /sbin/modprobe loop");
+                       mkdir("/harddisk/initrd", S_IRWXU|S_IRWXG|S_IRWXO);
+                       snprintf(commandstring, STRING_SIZE, "/bin/chroot /harddisk /sbin/mkinitrd --with=scsi_mod --with=%s --with=sd_mod --with=sr_mod --with=libata --with=ataraid /boot/ipfirerd.img %s", driver, KERNEL_VERSION);
+                       runcommandwithstatus(commandstring, ctr[TR_BUILDING_INITRD]);
+                       snprintf(commandstring, STRING_SIZE, "/bin/chroot /harddisk /sbin/mkinitrd --with=scsi_mod --with=%s --with=sd_mod --with=sr_mod --with=libata --with=ataraid /boot/ipfirerd-smp.img %s-smp", driver, KERNEL_VERSION);
+                       runcommandwithstatus(commandstring, ctr[TR_BUILDING_INITRD]);
+                       mysystem("/bin/chroot /harddisk /bin/mv /boot/grub/scsigrub.conf /boot/grub/grub.conf");
+                }
+        }
+
+
+        /* Build cache lang file */             
+        snprintf(commandstring, STRING_SIZE, "/bin/chroot /harddisk /usr/bin/perl -e \"require '" CONFIG_ROOT "/lang.pl'; &Lang::BuildCacheLang\"");
+        if (runcommandwithstatus(commandstring, ctr[TR_INSTALLING_LANG_CACHE]))
+        {
+                errorbox(ctr[TR_UNABLE_TO_INSTALL_LANG_CACHE]);
+                goto EXIT;
+        }
+
+       if (raid_disk)
+               sprintf(string, "root=%sp3", hdparams.devnode);
+       else
+               sprintf(string, "root=%s3", hdparams.devnode);
+       replace( "/harddisk/boot/grub/grub.conf", "root=ROOT", string);
+       mysystem( "sed -i \"s|KVERSION|$(/bin/uname -r)|\" /harddisk/boot/grub/grub.conf" );
+
+       replace( "/harddisk/boot/grub/grubbatch", "DEVICE", hdparams.devnode);
+       /* restore permissions */
+       chmod("/harddisk/boot/grub/grubbatch", S_IXUSR | S_IRUSR | S_IXGRP | S_IRGRP | S_IXOTH | S_IROTH);
+
+       /* mount proc filesystem */
+       mysystem("mkdir /harddisk/proc");
+       mysystem("/bin/mount -t proc none /harddisk/proc");
+       mysystem("/bin/mount --bind /dev /harddisk/dev");
+
+       snprintf(commandstring, STRING_SIZE, 
+                "/bin/chroot /harddisk /boot/grub/grubbatch");
+       if (runcommandwithstatus(commandstring, ctr[TR_INSTALLING_GRUB])) {
+               errorbox(ctr[TR_UNABLE_TO_INSTALL_GRUB]);
+               goto EXIT;
+       }
+
+       /* Install bootsplash */
+       mysystem("/bin/installbootsplash.sh");
+
+       mysystem("ln -s grub.conf /harddisk/boot/grub/menu.lst");
+       mysystem("umount /harddisk/proc");
+       mysystem("umount /harddisk/dev");
+
+       sprintf(message, ctr[TR_CONGRATULATIONS_LONG],
+                       NAME, SNAME, SNAME, NAME, NAME, NAME);
+       newtWinMessage(ctr[TR_CONGRATULATIONS], ctr[TR_OK], message);
+                
+       allok = 1;
+
 EXIT:
        fprintf(flog, "Install program ended.\n");      
        fflush(flog);