Ignore:
Timestamp:
Jan 25, 2011, 10:34:40 AM (13 years ago)
Author:
Bruno Cornec
Message:
  • Adds preliminary support for hpacucli. Needs test
  • Fix a compilation issue due to bad fatal_error call (no param allowed)
  • Fix some HTML syntax issues in the docs page + link to Wiki articles
  • Boot size pushed to 20MB
  • A bit more precise for error msg from PBDI
  • Exits if the protocol used is not recognized (error with -n fs:// typo)
  • Adds support for r8169 net driver
  • Fix a cast issue
  • Precise a test case to avoid ambiguity
  • Die and related functions placed before any other code as used early, and ash doesn't support function declaration. So will solve #446 by exiting mindi before doing anything weird in it.
  • Fix #445 with another technical solution to avoid vg with similar names to b wrongly excluded (vgroot and vgroot-san e.g.) (Michael Shapiro)
  • Fix a bug on exclusion of path with common content (/home and /path/home e.g.) which was handled correctly only in a certain order (John Pearson <johnp_at_gtagalenco.com.au>)
  • mount-media function is now placed in libmondo-devices.c as used by more programs.
  • Avoids calling mount_media when it's not mandatory (change the way mondorestore was working up to now but could solve some bugs reported)
  • Add xhci support to mindi.
  • Rewrite Xen kernel support to use TryToFindKernelPath systematically.
  • mindi now copies also the /lib/firmware content in order to have it for drivers needing it (bnx2 reported)
  • Push MAX_STR_LEN to 512 to allow supporting more exclude dir (2.2.10 and dyn allocation is the way to go there)
  • Add virtio driver to mindi
  • Initialize extra_cdrom_params in any case tp avoid passing null to cdrecord later on
  • Also escapes white spaces in gen_aux_list to avoid issues in getfacl call
  • Adds multiple missing drivers to mindi (mega_sr, ide_gd_mod, pata_jmicron, cp210x, dca, raid6_pq, xor async_tx, async_memcpy, async_xor)
  • Fix #434 by really testing thet udevd is not running already (chucky)
  • Adds support of pata_sil680 driver
  • Fix again #412 !! by removing calls to tee which voids the return value of the previous command
  • The way grub.unsupported was called for opensuse 11.2 was wrong. It should be done bfore calling grub-install which also exists. And tested for existence. Now this should fix #412.
  • Try to provide a workaround in code to the #401 (over-allocation of space due to rounding errors)
  • Fix a bug when using ACLs and file with spaces in their names by adding double quotes in getfacl invocation (Tom Mortell tomm_at_dslextreme.com). Also adding the same quotes on the touch commands made earlier.
  • Points to the current latest presentation instead of the old one
  • mondo-ref-card added to the docs web page
  • Add the mondoarchive reference card (Lester Wade)
  • Change useless comments for more useful ones
  • mindi is now able to handle compressed kernel with .gz or .bz2 suffix (case of OpenSuSE 11.2)
  • Improves logging for external binary
  • Improve Xen kernel detection and avoid false detection (Michael Shapiro)
  • Updated P2V doc from Lester Wade (lester.wade_at_hp.com)

Baclports from 2.2.9
svn merge -r 2650:2695 svn+ssh://bruno@svn.mondorescue.org/mondo/svn/mondorescue/branches/2.2.9 .

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mondo/src/common/libmondo-devices.c

    r2643 r2696  
    12711271
    12721272
     1273/**
     1274* Mount the CD-ROM or USB device at /mnt/cdrom.
     1275* @param bkpinfo The backup information structure. Fields used:
     1276* - @c bkpinfo->backup_media_type
     1277* - @c bkpinfo->disaster_recovery
     1278* - @c bkpinfo->isodir
     1279* - @c bkpinfo->media_device
     1280* @return 0 for success, nonzero for failure.
     1281*/
     1282int mount_media()
     1283{
     1284char *mount_cmd = NULL;
     1285int i, res;
     1286#ifdef __FreeBSD__
     1287    char mdd[32];
     1288    char *mddev = mdd;
     1289#endif
     1290
     1291    if (bkpinfo->backup_media_type == tape || bkpinfo->backup_media_type == udev) {
     1292        log_msg(8, "Tape/udev. Therefore, no need to mount a media.");
     1293        return 0;
     1294    }
     1295
     1296    if (!run_program_and_log_output("mount | grep -F " MNT_CDROM, FALSE)) {
     1297        log_msg(2, "mount_media() - media already mounted. Fair enough.");
     1298        return (0);
     1299    }
     1300
     1301    if (bkpinfo->media_device == NULL) {
     1302        fatal_error("No media device at that point");
     1303    }
     1304
     1305    if (bkpinfo->backup_media_type == netfs) {
     1306        log_msg(2, "Mounting for Network thingy");
     1307        log_msg(2, "isodir = %s", bkpinfo->isodir);
     1308        if (!strcmp(bkpinfo->isodir, "/") && am_I_in_disaster_recovery_mode()) {
     1309            mr_free(bkpinfo->isodir);
     1310            mr_asprintf(bkpinfo->isodir, "/tmp/isodir");
     1311            log_msg(1, "isodir is being set to %s", bkpinfo->isodir);
     1312        }
     1313        if ((bkpinfo->isodir == NULL) || (bkpinfo->netfs_remote_dir == NULL) || (bkpinfo->prefix == NULL)) {
     1314            fatal_error("Unable to prepare the iso filename");
     1315        }
     1316#ifdef __FreeBSD__
     1317        mr_asprintf(mount_cmd, "/mnt/isodir/%s/%s/%s-%d.iso", bkpinfo->isodir,
     1318            bkpinfo->netfs_remote_dir, bkpinfo->prefix, g_current_media_number);
     1319        mddev = make_vn(mount_cmd);
     1320        mr_free(mount_cmd);
     1321
     1322        mr_asprintf(mount_cmd, "mount_cd9660 -r %s " MNT_CDROM, mddev);
     1323#else
     1324        mr_asprintf(mount_cmd, "mount %s/%s/%s-%d.iso -t iso9660 -o loop,ro %s", bkpinfo->isodir, bkpinfo->netfs_remote_dir, bkpinfo->prefix, g_current_media_number, MNT_CDROM);
     1325#endif
     1326
     1327    } else if (bkpinfo->backup_media_type == iso) {
     1328#ifdef __FreeBSD__
     1329        mr_sprintf(mount_cmd, "%s/%s-%d.iso", bkpinfo->isodir,
     1330            bkpinfo->prefix, g_current_media_number);
     1331        mddev = make_vn(mount_cmd);
     1332        mr_free(mount_cmd);
     1333
     1334        mr_asprintf(mount_cmd, "mount_cd9660 -r %s %s", mddev, MNT_CDROM);
     1335#else
     1336        mr_asprintf(mount_cmd, "mount %s/%s-%d.iso -t iso9660 -o loop,ro %s", bkpinfo->isodir, bkpinfo->prefix, g_current_media_number, MNT_CDROM);
     1337#endif
     1338    } else if (bkpinfo->backup_media_type == usb) {
     1339        mr_asprintf(mount_cmd, "mount -t vfat %s %s", bkpinfo->media_device, MNT_CDROM);
     1340    } else if (strstr(bkpinfo->media_device, "/dev/")) {
     1341#ifdef __FreeBSD__
     1342        mr_asprintf(mount_cmd, "mount_cd9660 -r %s %s", bkpinfo->media_device, MNT_CDROM);
     1343#else
     1344        mr_asprintf(mount_cmd, "mount %s -t iso9660 -o ro %s", bkpinfo->media_device, MNT_CDROM);
     1345#endif
     1346    } else {
     1347        mr_free(bkpinfo->media_device);
     1348        if (bkpinfo->disaster_recovery && does_file_exist("/tmp/CDROM-LIVES-HERE")) {
     1349            bkpinfo->media_device = last_line_of_file(MINDI_CACHE"/CDROM-LIVES-HERE");
     1350        } else {
     1351            bkpinfo->media_device = find_cdrom_device(TRUE);
     1352        }
     1353
     1354#ifdef __FreeBSD__
     1355        mr_asprintf(mount_cmd, "mount_cd9660 -r %s %s", bkpinfo->media_device, MNT_CDROM);
     1356#else
     1357        mr_asprintf(mount_cmd, "mount %s -t iso9660 -o ro %s", bkpinfo->media_device, MNT_CDROM);
     1358#endif
     1359    }
     1360
     1361    log_msg(2, "(mount_media) --- command = %s", mount_cmd);
     1362    for (i = 0; i < 2; i++) {
     1363        res = run_program_and_log_output(mount_cmd, FALSE);
     1364        if (!res) {
     1365            break;
     1366        } else {
     1367            log_msg(2, "Failed to mount device.");
     1368            sleep(5);
     1369            sync();
     1370        }
     1371    }
     1372    mr_free(mount_cmd);
     1373
     1374    if (res) {
     1375        log_msg(2, "Failed, despite %d attempts", i);
     1376    } else {
     1377        log_msg(2, "Mounted media drive OK");
     1378    }
     1379    return (res);
     1380}
     1381/**************************************************************************
     1382*END_MOUNT_CDROM                                                         *
     1383**************************************************************************/
    12731384
    12741385
     
    13161427        // BERLIOS --- I'm tempted to do something about this...
    13171428        // Why unmount and remount again and again?
    1318         log_msg(3, "Remounting CD");
    13191429        g_ISO_restore_mode = TRUE;
    1320         if (is_this_device_mounted(MNT_CDROM)) {
    1321             run_program_and_log_output("umount " MNT_CDROM, 5);
    1322         }
    1323         mr_asprintf(tmp, "mkdir -p %s/isodir &> /dev/null", bkpinfo->tmpdir);
    1324         (void)system(tmp);
    1325         mr_free(tmp);
    1326 
    1327         if (((bkpinfo->isodir == NULL) && (bkpinfo->netfs_remote_dir == NULL)) || (bkpinfo->prefix == NULL)) {
    1328             fatal_error("Unable to prepare ISO file name. Please report to dev team");
    1329         }
    1330         if (bkpinfo->netfs_remote_dir) {
    1331             // NETFS
    1332             mr_asprintf(tmp, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->netfs_remote_dir, bkpinfo->prefix, cd_number_i_want);
    1333         } else {
    1334             // ISO
    1335             mr_asprintf(tmp, "%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->prefix, cd_number_i_want);
    1336         }
    1337         if (!does_file_exist(tmp)) {
    1338             mr_free(tmp);
    1339             if (bkpinfo->netfs_remote_dir) {
    1340                 // NETFS
    1341                 mr_asprintf(tmp, "%s/isodir/%s/%s-%d.iso", bkpinfo->tmpdir, bkpinfo->netfs_remote_dir, bkpinfo->prefix, cd_number_i_want);
    1342             } else {
    1343                 // ISO
    1344                 mr_asprintf(tmp, "%s/isodir/%s-%d.iso", bkpinfo->tmpdir, bkpinfo->prefix, cd_number_i_want);
    1345             }
    1346             if (does_file_exist(tmp)) {
    1347                 log_msg(1, "FIXME - hacking bkpinfo->isodir from '%s' to %s/isodir", bkpinfo->isodir, bkpinfo->tmpdir);
    1348                 mr_free(bkpinfo->isodir);
    1349                 mr_asprintf(bkpinfo->isodir, "%s/isodir", bkpinfo->tmpdir);
    1350             }
    1351         }
    1352         log_msg(3, "Mounting %s at %s", tmp, MNT_CDROM);
    1353         if (mount_CDROM_here(tmp, MNT_CDROM)) {
    1354             mr_free(tmp);
    1355             fatal_error("Mommy!");
    1356         }
    1357         mr_free(tmp);
     1430        if (!is_this_device_mounted(MNT_CDROM)) {
     1431            log_msg(3, "Mounting media");
     1432            g_current_media_number = cd_number_i_want;
     1433            mount_media();
     1434        }
    13581435    }
    13591436    if ((res = what_number_cd_is_this()) != cd_number_i_want) {
     
    19472024    case -1:
    19482025        /* we need to add a space after token to be sure our strstr test works correctly */
    1949         mr_asprintf(tmp1,"%s ",token);
     2026        mr_asprintf(tmp1," %s ",token);
    19502027        if (mode == 'E') {
    19512028            /*  Add the token if not already in the list */
    1952             mr_asprintf(tmp,"%s ",bkpinfo->exclude_paths);
     2029            mr_asprintf(tmp," %s ",bkpinfo->exclude_paths);
    19532030            if (strstr(tmp,tmp1) == NULL) {
    1954                 mr_strcat(bkpinfo->exclude_paths, " %s", tmp1);
     2031                mr_strcat(bkpinfo->exclude_paths, "%s", tmp1);
    19552032            }
    19562033        } else {
    19572034            /*  Add the token if not already in the list */
    1958             mr_asprintf(tmp,"%s ",bkpinfo->include_paths);
     2035            mr_asprintf(tmp," %s ",bkpinfo->include_paths);
    19592036            if (strstr(tmp,tmp1) == NULL) {
    1960                 mr_strcat(bkpinfo->include_paths, " %s", tmp1);
     2037                mr_strcat(bkpinfo->include_paths, "%s", tmp1);
    19612038            }
    19622039        }
Note: See TracChangeset for help on using the changeset viewer.