Changeset 1451 in MondoRescue
- Timestamp:
- May 20, 2007, 10:53:34 PM (18 years ago)
- Location:
- branches/2.2.4/mondo/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.4/mondo/src/common/libmondo-devices.c
r1404 r1451 2801 2801 return ('G'); 2802 2802 } else { 2803 log_it("Unknown boot loader"); 2804 return ('U'); 2803 // We need to look on each partition then 2804 sprintf(list_drives_cmd, 2805 "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/"); 2806 log_it("list_drives_cmd = %s", list_drives_cmd); 2807 2808 if (!(pdrives = popen(list_drives_cmd, "r"))) { 2809 log_OS_error("Unable to open list of drives"); 2810 paranoid_free(list_drives_cmd); 2811 paranoid_free(current_drive); 2812 return ('\0'); 2813 } 2814 for (fgets(current_drive, MAX_STR_LEN, pdrives); !feof(pdrives); 2815 fgets(current_drive, MAX_STR_LEN, pdrives)) { 2816 strip_spaces(current_drive); 2817 log_it("looking at partition %s's BR", current_drive); 2818 if (does_string_exist_in_boot_block(current_drive, "GRUB")) { 2819 count_grubs++; 2820 strcpy(which_device, current_drive); 2821 break; 2822 } 2823 if (does_string_exist_in_boot_block(current_drive, "LILO")) { 2824 count_lilos++; 2825 strcpy(which_device, current_drive); 2826 break; 2827 } 2828 } 2829 if (pclose(pdrives)) { 2830 log_OS_error("Cannot pclose pdrives"); 2831 } 2832 log_it("%d grubs and %d lilos\n", count_grubs, count_lilos); 2833 paranoid_free(list_drives_cmd); 2834 paranoid_free(current_drive); 2835 if (count_grubs && !count_lilos) { 2836 return ('G'); 2837 } else if (count_lilos && !count_grubs) { 2838 return ('L'); 2839 } else if (count_grubs == 1 && count_lilos == 1) { 2840 log_it("I'll bet you used to use LILO but switched to GRUB..."); 2841 return ('G'); 2842 } else { 2843 log_it("Unknown boot loader"); 2844 return ('U'); 2845 } 2805 2846 } 2806 2847 } -
branches/2.2.4/mondo/src/mondorestore/mondo-rstr-tools.c
r1406 r1451 846 846 847 847 if (!strcmp(mpt, "/1")) { 848 strcpy(mountpoint, "/");849 log_msg(3, "Mommm! SME is being a dildo!");848 strcpy(mountpoint, "/"); 849 log_msg(3, "Mommm! SME is being a dildo!"); 850 850 } else { 851 strcpy(mountpoint, mpt);851 strcpy(mountpoint, mpt); 852 852 } 853 853 854 854 if (!strcmp(mountpoint, "lvm")) { 855 return (0);855 return (0); 856 856 } 857 857 if (!strcmp(mountpoint, "image")) { 858 return (0);858 return (0); 859 859 } 860 860 sprintf(tmp, "Mounting device %s ", device); 861 861 log_msg(1, tmp); 862 862 if (writeable) { 863 strcpy(additional_parameters, "-o rw");863 strcpy(additional_parameters, "-o rw"); 864 864 } else { 865 strcpy(additional_parameters, "-o ro");865 strcpy(additional_parameters, "-o ro"); 866 866 } 867 867 if (find_home_of_exe("setfattr")) { 868 strcat(additional_parameters, ",user_xattr");868 strcat(additional_parameters, ",user_xattr"); 869 869 } 870 870 if (find_home_of_exe("setfacl")) { 871 strcat(additional_parameters, ",acl");871 strcat(additional_parameters, ",acl"); 872 872 } 873 873 874 874 if (!strcmp(mountpoint, "swap")) { 875 sprintf(command, "swapon %s", device);875 sprintf(command, "swapon %s", device); 876 876 } else { 877 877 if (!strcmp(mountpoint, "/")) { … … 888 888 res = run_program_and_log_output(command, TRUE); 889 889 if (res && (strstr(command, "xattr") || strstr(command, "acl"))) { 890 log_msg(1, "Re-trying without the fancy extra parameters");891 sprintf(command, "mount -t %s %s %s 2>> %s", format, device,890 log_msg(1, "Re-trying without the fancy extra parameters"); 891 sprintf(command, "mount -t %s %s %s 2>> %s", format, device, 892 892 mountdir, MONDO_LOGFILE); 893 res = run_program_and_log_output(command, TRUE);893 res = run_program_and_log_output(command, TRUE); 894 894 } 895 895 if (res) { 896 log_msg(1, "Unable to mount device %s (type %s) at %s", device,896 log_msg(1, "Unable to mount device %s (type %s) at %s", device, 897 897 format, mountdir); 898 log_msg(1, "command was '%s'", command);899 if (!strcmp(mountpoint, "swap")) {900 log_to_screen(tmp);901 } else {902 log_msg(2, "Retrying w/o the '-t' switch");903 sprintf(command, "mount %s %s 2>> %s", device, mountdir,898 log_msg(1, "command was '%s'", command); 899 if (!strcmp(mountpoint, "swap")) { 900 log_to_screen(tmp); 901 } else { 902 log_msg(2, "Retrying w/o the '-t' switch"); 903 sprintf(command, "mount %s %s 2>> %s", device, mountdir, 904 904 MONDO_LOGFILE); 905 log_msg(2, "2nd command = '%s'", command);906 res = run_program_and_log_output(command, TRUE);907 if (res == 0) {908 log_msg(1,905 log_msg(2, "2nd command = '%s'", command); 906 res = run_program_and_log_output(command, TRUE); 907 if (res == 0) { 908 log_msg(1, 909 909 "That's OK. I called mount w/o a filesystem type and it worked fine in the end."); 910 } else {911 log_to_screen(tmp);912 }913 }910 } else { 911 log_to_screen(tmp); 912 } 913 } 914 914 } 915 915 if (res && !strcmp(mountpoint, "swap")) { 916 log_msg(2, "That's ok. It's just a swap partition.");917 log_msg(2, "Non-fatal error. Returning 0.");918 res = 0;916 log_msg(2, "That's ok. It's just a swap partition."); 917 log_msg(2, "Non-fatal error. Returning 0."); 918 res = 0; 919 919 } 920 920
Note:
See TracChangeset
for help on using the changeset viewer.