]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - src/installer/main.c
installer: Make restoring the backup interactive
[ipfire-2.x.git] / src / installer / main.c
index ba50cd9b6fe1f1ac3bf8269727fe4dc6e674baf9..36f8dfec8110a48bb6fb1f73c07c35350503550a 100644 (file)
@@ -722,11 +722,24 @@ int main(int argc, char *argv[]) {
        mysystem(logfile, "/usr/bin/touch /harddisk/var/ipfire/main/gpl_accepted");
 
        /* Copy restore file from cdrom */
-       if (unattended && (strlen(restore_file) > 0)) {
-               fprintf(flog, "unattended: Copy restore file\n");
-               snprintf(commandstring, STRING_SIZE, 
-                       "cp /cdrom/%s /harddisk/var/ipfire/backup", restore_file);
-               mysystem(logfile, commandstring);
+       char* backup_file = hw_find_backup_file(logfile, SOURCE_MOUNT_PATH);
+       if (backup_file) {
+               rc = 0;
+               if (!unattended) {
+                       rc = newtWinOkCancel(title, _("A backup file has been found on the installation image.\n\n"
+                               "Do you want to restore the backup?"), 50, 10, _("Yes"), _("No"));
+               }
+
+               if (rc == 0) {
+                       rc = hw_restore_backup(logfile, backup_file, DESTINATION_MOUNT_PATH);
+
+                       if (rc) {
+                               errorbox(_("An error occured when the backup file was restored."));
+                               goto EXIT;
+                       }
+               }
+
+               free(backup_file);
        }
 
        // Umount the destination drive