mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-26 19:00:34 +02:00
in unattended install mode copy restore file
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user