]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - src/install+setup/install/main.c
Fix am Installer
[people/teissler/ipfire-2.x.git] / src / install+setup / install / main.c
index d300dfbc0f5fd066c39b4da16b25e8794de6ee75..bbda982cff2fc854bccbdaad5c91d290424d93c1 100644 (file)
@@ -14,7 +14,7 @@
 #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
@@ -66,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) {
@@ -142,25 +142,23 @@ int main(int argc, char *argv[])
        {
                fprintf(flog, "Couldn't open commandline: /proc/cmdline\n");
        } else {
+               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");
+               
                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");
+               mysystem("/sbin/modprobe iso9660"); // CDROM
+               mysystem("/sbin/modprobe ext2"); // Boot patition
+               mysystem("/sbin/modprobe vfat"); // USB key
        }
 
        if (unattended) {
@@ -316,12 +314,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,
@@ -334,8 +332,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 {
@@ -378,16 +376,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;
                }
                
@@ -399,7 +396,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;
        }
@@ -451,10 +448,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]);
@@ -532,9 +529,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);
@@ -577,14 +571,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);