From c25a0343d7cfdc8127ac11486530e9bac77b3bbc Mon Sep 17 00:00:00 2001 From: Daniel Glanzmann Date: Mon, 29 Sep 2008 19:39:48 +0200 Subject: [PATCH] in unattended install mode copy restore file --- src/install+setup/install/main.c | 9 +++++++++ src/install+setup/install/unattended.c | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/install+setup/install/main.c b/src/install+setup/install/main.c index 0fe97a1fdc..bf8f5b2bd7 100644 --- a/src/install+setup/install/main.c +++ b/src/install+setup/install/main.c @@ -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); diff --git a/src/install+setup/install/unattended.c b/src/install+setup/install/unattended.c index ad143399dc..8dc4882a31 100644 --- a/src/install+setup/install/unattended.c +++ b/src/install+setup/install/unattended.c @@ -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; } } -- 2.39.5