Changeset 3268 in MondoRescue for branches/3.2


Ignore:
Timestamp:
Apr 29, 2014, 8:22:35 PM (10 years ago)
Author:
Bruno Cornec
Message:
  • Fix initialization of g_cd_recovery to avoid having it at TRUE inwillingly
  • Remove code in netfs case now handled in mindi (mr-net-get-config)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mondo/src/common/libmondo-tools.c

    r3238 r3268  
    4444bool g_remount_cdrom_at_end,    ///< TRUE if we unmounted the CD-ROM and should remount it when done with the backup.
    4545 g_remount_floppy_at_end;       ///< TRUE if we unmounted the floppy and should remount it when done with the backup.
    46 bool g_cd_recovery;             ///< TRUE if we're making an "autonuke" backup.
     46bool g_cd_recovery = FALSE;             ///< TRUE if we're making an "autonuke" backup.
    4747double g_kernel_version;
    4848
     
    363363    char *iso_tmp = NULL;
    364364    char *iso_path = NULL;
     365    char *cfg_fname = NULL;
    365366
    366367    assert(bkpinfo != NULL);
     
    593594
    594595    if (bkpinfo->backup_media_type == netfs) {
     596        mr_asprintf(tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir);
     597        write_one_liner_data_file(tmp, bkpinfo->prefix);
     598        mr_free(tmp);
     599
    595600        if (bkpinfo->netfs_mount) {
    596             mr_asprintf(hostname, "%s", bkpinfo->netfs_mount);
     601            mr_asprintf(tmp, "%s/NETFS-SERVER-MOUNT", bkpinfo->tmpdir);
     602            write_one_liner_data_file(tmp, bkpinfo->netfs_mount);
     603            mr_free(tmp);
    597604        } else {
    598605            log_it("netfs_mount is NULL");
    599606            retval++;
    600             mr_asprintf(hostname, "");
    601         }
    602         colon = strchr(hostname, ':');
    603         if (!colon) {
    604             log_it("netfs mount doesn't have a colon in it");
    605             retval++;
    606         } else {
    607             struct hostent *hent;
    608 
    609             *colon = '\0';
    610             colon = strchr(hostname, '@');
    611             if (colon) {
    612                 *colon = '\0';
    613                 colon++;
    614                 hent = gethostbyname(colon);
    615                 mr_asprintf(bkpinfo->netfs_user,"%s", hostname);
    616             } else {
    617                 hent = gethostbyname(hostname);
    618             }
    619             if (!hent) {
    620                 log_it("Can't resolve Network mount (%s): %s", hostname, hstrerror(h_errno));
    621                 retval++;
    622             } else {
    623                 mr_asprintf(ip_address, "%s", inet_ntoa((struct in_addr) *((struct in_addr *) hent->h_addr)));
    624                 mr_strcat(ip_address, strchr(bkpinfo->netfs_mount, ':'));
    625                 mr_free(bkpinfo->netfs_mount);
    626                 bkpinfo->netfs_mount = ip_address;
    627             }
    628         }
    629         mr_free(hostname);
    630         store_netfs_config();
     607        }
    631608    }
    632609
     
    10281005/**
    10291006 * Retrieve the line containing @p label from the config file.
    1030  * @param config_file The file to read from, usually @c /tmp/mondo-restore.cfg.
     1007 * @param config_file The file to read from, usually @c /tmp/mondorestore.cfg.
    10311008 * @param label What to read from the file.
    10321009 * @param value Where to put it.
     
    12511228 * Write a line to a configuration file. Writes a line of the form,
    12521229 * @c label @c value.
    1253  * @param config_file The file to write to. Usually @c mondo-restore.cfg.
     1230 * @param config_file The file to write to. Usually @c mondorestore.cfg.
    12541231 * @param label What to call this bit of data you're writing.
    12551232 * @param value The bit of data you're writing.
Note: See TracChangeset for help on using the changeset viewer.