in unattended install mode copy restore file

This commit is contained in:
Daniel Glanzmann
2008-09-29 19:39:48 +02:00
parent 4cbbd2ae3d
commit c25a0343d7
2 changed files with 12 additions and 3 deletions

View 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);

View 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;
}
}