]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/install+setup/install/main.c
Rudimentaere ISDN-Erkennung erstellt.
[people/pmueller/ipfire-2.x.git] / src / install+setup / install / main.c
index 0bb0b343eefb6a2301338402508e4bac006c1a37..4d9538ad23b306e28f1dda4d1f7c9692123246d4 100644 (file)
 #define CDROM_INSTALL 0
 #define URL_INSTALL 1
 #define DISK_INSTALL 2
-#define INST_FILECOUNT 6000
+#define INST_FILECOUNT 6200
 #define UNATTENDED_CONF "/cdrom/boot/unattended.conf"
 
 #define REISER4 0
 #define REISERFS 1
 #define EXT3 2
 
-int raid_disk = 0;
 FILE *flog = NULL;
 char *mylog;
 
@@ -67,7 +66,7 @@ long calc_rootsize(long free, long max) {
        long root;
        
        root = max / 2;
-       if (root < 512) {
+       if (root < 256) {
                return 0;
        }
        if (root > 2048) {
@@ -144,29 +143,26 @@ int main(int argc, char *argv[])
                fprintf(flog, "Couldn't open commandline: /proc/cmdline\n");
        } else {
                fgets(line, STRING_SIZE, cmdfile);
-               if (strstr (line, "noide") == NULL) {
-                       fprintf(flog, "Initializing IDE controllers.\n");
-                       initialize_ide();
-               } else {
-                       fprintf(flog, "Skipping IDE detection.\n");
-               }
-               if (strstr (line, "nousb") == NULL) {
-                       fprintf(flog, "Initializing USB controllers.\n");
-                       initialize_usb();
-               } else {
-                       fprintf(flog, "Skipping USB detection.\n");
-               }
+               
                // check if we have to make an unattended install
                if (strstr (line, "unattended") != NULL) {
                    unattended = 1;
-               }
-               // Loading the cdrom-filesystem
-               mysystem("/sbin/modprobe iso9660");
+                   runcommandwithstatus("/bin/sleep 10", "WARNING: Unattended installation will start in 10 seconds...");
+               }               
        }
-
-       if (unattended) {
-           runcommandwithstatus("/bin/sleep 10", "WARNING: Unattended installation will start in 10 seconds...");
-       }
+       
+       mysystem("/sbin/modprobe ide-generic");
+       mysystem("/sbin/modprobe generic");
+       mysystem("/sbin/modprobe ide-cd");
+       mysystem("/sbin/modprobe ide-disk");
+       mysystem("/sbin/modprobe sd_mod");
+       mysystem("/sbin/modprobe sr_mod");
+       mysystem("/sbin/modprobe usb-storage");
+       mysystem("/sbin/modprobe usbhid");
+
+       mysystem("/sbin/modprobe iso9660"); // CDROM
+       mysystem("/sbin/modprobe ext2"); // Boot patition
+       mysystem("/sbin/modprobe vfat"); // USB key
        
        /* German is the default */
        for (choice = 0; langnames[choice]; choice++)
@@ -178,14 +174,12 @@ int main(int argc, char *argv[])
                goto EXIT;
 
        if (!unattended) {
-           rc = newtWinMenu("Language selection",
-                   "Select the language you wish to use for the " NAME ".", 50, 5, 5, 8,
+           rc = newtWinMenu("Language selection", "Select the language you wish to use for the " NAME ".", 50, 5, 5, 8,
                    langnames, &choice, "Ok", NULL);
        }
 
        ctr = langtrs[choice];
        strcpy(shortlangname, shortlangnames[choice]);
-       fprintf(flog, "Selected language: %s\n", shortlangname);
 
        newtDrawRootText(14, 0, NAME " " VERSION " - " SLOGAN );
        newtPushHelpLine(ctr[TR_HELPLINE]);
@@ -209,7 +203,6 @@ int main(int argc, char *argv[])
 
        // Starting hardware detection
        runcommandwithstatus("/bin/probehw.sh", ctr[TR_PROBING_HARDWARE]);
-       runcommandwithstatus("/bin/probenic.sh install", ctr[TR_PROBING_HARDWARE]);
 
        /* CDROM INSTALL */
        if (installtype == CDROM_INSTALL) {
@@ -283,48 +276,6 @@ int main(int argc, char *argv[])
                }
        }
 
-       /*
-       // Need to clean this up at some point
-       // scsi disk is sdb/sdc when sda/sdb is used for usb-key
-       // if scsi-disk is sdd or more, it is not discovered
-       // Support only 2 usb keys, none could be unplugged
-       if (checkusb("sdb") && try_scsi("sdc")) {
-               scsi_disk = 1;
-               sprintf(harddrive, "sdc");
-               goto FOUND_DESTINATION;
-       }
-       if (checkusb("sda") && try_scsi("sdb")) {
-               scsi_disk = 1;
-               sprintf(harddrive, "sdb");
-               goto FOUND_DESTINATION;
-       }
-       if (try_scsi("sda")) {
-               scsi_disk = 1;
-               sprintf(harddrive, "sda");
-               goto FOUND_DESTINATION;
-       }
-       if (try_scsi("ida/c0d0")) {
-               raid_disk = 1;
-               sprintf(harddrive, "ida/c0d0");
-               goto FOUND_DESTINATION;
-       }
-       if (try_scsi("cciss/c0d0")) {
-               raid_disk = 1;
-               sprintf(harddrive, "cciss/c0d0");
-               goto FOUND_DESTINATION;
-       }
-       if (try_scsi("rd/c0d0")) {
-               raid_disk = 1;
-               sprintf(harddrive, "rd/c0d0");
-               goto FOUND_DESTINATION;
-       }
-       if (try_scsi("ataraid/d0")) {
-               raid_disk = 1;
-               sprintf(harddrive, "ataraid/d0");
-               goto FOUND_DESTINATION;
-       } */
-
-       FOUND_DESTINATION:
        if ((handle = fopen("/tmp/dest_device", "r")) == NULL) {
                errorbox(ctr[TR_NO_HARDDISK]);
                goto EXIT;
@@ -361,12 +312,12 @@ int main(int argc, char *argv[])
        sprintf(message, ctr[TR_PREPARE_HARDDISK], hdparams.devnode_disk);
        if (unattended) {
            hardyn = 1;
+       } else {
+               yesnoharddisk[0] = ctr[TR_NO];
+               yesnoharddisk[1] = ctr[TR_YES];
+               yesnoharddisk[2] = NULL;
        }
 
-       yesnoharddisk[0] = ctr[TR_NO];
-       yesnoharddisk[1] = ctr[TR_YES];
-       yesnoharddisk[2] = NULL;
-
        while (! hardyn) {
                rc = newtWinMenu(title, message,
                                 50, 5, 5, 6, yesnoharddisk,
@@ -379,8 +330,8 @@ int main(int argc, char *argv[])
                goto EXIT;
 
        if (!unattended) {              
-               sprintf(message, "(TR) Bitte waehlen Sie ihr Dateisystem aus:");
-               rc = newtWinMenu("(TR) Dateisystemauswahl", message,
+               sprintf(message, ctr[TR_CHOOSE_FILESYSTEM]);
+               rc = newtWinMenu( ctr[TR_CHOOSE_FILESYSTEM], message,
                        50, 5, 5, 6, fstypes, &fstype, ctr[TR_OK],
                        ctr[TR_CANCEL], NULL);
        } else {
@@ -423,16 +374,15 @@ int main(int argc, char *argv[])
        
        swap_file = calc_swapsize(memory, maximum_free);
 
-       if (maximum_free < 768 + swap_file ) {
-               if (maximum_free < 768) {
+       if (maximum_free < 512 + swap_file ) {
+               if (maximum_free < 700) {
                        errorbox(ctr[TR_DISK_TOO_SMALL]);
                        goto EXIT;
                }
 
                if (!unattended) {
                    rc = newtWinChoice(title, ctr[TR_OK], ctr[TR_CANCEL], ctr[TR_CONTINUE_NO_SWAP]);
-               }
-               else {
+               } else {
                    rc = 1;
                }
                
@@ -444,7 +394,7 @@ int main(int argc, char *argv[])
        boot_partition = 20; /* in MB */
        current_free = maximum_free - boot_partition - swap_file;
 
-       if (current_free < 768) {
+       if (current_free < 700) {
                errorbox(ctr[TR_DISK_TOO_SMALL]);
                goto EXIT;
        }
@@ -496,10 +446,10 @@ int main(int argc, char *argv[])
                sprintf(mkfscommand, "/sbin/mkreiserfs -f");
        } else if (fstype == EXT3) {
                mysystem("/sbin/modprobe ext3");
-               sprintf(mkfscommand, "/bin/mke2fs -T ext3 -c");
+               sprintf(mkfscommand, "/sbin/mke2fs -T ext3 -c");
        }
 
-       snprintf(commandstring, STRING_SIZE, "/bin/mke2fs -T ext2 -c %s1", hdparams.devnode_part);
+       snprintf(commandstring, STRING_SIZE, "/sbin/mke2fs -T ext2 -c %s1", hdparams.devnode_part);
        if (runcommandwithstatus(commandstring, ctr[TR_MAKING_BOOT_FILESYSTEM]))
        {
                errorbox(ctr[TR_UNABLE_TO_MAKE_BOOT_FILESYSTEM]);
@@ -577,9 +527,6 @@ int main(int argc, char *argv[])
                errorbox(ctr[TR_UNABLE_TO_INSTALL_FILES]);
                goto EXIT;
        }
-               
-       /* Save USB controller type to modules.conf */
-       write_usb_modules_conf();
        
        /* Save language und local settings */
        write_lang_configs(shortlangname);
@@ -622,14 +569,30 @@ int main(int argc, char *argv[])
                replace("/harddisk/etc/fstab", "FSTYPE", "reiserfs");
                replace("/harddisk/boot/grub/grub.conf", "MOUNT", "ro");
        } else if (fstype == EXT3) {
+               snprintf(commandstring, STRING_SIZE, "tune2fs -j %s3", hdparams.devnode_part);
+               if (runcommandwithstatus(commandstring, ctr[TR_JOURNAL_EXT3]))
+               {
+                       errorbox(ctr[TR_JOURNAL_ERROR]);
+                       replace("/harddisk/etc/fstab", "FSTYPE", "ext2");
+                       goto NOJOURNAL;
+               }
+               snprintf(commandstring, STRING_SIZE, "tune2fs -j %s4", hdparams.devnode_part);
+               if (runcommandwithstatus(commandstring, ctr[TR_JOURNAL_EXT3]))
+               {
+                       errorbox(ctr[TR_JOURNAL_ERROR]);
+                       replace("/harddisk/etc/fstab", "FSTYPE", "ext2");
+                       goto NOJOURNAL;
+               }
                replace("/harddisk/etc/fstab", "FSTYPE", "ext3");
+               NOJOURNAL:
+               replace("/harddisk/etc/mkinitcpio.conf", "MODULES=\"", "MODULES=\"ext3 ");
                replace("/harddisk/boot/grub/grub.conf", "MOUNT", "ro");
        }
 
        /* Going to make our initrd... */
-       snprintf(commandstring, STRING_SIZE, "/sbin/chroot /harddisk /sbin/mkinitcpio -v -g /boot/ipfirerd.img -k %s-ipfire", KERNEL_VERSION);
+       snprintf(commandstring, STRING_SIZE, "/sbin/chroot /harddisk /sbin/mkinitcpio -g /boot/ipfirerd.img -k %s-ipfire", KERNEL_VERSION);
        runcommandwithstatus(commandstring, ctr[TR_BUILDING_INITRD]);
-       snprintf(commandstring, STRING_SIZE, "/sbin/chroot /harddisk /sbin/mkinitcpio -v -g /boot/ipfirerd-smp.img -k %s-ipfire-smp", KERNEL_VERSION);
+       snprintf(commandstring, STRING_SIZE, "/sbin/chroot /harddisk /sbin/mkinitcpio -g /boot/ipfirerd-smp.img -k %s-ipfire-smp", KERNEL_VERSION);
        runcommandwithstatus(commandstring, ctr[TR_BUILDING_INITRD]);
 
        sprintf(string, "root=%s3", hdparams.devnode_part_run);
@@ -647,6 +610,10 @@ int main(int argc, char *argv[])
        }
 
        mysystem("ln -s grub.conf /harddisk/boot/grub/menu.lst");
+       
+       mysystem("umount /cdrom");
+       snprintf(commandstring, STRING_SIZE, "eject /dev/%s", sourcedrive);
+       mysystem(commandstring);
 
        if (!unattended) {
                sprintf(message, ctr[TR_CONGRATULATIONS_LONG],
@@ -682,12 +649,8 @@ EXIT:
                newtFinished();
 
                if (!unattended) {
-                       // Copy our scanned nics to the disk and lock because scan doesn't work in chroot
-                       system("touch /harddisk/var/ipfire/ethernet/scan_lock");
-                       system("cp -f /tmp/scanned_nics /harddisk/var/ipfire/ethernet/scanned_nics");
                        if (system("/sbin/chroot /harddisk /usr/local/sbin/setup /dev/tty2 INSTALL"))
                                printf("Unable to run setup.\n");
-                       system("rm -f /harddisk/var/ipfire/ethernet/scan_lock");
                }
 
                if (system("/bin/umount /harddisk/proc"))