Changeset 1903 in MondoRescue for branches/stable/mondo
- Timestamp:
- Apr 10, 2008, 1:13:58 AM (16 years ago)
- Location:
- branches/stable/mondo/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/common/libmondo-archive.c
r1770 r1903 42 42 #define DVDRWFORMAT 1 43 43 44 #ifndef __FreeBSD__45 44 #ifndef _SEMUN_H 46 45 #define _SEMUN_H … … 56 55 }; 57 56 #endif 58 #endif /* __FreeBSD__ */59 57 60 58 extern struct mr_ar_conf *mr_conf; … … 615 613 } 616 614 #else 615 #ifdef __IA64__ 616 strcpy(bootdev, call_program_and_get_last_line_of_output 617 ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 618 #else 617 619 strcpy(bootdev, call_program_and_get_last_line_of_output 618 620 ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 621 #endif 619 622 if (strstr(bootdev, "/dev/cciss/")) { 623 #ifdef __IA64__ 624 strcpy(bootdev, call_program_and_get_last_line_of_output 625 ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 626 #else 620 627 strcpy(bootdev, call_program_and_get_last_line_of_output 621 628 ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 629 #endif 622 630 } 623 631 if (!bootdev[0]) { … … 3192 3200 /*@ bool ******************************************************** */ 3193 3201 bool that_one_was_ok; 3194 bool using_nfs;3195 3202 bool orig_vfy_flag_val; 3196 3203 … … 3204 3211 } 3205 3212 3206 if (strlen(bkpinfo->nfs_mount) > 1) {3207 using_nfs = TRUE;3208 } else {3209 using_nfs = FALSE;3210 }3211 3213 mr_msg(1, "OK, time to make %s #%d", 3212 3214 bkpinfo->backup_media_string, -
branches/stable/mondo/src/common/libmondo-devices.c
r1842 r1903 1576 1576 } 1577 1577 if (bkpinfo->backup_media_type == tape && bkpinfo->restore_data) { 1578 popup_and_OK(_("Please remove CDfrom drive"));1578 popup_and_OK(_("Please remove media from drive")); 1579 1579 } 1580 1580 mr_msg(3, "media type = %s", … … 1804 1804 1805 1805 case nfs: 1806 /* Never try to eject a NFS device */ 1807 bkpinfo->please_dont_eject = TRUE; 1808 1809 /* Initiate bkpinfo nfs_mount path from running environment if not already done */ 1806 1810 if (!bkpinfo->nfs_mount[0]) { 1807 1811 strcpy(bkpinfo->nfs_mount, … … 1840 1844 mr_free(command); 1841 1845 1842 mr_asprintf(&comment, 1846 if (!bkpinfo->restore_data) { 1847 mr_asprintf(&comment, 1843 1848 _("How much data (in Megabytes) will each media store?")); 1844 if (!popup_and_get_string(_("Size"), comment, sz_size, 5)) { 1845 log_to_screen(_("User has chosen not to backup the PC")); 1846 finish(1); 1849 if (!popup_and_get_string(_("Size"), comment, sz_size, 5)) { 1850 log_to_screen(_("User has chosen not to backup the PC")); 1851 finish(1); 1852 } 1853 } else { 1854 sz_size = 0; 1847 1855 } 1848 1856 mr_free(comment); … … 1863 1871 } 1864 1872 } 1865 if (!is_this_device_mounted(bkpinfo->nfs_mount)) { 1873 /* Initiate bkpinfo isodir path from running environment if mount already done */ 1874 if (is_this_device_mounted(bkpinfo->nfs_mount)) { 1875 strcpy(bkpinfo->isodir, 1876 call_program_and_get_last_line_of_output 1877 ("mount | grep \":\" | cut -d' ' -f3 | head -n1")); 1878 } else { 1866 1879 sprintf(bkpinfo->isodir, "%s/nfsdir", bkpinfo->tmpdir); 1867 1880 mr_asprintf(&command, "mkdir -p %s", bkpinfo->isodir); -
branches/stable/mondo/src/common/libmondo-filelist.c
r1817 r1903 1527 1527 time_t time_of_last_full_backup = 0; 1528 1528 struct stat statbuf; 1529 char *tmp1 = NULL; 1530 char *tmp2 = NULL; 1529 1531 1530 1532 malloc_string(sz_datefile); … … 1586 1588 mr_msg(2, "include_paths = '%s'", include_paths); 1587 1589 mr_msg(1, "Calculating filelist"); 1588 mr_asprintf(&exclude_paths, " %s %s %s %s %s %s %s . .. \ 1589 " MNT_CDROM " /mnt/floppy /media \ 1590 /proc /sys /tmp /var/log/lastlog /root/images/mondo " MINDI_CACHE " " MONDO_CACHE, excp, call_program_and_get_last_line_of_output("locate /win386.swp 2> /dev/null"), call_program_and_get_last_line_of_output("locate /hiberfil.sys 2> /dev/null"), call_program_and_get_last_line_of_output("locate /pagefile.sys 2> /dev/null"), (tmpdir[0] == '/' && tmpdir[1] == '/') ? (tmpdir + 1) : tmpdir, (scratchdir[0] == '/' && scratchdir[1] == '/') ? (scratchdir + 1) : scratchdir); 1590 mr_asprintf(&tmp2, call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|fat|vfat|dos' | awk '{print $3}'")); 1591 if (strlen(tmp2) < 1) { 1592 mr_asprintf(&tmp1,""); 1593 } else { 1594 mr_msg(2, "Found windows FS: %s",tmp2); 1595 mr_asprintf(&tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2); 1596 mr_free(tmp2); 1597 mr_asprintf(&tmp2, call_program_and_get_last_line_of_output(tmp1)); 1598 mr_msg(2, "Found windows files: %s",tmp2); 1599 } 1600 mr_free(tmp1); 1591 1601 1592 1602 mr_msg(2, "Excluding paths = '%s'", exclude_paths); 1603 mr_asprintf(&exclude_paths, " %s %s %s %s %s %s . .. \ 1604 " MNT_CDROM " " MNT_FLOPPY " /media /tmp /var/log/lastlog \ 1605 /proc /sys /root/images/mondo ", MINDI_CACHE, MONDO_CACHE, excp, tmp2, (tmpdir[0] == '/' && tmpdir[1] == '/') ? (tmpdir + 1) : tmpdir, (scratchdir[0] == '/' && scratchdir[1] == '/') ? (scratchdir + 1) : scratchdir); 1606 paranoid_free(tmp2); 1607 1593 1608 mr_msg(2, 1594 1609 "Generating skeleton filelist so that we can track our progress"); -
branches/stable/mondo/src/common/libmondo-stream.c
r1663 r1903 885 885 return (1); 886 886 } 887 /* Not used 887 888 mr_asprintf(&tmp, "Reading file from tape; writing to '%s'; %ld KB", 888 889 outfname, (long) size >> 10); 889 log_to_screen(tmp); 890 mr_free(tmp); 890 */ 891 891 892 892 if (foutstream) { -
branches/stable/mondo/src/common/libmondo-tools.c
r1842 r1903 901 901 902 902 // abort if Windows partition but no ms-sys and parted 903 if (!run_program_and_log_output 904 ("mount | grep -w vfat | grep -vE \"/dev/fd|nexdisk\"", 0) 905 || 906 !run_program_and_log_output 907 ("mount | grep -w dos | grep -vE \"/dev/fd|nexdisk\"", 0)) { 903 if (!run_program_and_log_output("mount | grep -Ew 'vfat|fat|dos' | grep -vE \"/dev/fd|nexdisk\"", 0)) { 908 904 log_to_screen(_("I think you have a Windows 9x partition.")); 909 905 retval += whine_if_not_found("parted"); 910 #ifndef __IA64__911 /* IA64 always has one vfat partition for EFI even without Windows */912 // retval +=913 if (!find_home_of_exe("ms-sys")) {914 log_to_screen("Please install ms-sys just in case.");915 }916 #endif917 906 } 918 907 -
branches/stable/mondo/src/common/newt-specific.c
r1770 r1903 259 259 kill_anything_like_this(char *str) { 260 260 261 char *tmp = NULL; 262 263 mr_asprintf(&tmp,"kill `ps %s | grep \" %s \" | awk '{print %s;}' | grep -v \"grep\"`", ps_options, str, ps_proc_id); 261 char *tmp = NULL; 262 char *tmp1 = NULL; 263 264 mr_asprintf(&tmp,"ps %s | grep \" %s \" | awk '{print %s;}' | grep -v \"grep\"", ps_options, str, ps_proc_id); 264 265 run_program_and_log_output(tmp, TRUE); 266 if (strlen(tmp) > 0) { 267 mr_asprintf(&tmp1,"kill `%s`", tmp); 268 run_program_and_log_output(tmp1, TRUE); 269 paranoid_free(tmp1); 270 } 265 271 mr_free(tmp); 266 272 } -
branches/stable/mondo/src/mondoarchive/mondo-cli.c
r1842 r1903 472 472 if (flag_set['n']) { 473 473 bkpinfo->backup_media_type = nfs; 474 /* Never try to eject a NFS device */ 475 bkpinfo->please_dont_eject = TRUE; 474 476 } 475 477 if (flag_set['r']) { … … 761 763 (_("Your kernel appears not to support vfat filesystems. I am therefore")); 762 764 log_to_screen 763 (_("using LILO instead of SYSLINUX as the CD'sboot loader."));765 (_("using LILO instead of SYSLINUX as the media boot loader.")); 764 766 } 765 767 if (run_program_and_log_output("which mkfs.vfat", 2)) { -
branches/stable/mondo/src/mondorestore/mondo-rstr-tools.c
r1842 r1903 56 56 char *g_getfacl = NULL; 57 57 58 extern void kill_anything_like_this(char *str); 59 58 60 /** 59 61 * @addtogroup restoreUtilityGroup … … 387 389 388 390 char *command = NULL; 391 char *tmp = NULL; 389 392 char *mountdir = NULL; 390 393 char *mountpoint = NULL; … … 439 442 mr_msg(2, "command='%s'", command); 440 443 } 444 441 445 res = run_program_and_log_output(command, TRUE); 446 if (res && (strstr(command, "xattr") || strstr(command, "acl"))) { 447 mr_msg(1, "Re-trying without the fancy extra parameters"); 448 mr_asprintf(&tmp, "mount -t %s %s %s 2>> %s", format, device, 449 mountdir, MONDO_LOGFILE); 450 res = run_program_and_log_output(tmp, TRUE); 451 mr_free(tmp); 452 } 442 453 if (res) { 443 454 mr_msg(1, "Unable to mount device %s (type %s) at %s", device, … … 449 460 } else { 450 461 mr_msg(2, "Retrying w/o the '-t' switch"); 451 mr_free(command); 452 453 mr_asprintf(&command, "mount %s %s 2>> %s", device, mountdir, 462 mr_asprintf(&tmp, "mount %s %s 2>> %s", device, mountdir, 454 463 MONDO_LOGFILE); 455 mr_msg(2, "2nd command = '%s'", command); 456 res = run_program_and_log_output(command, TRUE); 464 mr_msg(2, "2nd command = '%s'", tmp); 465 res = run_program_and_log_output(tmp, TRUE); 466 mr_free(tmp); 457 467 if (res == 0) { 458 468 mr_msg(1, … … 473 483 } 474 484 mr_free(mountpoint); 475 476 485 return (res); 477 486 } … … 623 632 mr_msg(1, "isodir is being set to %s", bkpinfo->isodir); 624 633 } 634 625 635 #ifdef __FreeBSD__ 626 636 mr_asprintf(&mount_cmd, "/mnt/isodir/%s/%s/%s-%d.iso", bkpinfo->isodir, … … 687 697 break; 688 698 } else { 689 mr_msg(2, "Failed to mount CD-ROM drive.");699 mr_msg(2, "Failed to mount device."); 690 700 sleep(5); 691 701 run_program_and_log_output("sync", FALSE); … … 806 816 } else if (!strcmp(value, "nfs")) { 807 817 bkpinfo->backup_media_type = nfs; 818 bkpinfo->please_dont_eject = TRUE; 808 819 if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) { 809 820 mr_allocstr(bkpinfo->prefix,value); … … 842 853 fatal_error("backup-media-type not specified!"); 843 854 } 855 844 856 if (bkpinfo->disaster_recovery) { 845 857 if (bkpinfo->backup_media_type == cdstream) { … … 1286 1298 #endif 1287 1299 char *name = NULL; 1300 char *cmd = NULL; 1288 1301 1289 1302 malloc_string(device); 1290 1303 malloc_string(name); 1304 1305 /* In order to have a working bootloader, we need to have all devices 1306 * ready in the chroot. If they are not there (udev) then copy them from 1307 * the current /dev location 1308 */ 1309 asprintf(&cmd,"tar cf - /dev | ( cd %s ; tar xf - )",MNT_RESTORING); 1310 run_program_and_log_output(cmd, 3); 1311 paranoid_free(cmd); 1312 1291 1313 backup_crucial_file(MNT_RESTORING, "/etc/fstab"); 1292 1314 backup_crucial_file(MNT_RESTORING, "/etc/grub.conf"); 1293 1315 backup_crucial_file(MNT_RESTORING, "/etc/lilo.conf"); 1294 1316 backup_crucial_file(MNT_RESTORING, "/etc/elilo.conf"); 1317 backup_crucial_file(MNT_RESTORING, "/boot/grub/device.map"); 1318 backup_crucial_file(MNT_RESTORING, "/etc/mtab"); 1295 1319 read_cfg_var(g_mondo_cfg_file, "bootloader.device", device); 1296 1320 read_cfg_var(g_mondo_cfg_file, "bootloader.name", name); … … 1312 1336 mr_free(tmp); 1313 1337 } else { 1314 mr_asprintf(&tmp, "ls /dev | grep -Eq '^%ss[1-4].* $'", device);1338 mr_asprintf(&tmp, "ls /dev | grep -Eq '^%ss[1-4].*'", device); 1315 1339 if (!system(tmp)) { 1316 1340 mr_free(tmp); … … 1534 1558 newtSuspend(); 1535 1559 } 1536 mr_asprintf(&tmp, " %s " MNT_RESTORING "/etc/fstab", editor);1560 mr_asprintf(&tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor); 1537 1561 paranoid_system(tmp); 1538 1562 mr_free(tmp); 1539 1563 1540 mr_asprintf(&tmp, " %s " MNT_RESTORING "/etc/elilo.conf", editor);1564 mr_asprintf(&tmp, "chroot %s %s /etc/elilo.conf", MNT_RESTORING, editor); 1541 1565 paranoid_system(tmp); 1542 1566 mr_free(tmp); … … 2173 2197 if (!does_file_exist("tmp/mondo-restore.cfg")) { 2174 2198 log_to_screen(_ 2175 ("Cannot find config info on tape/CD"));2199 ("Cannot find config info on media")); 2176 2200 return (1); 2177 2201 } -
branches/stable/mondo/src/mondorestore/mondorestore.c
r1770 r1903 437 437 read_cfg_file_into_bkpinfo(g_mondo_cfg_file); 438 438 iamhere("Done loading config file; resizing ML"); 439 if (bkpinfo->backup_media_type != usb) {439 if (bkpinfo->backup_media_type == nfs) { 440 440 mr_asprintf(&tmp,bkpinfo->prefix); 441 441 if (popup_and_get_string … … 1994 1994 _("Please wait. This may take some time."), 1995 1995 "", total_slices); 1996 for (bigfileno = 0 , finished = FALSE; !finished;) {1996 for (bigfileno = 0 ; bigfileno < noof_biggiefiles ;) { 1997 1997 mr_msg(2, "Thinking about restoring bigfile %ld", bigfileno + 1); 1998 1998 if (!does_file_exist(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""))) { … … 2004 2004 g_current_media_number); 2005 2005 mr_msg(3, "Slicename would have been %s", 2006 slice_fname(bigfileno + 1, 0, ARCHIVES_PATH, ""));2006 slice_fname(bigfileno, 0, ARCHIVES_PATH, "")); 2007 2007 // I'm not positive 'just_changed_cds' is even necessary... 2008 2008 if (just_changed_cds) { … … 2017 2017 just_changed_cds = TRUE; 2018 2018 } else { 2019 /* That big file doesn't exist, but the followings may */ 2020 /* So we need to continue looping */ 2019 2021 mr_msg(2, "There was no bigfile #%ld. That's OK.", 2020 2022 bigfileno + 1); 2021 2023 mr_msg(2, "I'm going to stop restoring bigfiles now."); 2022 finished = TRUE; 2024 retval++; 2025 bigfileno++; 2023 2026 } 2024 2027 } else { … … 3012 3015 } 3013 3016 3017 if (argc == 3 && strcmp(argv[1], "-K") == 0) { 3018 g_loglevel = atoi(argv[2]); 3019 log_msg(1,"Loglevel forced to %s",g_loglevel); 3020 } 3014 3021 3015 3022 if (argc == 2 && strcmp(argv[1], "--live-grub") == 0) { … … 3169 3176 mvaddstr_and_log_it(g_currentY++, 3170 3177 0, 3171 _("Run complete. Please remove CD/media and reboot."));3178 _("Run complete. Please remove media and reboot.")); 3172 3179 } else { 3173 3180 run_program_and_log_output("sync", FALSE); … … 3226 3233 unlink("/tmp/mondo-run-prog.tmp"); 3227 3234 set_signals(FALSE); 3228 mr_asprintf(&tmp, "rm -Rf %s", bkpinfo->tmpdir);3229 run_program_and_log_output(tmp, FALSE);3230 mr_free(tmp);3231 3235 3232 3236 log_to_screen … … 3243 3247 run_program_and_log_output("mount / -o remount,rw", 2); 3244 3248 } // for b0rken distros 3249 mr_asprintf(&tmp, "rm -Rf %s", bkpinfo->tmpdir); 3250 run_program_and_log_output(tmp, FALSE); 3251 mr_free(tmp); 3252 3245 3253 paranoid_MR_finish(retval); // frees global stuff plus bkpinfo 3246 3254 free_libmondo_global_strings(); // it's fine to have this here :) really :)
Note:
See TracChangeset
for help on using the changeset viewer.