]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/commitdiff
in unattended install mode copy restore file
authorDaniel Glanzmann <dg@ipfire.org>
Mon, 29 Sep 2008 17:39:48 +0000 (19:39 +0200)
committerDaniel Glanzmann <dg@ipfire.org>
Mon, 29 Sep 2008 17:39:48 +0000 (19:39 +0200)
src/install+setup/install/main.c
src/install+setup/install/unattended.c

index 0fe97a1fdc60813cfa6d0ecda8c502bc0b6ed9fb..bf8f5b2bd762ea14e181bde949bb92ea7efb2dd5 100644 (file)
@@ -66,6 +66,7 @@ int main(int argc, char *argv[])
        int unattended = 0;
        struct keyvalue *unattendedkv = initkeyvalues();
        int hardyn = 0;
+       char restore_file[STRING_SIZE];
 
        setlocale (LC_ALL, "");
        sethostname( SNAME , 10);
@@ -208,6 +209,7 @@ int main(int argc, char *argv[])
            fprintf(flog, "unattended: Reading unattended.conf\n");
 
            (void) readkeyvalues(unattendedkv, UNATTENDED_CONF);
+           findkey(unattendedkv, "RESTORE_FILE", restore_file);            
        }
        
        /* Make the hdparms struct and print the contents.
@@ -538,6 +540,13 @@ int main(int argc, char *argv[])
                goto EXIT;
        }
        
+       /* Copy restore file from cdrom */
+       if (unattended && !strcmp(restore_file, "")) {
+               fprintf(flog, "unattended: Copy restore file\n");
+           snprintf(commandstring, STRING_SIZE, 
+                       "cp /cdrom/%s /harddisk/var/ipfire/backup", restore_file);
+       }
+       
        mysystem("umount /cdrom");
        snprintf(commandstring, STRING_SIZE, "eject /dev/%s", sourcedrive);
        mysystem(commandstring);
index ad143399dc657abef25c0606c12b2756ca8f0c8f..8dc4882a31d6a0dce21a32e85f362e11e9c6ab7d 100644 (file)
@@ -150,10 +150,10 @@ int unattended_setup(struct keyvalue *unattendedkv) {
        if (!strcmp(restore_file, "")) {
                fprintf(flog, "unattended: Restoring Backup\n");
            snprintf(commandstring, STRING_SIZE,
-                   "cd /harddisk && /bin/tar -xvz --preserve -f /cdrom/%s", restore_file);
+                   "cd /harddisk && /bin/tar -xvz --preserve -f /harddisk/var/ipfire/%s", restore_file);
            if (mysystem(commandstring)) {
-               errorbox("unattended: ERROR restoring backup");
-               return 0;
+               errorbox("unattended: ERROR restoring backup");
+               return 0;
            }
        }