Changeset 1771 in MondoRescue for branches/2.2.5


Ignore:
Timestamp:
Nov 6, 2007, 9:13:46 PM (16 years ago)
Author:
Bruno Cornec
Message:

Use RESTORE consistently across mondo to restore without interaction (report from Takeshi Shoji t.shoji_at_tripodw.jp)

Location:
branches/2.2.5
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.5/mindi/isolinux-H.cfg

    r30 r1771  
    55label RESTORE
    66  kernel vmlinuz
    7   append initrd=initrd.img load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=24000 rw root=/dev/ram nuke restore
     7  append initrd=initrd.img load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=24000 rw root=/dev/ram nuke RESTORE
    88label expert
    99  kernel vmlinuz
  • branches/2.2.5/mindi/mindi-bkphw

    r1764 r1771  
    5353        if ($tool =~ /\/conrep$/) {
    5454            $ret = system("(cd $tooldir ; $tool -s -f$bkpdir/conrep.dat)");
    55             print SCRIPT "(cd $tooldir ; $tool -s -f$bkpdir/conrep.dat)");
     55            print SCRIPT "(cd $tooldir ; $tool -l -f$bkpdir/conrep.dat)");
    5656            print TOOLS "$tool.xml\n";
    5757        }
    5858        if ($tool =~ /\/cpqacuxe$/) {
    5959            $ret = system("$tool -c $bkpdir/cpqacuxe.dat");
    60             print SCRIPT "$tool -r $bkpdir/cpqacuxe.dat");
     60            print SCRIPT "$tool -i $bkpdir/cpqacuxe.dat)");
    6161            print TOOLS "$tooldir/bld\n";
    6262        }
  • branches/2.2.5/mondo/src/mondorestore/mondo-rstr-tools.c

    r1746 r1771  
    525525/**************************************************************************
    526526*END_KILL_PETRIS                                                         *
     527**************************************************************************/
     528
     529
     530/**
     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*/
     538int mount_device(char *device, char *mpt, char *format, bool writeable)
     539{
     540int res = 0;
     541
     542/** malloc **/
     543char *tmp, *command, *mountdir, *mountpoint, *additional_parameters;
     544
     545assert_string_is_neither_NULL_nor_zerolength(device);
     546assert_string_is_neither_NULL_nor_zerolength(mpt);
     547assert(format != NULL);
     548malloc_string(tmp);
     549malloc_string(command);
     550malloc_string(mountdir);
     551malloc_string(mountpoint);
     552malloc_string(additional_parameters);
     553
     554if (!strcmp(mpt, "/1")) {
     555    strcpy(mountpoint, "/");
     556    log_msg(3, "Mommm! SME is being a dildo!");
     557} else {
     558    strcpy(mountpoint, mpt);
     559}
     560
     561if (!strcmp(mountpoint, "lvm")) {
     562    return (0);
     563}
     564if (!strcmp(mountpoint, "image")) {
     565    return (0);
     566}
     567sprintf(tmp, "Mounting device %s   ", device);
     568log_msg(1, tmp);
     569if (writeable) {
     570    strcpy(additional_parameters, "-o rw");
     571} else {
     572    strcpy(additional_parameters, "-o ro");
     573}
     574if (find_home_of_exe("setfattr")) {
     575    strcat(additional_parameters, ",user_xattr");
     576}
     577if (find_home_of_exe("setfacl")) {
     578    strcat(additional_parameters, ",acl");
     579}
     580
     581if (!strcmp(mountpoint, "swap")) {
     582    sprintf(command, "swapon %s", device);
     583} else {
     584if (!strcmp(mountpoint, "/")) {
     585    strcpy(mountdir, MNT_RESTORING);
     586} else {
     587    sprintf(mountdir, "%s%s", MNT_RESTORING, mountpoint);
     588}
     589sprintf(command, "mkdir -p %s", mountdir);
     590run_program_and_log_output(command, FALSE);
     591sprintf(command, "mount -t %s %s %s %s 2>> %s", format, device,
     592        additional_parameters, mountdir, MONDO_LOGFILE);
     593log_msg(2, "command='%s'", command);
     594}
     595res = run_program_and_log_output(command, TRUE);
     596if (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);
     600    res = run_program_and_log_output(command, TRUE);
     601}
     602if (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);
     613        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.");
     617        } else {
     618            log_to_screen(tmp);
     619        }
     620    }
     621}
     622if (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}
     627
     628paranoid_free(tmp);
     629paranoid_free(command);
     630paranoid_free(mountdir);
     631paranoid_free(mountpoint);
     632paranoid_free(additional_parameters);
     633
     634return (res);
     635}
     636
     637/**************************************************************************
     638*END_MOUNT_DEVICE                                                        *
    527639**************************************************************************/
    528640
     
    747859/**************************************************************************
    748860*END_MOUNT_CDROM                                                         *
    749 **************************************************************************/
    750 
    751 
    752 /**
    753 * Mount @p device at @p mpt as @p format.
    754 * @param device The device (/dev entry) to mount.
    755 * @param mpt The directory to mount it on.
    756 * @param format The filesystem type of @p device.
    757 * @param writeable If TRUE, mount read-write; if FALSE, mount read-only.
    758 * @return 0 for success, nonzero for failure.
    759 */
    760 int mount_device(char *device, char *mpt, char *format, bool writeable)
    761 {
    762 int res = 0;
    763 
    764 /** malloc **/
    765 char *tmp, *command, *mountdir, *mountpoint, *additional_parameters;
    766 
    767 assert_string_is_neither_NULL_nor_zerolength(device);
    768 assert_string_is_neither_NULL_nor_zerolength(mpt);
    769 assert(format != NULL);
    770 malloc_string(tmp);
    771 malloc_string(command);
    772 malloc_string(mountdir);
    773 malloc_string(mountpoint);
    774 malloc_string(additional_parameters);
    775 
    776 if (!strcmp(mpt, "/1")) {
    777     strcpy(mountpoint, "/");
    778     log_msg(3, "Mommm! SME is being a dildo!");
    779 } else {
    780     strcpy(mountpoint, mpt);
    781 }
    782 
    783 if (!strcmp(mountpoint, "lvm")) {
    784     return (0);
    785 }
    786 if (!strcmp(mountpoint, "image")) {
    787     return (0);
    788 }
    789 sprintf(tmp, "Mounting device %s   ", device);
    790 log_msg(1, tmp);
    791 if (writeable) {
    792     strcpy(additional_parameters, "-o rw");
    793 } else {
    794     strcpy(additional_parameters, "-o ro");
    795 }
    796 if (find_home_of_exe("setfattr")) {
    797     strcat(additional_parameters, ",user_xattr");
    798 }
    799 if (find_home_of_exe("setfacl")) {
    800     strcat(additional_parameters, ",acl");
    801 }
    802 
    803 if (!strcmp(mountpoint, "swap")) {
    804     sprintf(command, "swapon %s", device);
    805 } else {
    806 if (!strcmp(mountpoint, "/")) {
    807     strcpy(mountdir, MNT_RESTORING);
    808 } else {
    809     sprintf(mountdir, "%s%s", MNT_RESTORING, mountpoint);
    810 }
    811 sprintf(command, "mkdir -p %s", mountdir);
    812 run_program_and_log_output(command, FALSE);
    813 sprintf(command, "mount -t %s %s %s %s 2>> %s", format, device,
    814         additional_parameters, mountdir, MONDO_LOGFILE);
    815 log_msg(2, "command='%s'", command);
    816 }
    817 res = run_program_and_log_output(command, TRUE);
    818 if (res && (strstr(command, "xattr") || strstr(command, "acl"))) {
    819     log_msg(1, "Re-trying without the fancy extra parameters");
    820     sprintf(command, "mount -t %s %s %s 2>> %s", format, device,
    821         mountdir, MONDO_LOGFILE);
    822     res = run_program_and_log_output(command, TRUE);
    823 }
    824 if (res) {
    825     log_msg(1, "Unable to mount device %s (type %s) at %s", device,
    826         format, mountdir);
    827     log_msg(1, "command was '%s'", command);
    828     if (!strcmp(mountpoint, "swap")) {
    829         log_to_screen(tmp);
    830     } else {
    831         log_msg(2, "Retrying w/o the '-t' switch");
    832         sprintf(command, "mount %s %s 2>> %s", device, mountdir,
    833             MONDO_LOGFILE);
    834         log_msg(2, "2nd command = '%s'", command);
    835         res = run_program_and_log_output(command, TRUE);
    836         if (res == 0) {
    837             log_msg(1,
    838                 "That's OK. I called mount w/o a filesystem type and it worked fine in the end.");
    839         } else {
    840             log_to_screen(tmp);
    841         }
    842     }
    843 }
    844 if (res && !strcmp(mountpoint, "swap")) {
    845     log_msg(2, "That's ok. It's just a swap partition.");
    846     log_msg(2, "Non-fatal error. Returning 0.");
    847     res = 0;
    848 }
    849 
    850 paranoid_free(tmp);
    851 paranoid_free(command);
    852 paranoid_free(mountdir);
    853 paranoid_free(mountpoint);
    854 paranoid_free(additional_parameters);
    855 
    856 return (res);
    857 }
    858 
    859 /**************************************************************************
    860 *END_MOUNT_DEVICE                                                        *
    861861**************************************************************************/
    862862
Note: See TracChangeset for help on using the changeset viewer.