Ignore:
Timestamp:
Dec 18, 2007, 12:11:26 AM (16 years ago)
Author:
Bruno Cornec
Message:
  • Format (tabs) improvements
  • Fix for #223 floppy detection improvement (Based on LazarusLong patch proposal)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.5/mondo/src/mondorestore/mondo-rstr-tools.c

    r1785 r1843  
    125125
    126126#include <pthread.h>
     127#include <fd.h>
    127128#include "../common/my-stuff.h"
    128129#include "../common/mondostructures.h"
     
    529530
    530531/**
    531 * Mount @p device at @p mpt as @p format.
    532 * @param device The device (/dev entry) to mount.
    533 * @param mpt The directory to mount it on.
    534 * @param format The filesystem type of @p device.
    535 * @param writeable If TRUE, mount read-write; if FALSE, mount read-only.
    536 * @return 0 for success, nonzero for failure.
    537 */
     532 * Mount @p device at @p mpt as @p format.
     533 * @param device The device (/dev entry) to mount.
     534 * @param mpt The directory to mount it on.
     535 * @param format The filesystem type of @p device.
     536 * @param writeable If TRUE, mount read-write; if FALSE, mount read-only.
     537 * @return 0 for success, nonzero for failure.
     538 */
    538539int mount_device(char *device, char *mpt, char *format, bool writeable)
    539540{
     
    552553malloc_string(additional_parameters);
    553554
    554 if (!strcmp(mpt, "/1")) {
    555     strcpy(mountpoint, "/");
    556     log_msg(3, "Mommm! SME is being a dildo!");
    557 } else {
    558     strcpy(mountpoint, mpt);
    559 }
    560 
    561 if (!strcmp(mountpoint, "lvm")) {
    562     return (0);
    563 }
    564 if (!strcmp(mountpoint, "image")) {
    565     return (0);
    566 }
    567 sprintf(tmp, "Mounting device %s   ", device);
    568 log_msg(1, tmp);
    569 if (writeable) {
    570     strcpy(additional_parameters, "-o rw");
    571 } else {
    572     strcpy(additional_parameters, "-o ro");
    573 }
    574 if (find_home_of_exe("setfattr")) {
    575     strcat(additional_parameters, ",user_xattr");
    576 }
    577 if (find_home_of_exe("setfacl")) {
    578     strcat(additional_parameters, ",acl");
    579 }
    580 
    581 if (!strcmp(mountpoint, "swap")) {
    582     sprintf(command, "swapon %s", device);
    583 } else {
    584 if (!strcmp(mountpoint, "/")) {
    585     strcpy(mountdir, MNT_RESTORING);
    586 } else {
    587     sprintf(mountdir, "%s%s", MNT_RESTORING, mountpoint);
    588 }
    589 sprintf(command, "mkdir -p %s", mountdir);
    590 run_program_and_log_output(command, FALSE);
    591 sprintf(command, "mount -t %s %s %s %s 2>> %s", format, device,
    592         additional_parameters, mountdir, MONDO_LOGFILE);
    593 log_msg(2, "command='%s'", command);
    594 }
    595 res = run_program_and_log_output(command, TRUE);
    596 if (res && (strstr(command, "xattr") || strstr(command, "acl"))) {
    597     log_msg(1, "Re-trying without the fancy extra parameters");
    598     sprintf(command, "mount -t %s %s %s 2>> %s", format, device,
    599         mountdir, MONDO_LOGFILE);
     555    if (!strcmp(mpt, "/1")) {
     556        strcpy(mountpoint, "/");
     557        log_msg(3, "Mommm! SME is being a dildo!");
     558    } else {
     559        strcpy(mountpoint, mpt);
     560    }
     561
     562    if (!strcmp(mountpoint, "lvm")) {
     563        return (0);
     564    }
     565    if (!strcmp(mountpoint, "image")) {
     566        return (0);
     567    }
     568    sprintf(tmp, "Mounting device %s   ", device);
     569    log_msg(1, tmp);
     570    if (writeable) {
     571        strcpy(additional_parameters, "-o rw");
     572    } else {
     573        strcpy(additional_parameters, "-o ro");
     574    }
     575    if (find_home_of_exe("setfattr")) {
     576        strcat(additional_parameters, ",user_xattr");
     577    }
     578    if (find_home_of_exe("setfacl")) {
     579        strcat(additional_parameters, ",acl");
     580    }
     581
     582    if (!strcmp(mountpoint, "swap")) {
     583        sprintf(command, "swapon %s", device);
     584    } else {
     585        if (!strcmp(mountpoint, "/")) {
     586            strcpy(mountdir, MNT_RESTORING);
     587        } else {
     588            sprintf(mountdir, "%s%s", MNT_RESTORING, mountpoint);
     589        }
     590        sprintf(command, "mkdir -p %s", mountdir);
     591        run_program_and_log_output(command, FALSE);
     592        sprintf(command, "mount -t %s %s %s %s 2>> %s", format, device,
     593                additional_parameters, mountdir, MONDO_LOGFILE);
     594        log_msg(2, "command='%s'", command);
     595    }
     596
    600597    res = run_program_and_log_output(command, TRUE);
    601 }
    602 if (res) {
    603     log_msg(1, "Unable to mount device %s (type %s) at %s", device,
    604         format, mountdir);
    605     log_msg(1, "command was '%s'", command);
    606     if (!strcmp(mountpoint, "swap")) {
    607         log_to_screen(tmp);
    608     } else {
    609         log_msg(2, "Retrying w/o the '-t' switch");
    610         sprintf(command, "mount %s %s 2>> %s", device, mountdir,
    611             MONDO_LOGFILE);
    612         log_msg(2, "2nd command = '%s'", command);
     598    if (res && (strstr(command, "xattr") || strstr(command, "acl"))) {
     599        log_msg(1, "Re-trying without the fancy extra parameters");
     600        sprintf(command, "mount -t %s %s %s 2>> %s", format, device,
     601            mountdir, MONDO_LOGFILE);
    613602        res = run_program_and_log_output(command, TRUE);
    614         if (res == 0) {
    615             log_msg(1,
    616                 "That's OK. I called mount w/o a filesystem type and it worked fine in the end.");
     603    }
     604    if (res) {
     605        log_msg(1, "Unable to mount device %s (type %s) at %s", device,
     606                format, mountdir);
     607        log_msg(1, "command was '%s'", command);
     608        if (!strcmp(mountpoint, "swap")) {
     609            log_to_screen(tmp);
    617610        } else {
    618             log_to_screen(tmp);
    619         }
    620     }
    621 }
    622 if (res && !strcmp(mountpoint, "swap")) {
    623     log_msg(2, "That's ok. It's just a swap partition.");
    624     log_msg(2, "Non-fatal error. Returning 0.");
    625     res = 0;
    626 }
     611            log_msg(2, "Retrying w/o the '-t' switch");
     612            sprintf(command, "mount %s %s 2>> %s", device, mountdir,
     613                MONDO_LOGFILE);
     614            log_msg(2, "2nd command = '%s'", command);
     615            res = run_program_and_log_output(command, TRUE);
     616            if (res == 0) {
     617                log_msg(1,
     618                    "That's OK. I called mount w/o a filesystem type and it worked fine in the end.");
     619            } else {
     620                log_to_screen(tmp);
     621            }
     622        }
     623    }
     624
     625    if (res && !strcmp(mountpoint, "swap")) {
     626        log_msg(2, "That's ok. It's just a swap partition.");
     627        log_msg(2, "Non-fatal error. Returning 0.");
     628        res = 0;
     629    }
    627630
    628631paranoid_free(tmp);
     
    632635paranoid_free(additional_parameters);
    633636
    634 return (res);
    635 }
    636 
     637    return (res);
     638}
    637639/**************************************************************************
    638 *END_MOUNT_DEVICE                                                        *
     640 *END_MOUNT_DEVICE                                                        *
    639641**************************************************************************/
    640642
    641643
    642644/**
    643 * Mount all devices in @p p_external_copy_of_mountlist on @p MNT_RESTORING.
    644 * @param p_external_copy_of_mountlist The mountlist containing devices to be mounted.
    645 * @param writeable If TRUE, then mount read-write; if FALSE mount read-only.
    646 * @return The number of errors encountered (0 for success).
    647 */
     645 * Mount all devices in @p p_external_copy_of_mountlist on @p MNT_RESTORING.
     646 * @param p_external_copy_of_mountlist The mountlist containing devices to be mounted.
     647 * @param writeable If TRUE, then mount read-write; if FALSE mount read-only.
     648 * @return The number of errors encountered (0 for success).
     649 */
    648650int mount_all_devices(struct mountlist_itself
    649               *p_external_copy_of_mountlist, bool writeable)
     651                      *p_external_copy_of_mountlist, bool writeable)
    650652{
    651653int retval = 0, lino, res;
    652654char *tmp, *these_failed, *format;
    653 struct mountlist_itself *mountlist;
     655    struct mountlist_itself *mountlist = NULL;
    654656
    655657malloc_string(tmp);
    656658malloc_string(format);
    657659malloc_string(these_failed);
     660/** menset **/
     661these_failed[0] = '\0';
     662
    658663assert(p_external_copy_of_mountlist != NULL);
    659664mountlist = malloc(sizeof(struct mountlist_itself));
    660665memcpy((void *) mountlist, (void *) p_external_copy_of_mountlist,
    661666   sizeof(struct mountlist_itself));
    662 sort_mountlist_by_mountpoint(mountlist, 0);
    663 
    664 /** menset **/
    665 these_failed[0] = '\0';
    666 
    667 mvaddstr_and_log_it(g_currentY, 0, "Mounting devices         ");
    668 open_progress_form("Mounting devices",
     667    sort_mountlist_by_mountpoint(mountlist, 0);
     668
     669
     670    mvaddstr_and_log_it(g_currentY, 0, "Mounting devices         ");
     671    open_progress_form("Mounting devices",
    669672               "I am now mounting all the drives.",
    670673               "This should not take long.",
    671674               "", mountlist->entries);
    672675
    673 for (lino = 0; lino < mountlist->entries; lino++) {
    674 if (!strcmp(mountlist->el[lino].device, "/proc")) {
    675     log_msg(1,
    676             "Again with the /proc - why is this in your mountlist?");
    677 } else if (is_this_device_mounted(mountlist->el[lino].device)) {
    678     sprintf(tmp, "%s is already mounted",
    679             mountlist->el[lino].device);
    680     log_to_screen(tmp);
    681 } else if (strcmp(mountlist->el[lino].mountpoint, "none")
     676    for (lino = 0; lino < mountlist->entries; lino++) {
     677        if (!strcmp(mountlist->el[lino].device, "/proc")) {
     678            log_msg(1,
     679                "Again with the /proc - why is this in your mountlist?");
     680        } else if (is_this_device_mounted(mountlist->el[lino].device)) {
     681            sprintf(tmp, "%s is already mounted",
     682                mountlist->el[lino].device);
     683            log_to_screen(tmp);
     684        } else if (strcmp(mountlist->el[lino].mountpoint, "none")
    682685           && strcmp(mountlist->el[lino].mountpoint, "lvm")
    683686           && strcmp(mountlist->el[lino].mountpoint, "raid")
    684687           && strcmp(mountlist->el[lino].mountpoint, "image")) {
    685     sprintf(tmp, "Mounting %s", mountlist->el[lino].device);
    686     update_progress_form(tmp);
    687     strcpy(format, mountlist->el[lino].format);
    688     /* BERLIOS: removed as it doen't make sens to not mount ext3 partitions as ext3
    689     if (!strcmp(format, "ext3")) {
    690         strcpy(format, "ext2");
    691     }
    692     */
    693     res = mount_device(mountlist->el[lino].device,
     688            sprintf(tmp, "Mounting %s", mountlist->el[lino].device);
     689            update_progress_form(tmp);
     690            strcpy(format, mountlist->el[lino].format);
     691            /* BERLIOS: removed as it doen't make sens to not mount ext3 partitions as ext3
     692            if (!strcmp(format, "ext3")) {
     693                strcpy(format, "ext2");
     694            }
     695            */
     696            res = mount_device(mountlist->el[lino].device,
    694697                       mountlist->el[lino].mountpoint,
    695698                       format, writeable);
    696     retval += res;
    697     if (res) {
    698         strcat(these_failed, mountlist->el[lino].device);
    699         strcat(these_failed, " ");
    700     }
    701 }
    702 g_current_progress++;
    703 }
    704 close_progress_form();
    705 if (retval) {
    706 if (g_partition_table_locked_up > 0) {
    707     log_to_screen
    708         ("fdisk's ictol() call to refresh its copy of the partition table causes the kernel to");
    709     log_to_screen
    710         ("lock up the partition table. You might have to reboot and use Interactive Mode to");
    711     log_to_screen
    712         ("format and restore *without* partitioning first. Sorry for the inconvenience.");
    713 }
    714 sprintf(tmp, "Could not mount device(s) %s- shall I abort?",
    715         these_failed);
    716 if (!ask_me_yes_or_no(tmp)) {
    717     retval = 0;
    718     log_to_screen
    719         ("Continuing, although some device(s) failed to be mounted");
    720     mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    721 } else {
    722     mvaddstr_and_log_it(g_currentY++, 74, "Failed.");
    723     log_to_screen
     699            retval += res;
     700            if (res) {
     701                strcat(these_failed, mountlist->el[lino].device);
     702                strcat(these_failed, " ");
     703            }
     704        }
     705        g_current_progress++;
     706    }
     707    close_progress_form();
     708    if (retval) {
     709        if (g_partition_table_locked_up > 0) {
     710            log_to_screen
     711                ("fdisk's ictol() call to refresh its copy of the partition table causes the kernel to");
     712            log_to_screen
     713                ("lock up the partition table. You might have to reboot and use Interactive Mode to");
     714            log_to_screen
     715                ("format and restore *without* partitioning first. Sorry for the inconvenience.");
     716        }
     717        sprintf(tmp, "Could not mount device(s) %s- shall I abort?",
     718                these_failed);
     719
     720        if (!ask_me_yes_or_no(tmp)) {
     721            retval = 0;
     722            log_to_screen
     723                ("Continuing, although some device(s) failed to be mounted");
     724            mvaddstr_and_log_it(g_currentY++, 74, "Done.");
     725        } else {
     726            mvaddstr_and_log_it(g_currentY++, 74, "Failed.");
     727            log_to_screen
    724728        ("Unable to mount some or all of your partitions.");
    725 }
    726 } else {
    727 log_to_screen("All partitions were mounted OK.");
    728 mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    729 }
    730 run_program_and_log_output("df -m", 3);
    731 paranoid_free(mountlist);
    732 paranoid_free(tmp);
    733 paranoid_free(format);
    734 paranoid_free(these_failed);
    735 return (retval);
    736 }
    737 
     729        }
     730    } else {
     731        log_to_screen("All partitions were mounted OK.");
     732        mvaddstr_and_log_it(g_currentY++, 74, "Done.");
     733    }
     734    run_program_and_log_output("df -m", 3);
     735    paranoid_free(mountlist);
     736    paranoid_free(tmp);
     737    paranoid_free(format);
     738    paranoid_free(these_failed);
     739    return (retval);
     740}
    738741/**************************************************************************
    739742*END_MOUNT_ALL_DEVICES                                                   *
     
    762765assert(bkpinfo != NULL);
    763766
    764 if (bkpinfo->backup_media_type == tape
    765     || bkpinfo->backup_media_type == udev) {
    766     log_msg(8, "Tape/udev. Therefore, no need to mount a media.");
    767     paranoid_free(mount_cmd);
    768     return 0;
    769 }
    770 
    771 if (!run_program_and_log_output("mount | grep -F " MNT_CDROM, FALSE)) {
    772     log_msg(2, "mount_media() - media already mounted. Fair enough.");
    773     paranoid_free(mount_cmd);
    774     return (0);
    775 }
    776 
    777 if (bkpinfo->backup_media_type == nfs) {
    778     log_msg(2, "Mounting for NFS thingy");
    779     log_msg(2, "isodir = %s", bkpinfo->isodir);
    780     if ((!bkpinfo->isodir[0] || !strcmp(bkpinfo->isodir, "/"))
    781         && am_I_in_disaster_recovery_mode()) {
    782         strcpy(bkpinfo->isodir, "/tmp/isodir");
    783         log_msg(1, "isodir is being set to %s", bkpinfo->isodir);
    784     }
     767    if (bkpinfo->backup_media_type == tape
     768        || bkpinfo->backup_media_type == udev) {
     769        log_msg(8, "Tape/udev. Therefore, no need to mount a media.");
     770        paranoid_free(mount_cmd);
     771        return 0;
     772    }
     773
     774    if (!run_program_and_log_output("mount | grep -F " MNT_CDROM, FALSE)) {
     775        log_msg(2, "mount_media() - media already mounted. Fair enough.");
     776        paranoid_free(mount_cmd);
     777        return (0);
     778    }
     779
     780    if (bkpinfo->backup_media_type == nfs) {
     781        log_msg(2, "Mounting for NFS thingy");
     782        log_msg(2, "isodir = %s", bkpinfo->isodir);
     783        if ((!bkpinfo->isodir[0] || !strcmp(bkpinfo->isodir, "/"))
     784            && am_I_in_disaster_recovery_mode()) {
     785            strcpy(bkpinfo->isodir, "/tmp/isodir");
     786            log_msg(1, "isodir is being set to %s", bkpinfo->isodir);
     787        }
    785788#ifdef __FreeBSD__
    786     sprintf(mount_cmd, "/mnt/isodir/%s/%s/%s-%d.iso", bkpinfo->isodir,
    787         bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);
    788     mddev = make_vn(mount_cmd);
    789     sprintf(mount_cmd, "mount_cd9660 -r %s " MNT_CDROM, mddev);
     789        sprintf(mount_cmd, "/mnt/isodir/%s/%s/%s-%d.iso", bkpinfo->isodir,
     790            bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);
     791        mddev = make_vn(mount_cmd);
     792        sprintf(mount_cmd, "mount_cd9660 -r %s " MNT_CDROM, mddev);
    790793#else
    791     sprintf(mount_cmd, "mount %s/%s/%s-%d.iso -t iso9660 -o loop,ro %s",
    792         bkpinfo->isodir, bkpinfo->nfs_remote_dir,
    793         bkpinfo->prefix, g_current_media_number, MNT_CDROM);
     794        sprintf(mount_cmd, "mount %s/%s/%s-%d.iso -t iso9660 -o loop,ro %s",
     795            bkpinfo->isodir, bkpinfo->nfs_remote_dir,
     796            bkpinfo->prefix, g_current_media_number, MNT_CDROM);
    794797#endif
    795798
    796 } else if (bkpinfo->backup_media_type == iso) {
     799    } else if (bkpinfo->backup_media_type == iso) {
    797800#ifdef __FreeBSD__
    798     sprintf(mount_cmd, "%s/%s-%d.iso", bkpinfo->isodir,
    799         bkpinfo->prefix, g_current_media_number);
    800     mddev = make_vn(mount_cmd);
    801     sprintf(mount_cmd, "mount_cd9660 -r %s %s", mddev, MNT_CDROM);
     801        sprintf(mount_cmd, "%s/%s-%d.iso", bkpinfo->isodir,
     802            bkpinfo->prefix, g_current_media_number);
     803        mddev = make_vn(mount_cmd);
     804        sprintf(mount_cmd, "mount_cd9660 -r %s %s", mddev, MNT_CDROM);
    802805#else
    803     sprintf(mount_cmd, "mount %s/%s-%d.iso -t iso9660 -o loop,ro %s",
    804         bkpinfo->isodir, bkpinfo->prefix, g_current_media_number, MNT_CDROM);
     806        sprintf(mount_cmd, "mount %s/%s-%d.iso -t iso9660 -o loop,ro %s",
     807            bkpinfo->isodir, bkpinfo->prefix, g_current_media_number, MNT_CDROM);
    805808#endif
    806 } else if (bkpinfo->backup_media_type == usb) {
     809    } else if (bkpinfo->backup_media_type == usb) {
    807810        sprintf(mount_cmd, "mount -t vfat %s %s", bkpinfo->media_device, MNT_CDROM);
    808 } else if (strstr(bkpinfo->media_device, "/dev/")) {
     811    } else if (strstr(bkpinfo->media_device, "/dev/")) {
    809812#ifdef __FreeBSD__
    810813        sprintf(mount_cmd, "mount_cd9660 -r %s %s", bkpinfo->media_device,
     
    814817        bkpinfo->media_device, MNT_CDROM);
    815818#endif
    816 } else {
    817     if (bkpinfo->disaster_recovery
    818         && does_file_exist("/tmp/CDROM-LIVES-HERE")) {
    819         strcpy(bkpinfo->media_device,
    820             last_line_of_file("/tmp/CDROM-LIVES-HERE"));
    821819    } else {
    822         find_cdrom_device(bkpinfo->media_device, TRUE);
    823     }
     820        if (bkpinfo->disaster_recovery
     821            && does_file_exist("/tmp/CDROM-LIVES-HERE")) {
     822            strcpy(bkpinfo->media_device,
     823                last_line_of_file("/tmp/CDROM-LIVES-HERE"));
     824        } else {
     825            find_cdrom_device(bkpinfo->media_device, TRUE);
     826        }
    824827
    825828#ifdef __FreeBSD__
     
    830833        bkpinfo->media_device, MNT_CDROM);
    831834#endif
    832 }
    833 
    834 log_msg(2, "(mount_media) --- command = %s", mount_cmd);
    835 for (i = 0; i < 2; i++) {
    836 res = run_program_and_log_output(mount_cmd, FALSE);
    837 if (!res) {
    838     break;
    839 } else {
    840     log_msg(2, "Failed to mount device.");
    841     sleep(5);
    842     run_program_and_log_output("sync", FALSE);
    843 }
    844 }
    845 if (res) {
    846     log_msg(2, "Failed, despite %d attempts", i);
    847 } else {
    848     log_msg(2, "Mounted CD-ROM drive OK");
    849 }
    850 paranoid_free(mount_cmd);
    851 return (res);
    852 }
    853 
    854 
    855 
    856 
    857 
     835    }
     836
     837    log_msg(2, "(mount_media) --- command = %s", mount_cmd);
     838    for (i = 0; i < 2; i++) {
     839        res = run_program_and_log_output(mount_cmd, FALSE);
     840        if (!res) {
     841            break;
     842        } else {
     843            log_msg(2, "Failed to mount device.");
     844            sleep(5);
     845            run_program_and_log_output("sync", FALSE);
     846        }
     847    }
     848
     849    if (res) {
     850        log_msg(2, "Failed, despite %d attempts", i);
     851    } else {
     852        log_msg(2, "Mounted media drive OK");
     853    }
     854    paranoid_free(mount_cmd);
     855    return (res);
     856}
    858857/**************************************************************************
    859858*END_MOUNT_CDROM                                                         *
     
    12461245
    12471246/**
    1248 * Allow the user to edit the filelist and biggielist.
    1249 * The filelist is unlinked after it is read.
    1250 * @param bkpinfo The backup information structure. Fields used:
    1251 * - @c bkpinfo->backup_media_type
    1252 * - @c bkpinfo->isodir
    1253 * - @c bkpinfo->media_device
    1254 * - @c bkpinfo->tmpdir
    1255 * @return The filelist structure containing the information read from disk.
    1256 */
     1247 * Allow the user to edit the filelist and biggielist.
     1248 * The filelist is unlinked after it is read.
     1249 * @param bkpinfo The backup information structure. Fields used:
     1250 * - @c bkpinfo->backup_media_type
     1251 * - @c bkpinfo->isodir
     1252 * - @c bkpinfo->media_device
     1253 * - @c bkpinfo->tmpdir
     1254 * @return The filelist structure containing the information read from disk.
     1255 */
    12571256struct
    12581257s_node *process_filelist_and_biggielist()
     
    23112310    char *ramdisk_fname;
    23122311    char *mountlist_file;
    2313     int res;
     2312    int res = 0;
     2313    int fd = 0;
     2314    struct floppy_struct fdprms;
    23142315
    23152316    bool try_plan_B;
     
    23532354
    23542355    /* Is there a floppy drive detected */
    2355     sprintf(tmp, "%s", call_program_and_get_last_line_of_output("dmesg | grep -i floppy"));
    2356     if (strcmp(tmp, "")) {
    2357         sprintf(command, "mount /dev/fd0u1722 %s", mountpt);
    2358         sprintf(tmp,
    2359             "(sleep 15; kill `ps | grep \"%s\" | cut -d' ' -f1` 2> /dev/null) &",
    2360             command);
    2361         log_msg(1, "tmp = '%s'", tmp);
    2362         system(tmp);
    2363         res = run_program_and_log_output(command, FALSE);
    2364         if (res) {
    2365             sprintf(command, "mount /dev/fd0H1440 %s", mountpt);
     2356    fd = open("/dev/fd0u1722", O_RDONLY);
     2357    if (fd > 0) {
     2358        // open OK
     2359        res = ioctl(fd, FDGETPRM, &fdprms);
     2360        if (res >= 0) {
     2361            // media OK to mount
     2362            sprintf(command, "mount /dev/fd0u1722 %s", mountpt);
    23662363            res = run_program_and_log_output(command, FALSE);
    2367         }
    2368     } else {
    2369         res = 1;
     2364        } else {
     2365            //skip mount
     2366            res = 1;
     2367        }
     2368    } else {
     2369        fd = open("/dev/fd0H1440", O_RDONLY);
     2370        if (fd > 0) {
     2371            // open OK
     2372            res = ioctl(fd, FDGETPRM, &fdprms);
     2373            if (res >= 0) {
     2374                // media OK to mount
     2375                sprintf(command, "mount /dev/fd0H1440 %s", mountpt);
     2376                res = run_program_and_log_output(command, FALSE);
     2377            } else {
     2378                //skip mount
     2379                res = 1;
     2380            }
     2381        }
    23702382    }
    23712383    if (res) {
Note: See TracChangeset for help on using the changeset viewer.