Changeset 1077 in MondoRescue
- Timestamp:
- Jan 27, 2007, 8:20:48 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/mondorestore/mondo-restore.c
r1067 r1077 1 1 /*************************************************************************** 2 mondo-restore.c - restores mondoarchive data 3 ------------------- 4 begin : Fri May 19 2000 5 copyright : (C) 2000 by Hugo Rabson 6 email : Hugo Rabson <hugorabson@msn.com> 7 cvsid : $Id$ 2 $Id$ 3 restores mondoarchive data 8 4 ***************************************************************************/ 9 10 /***************************************************************************11 * *12 * This program is free software; you can redistribute it and/or modify *13 * it under the terms of the GNU General Public License as published by *14 * the Free Software Foundation; either version 2 of the License, or *15 * (at your option) any later version. *16 * *17 ***************************************************************************/18 19 /***************************************************************************20 * Change Log *21 ***************************************************************************22 .23 24 25 07/2626 - workaround - if not /dev then don't call partimagehack27 28 07/2129 - if switch to Interactive Mode during nuke then don't nuke twice :) just once30 31 07/1832 - better support of users who boot from LVM CD and nuke-restore non-LVM backups33 34 07/1035 - when using 'star', exclude all 'not removed.' messages from log (misleading, they are)36 - try w/ ACLs, then w/o ACLs if star fails w/ ACLs37 - added ACL, xattr support for afio38 39 06/2640 - remove make_relevant_partition_bootable(); roll into mondo-prep.c41 - changed various newtDrawRootText() calls to use g_noof_rows instead of42 integers43 44 06/1945 - don't try to access biggiestruct before it is populated w/ data relating46 to biggiefile; instead, use control char to find out if biggiefile is47 to be restored w/ partimagehack or not48 - added AUX_VER49 50 06/1551 - read_cfg_file_into_bkpinfo() --- use user-supplied 'isodir' instead of52 archive's 'isodir' if different53 Conor Daly <conor.daly@met.ie>54 55 06/1756 - restore with partimagehack if NTFS device; dd, if non-NTFS device57 58 06/1459 - unmount all; remount, run grub-mr; unmount again60 61 04/0962 - fixed subset restoration bug introduced when I added 'star' support63 64 04/0465 - cleaned up restore_a_tarball_from_stream()66 67 04/0368 - added star support69 - pause for 3s between partitioning and formatting (if in Nuke Mode)70 71 03/2872 - check that g_mountlist_fname was correcfly set; abort if it wasn't73 74 03/2575 - removed dev_null code76 77 03/22/0478 - added mode_of_file()79 - added code to check for unauthorised modification of /dev/null80 by afio (for instance)81 82 12/27/0383 - check /tmp/cmdline instead of /proc/cmdline if on FreeBSD84 85 11/1586 - added g_fprep87 - "Switch to interactive mode?" msg is now more informative88 89 11/0590 - after 'Are you sure?' when user specifies / as restore path, set91 restore_path[] to "" so that files are restored to [blank]/file/name :)92 93 10/2994 - moved "No restoring or comparing will take place today" block95 up to before iso_fiddly_bits (if iso) is called - fix bug96 if you're in ISO Mode and you say "exit to shell"97 98 10/2299 - swapped calls to chmod() and chown() after restoration100 of big files (Jens)101 102 10/21103 - changed "/mnt/cdrom" to MNT_CDROM104 105 10/19106 - restore biggiefiles selectively from CD properly107 - use find_my_editor() to find pico/vi/whatever108 - better use of call_program_and_get_last_line_of_output() to109 scan /proc/cmdline110 111 10/18112 - don't report 'missing compressor' if no compressor used at all113 114 10/14115 - log afio's error messages to /var/log/mondo-archive.log116 when restoring :)117 - call vi if pico is not available118 119 10/09120 - better logging if fatal error (cannot openout bigfile)121 - better GUI feedback when restoring big files122 - restore_everything() now uses s_node* instead of char*123 - ditto restore_all_*_from_*()124 125 10/02126 - succinct msg instead of pop-ups, if used -H127 128 09/27129 - tweaked restore-time gui130 131 09/26132 - proper reporting of DVD/CDR/etc. type in displayed dialogs133 134 09/23135 - malloc/free global strings in new subroutines - malloc_libmondo_global_strings()136 and free_libmondo_global_strings() - which are in libmondo-tools.c137 138 09/21139 - trying to fix "mondorestore <no params>" segfault140 141 09/18142 - better remounting of /143 - cleaned up run_grub()144 - sensible command-line handling in Live Mode145 146 09/17147 - cleaned up GRUB installer script a bit148 149 09/15150 - remount / as r/w if in disaster recovery mode;151 helps for b0rken distros152 153 09/13154 - major NTFS hackage155 156 09/12157 - changed some in-sub var decl'ns to malloc()'s158 159 09/05160 - don't let me run unless I'm root161 - finished NTFS/partimagehack support (CD only); working on tape now162 163 09/01164 - fixed cosmetic bug in biggiefile restore window165 166 06/01 - 08/31167 - added code to main() to make sure NFS168 (backup) share is mounted in Nuke and Compare Modes169 - added code to run_grub() to mount /boot before running grub-install170 - fixed some stray assert()'s in restore_a_biggiefile_from_stream()171 - fixed bugs in extract_config_file_from_ramdisk()172 and get_cfg_file_from_archive() which173 stopped fape+floppy users from being able to174 boot from floppy and leave floppy in drive :)175 - added hooks to partimage for doing imagedevs176 - fixed calls to popup_and_get_string()177 178 05/01 - 05/31179 - fixed biggiefile atime/utime dates restoration bug, I think180 - added misc clean-up (Steve Hindle)181 - fixed support for subdir-within-NFS-mount182 - if nuke mode fails & user reverts to interactive mode _and succeeds_,183 don't claim nuke mode aborted :)184 - unmount_all_devices() uses mountlist->el[lino].mountpt185 instead of mountlist->el[lino].device where possible186 - added Joshua Oreman's FreeBSD patches187 - copied missing paragraph from 1.6x's read_cfg_file_into_bkpinfo()188 to 1.7x's; affected tape streamer users (badly!)189 - cleaned up some paranoid assert()'s190 - use which("post-nuke") instead of find_home_of_exe("post-nuke")191 - fixed "Don't eject while restoring" mode192 - get_cfg_file_from_archive() --- also recovers mountlist.txt now :)193 - don't eject if 'donteject' is in kernel's command line194 - added 'don't panic' msg to start of log195 196 04/01 - 04/30197 - added text mode (cat /proc/cmdline; if textonly then text mode is on)198 - delete /var/lock/subsys/ * when nuking199 - don't resize mountlist if "noresize" present in /proc/cmdline200 - changed from chmod -R 1777 tmp to chmod 1777 tmp201 - replace newtFinished() and newtInit() with202 newtSuspend() and newtResume()203 - get_cfg_file_from_archive() returns 1 instead of aborting now204 - read_cfg_file_into_bkpinfo) --- if autorun CD but its config205 file indicates a non-CD backup media then ask, just in case206 - sped up restore_a_tarball_from_CD() a bit207 - line 4469 --- if post-nuke not found then don't run it :)208 - replaced "/mnt/RESTORING" with MNT_RESTORING (#define'd)209 - moved compare_*() into mondorestore/mondo-rstr-compare.c210 - moved some RAID subroutines into common/libmondo-raid.c211 - fixed some iso live compare problems212 - replaced FILELIST_FULL with g_filelist_full and FILELIST_FULL_STUB;213 g_filelist_full being the full path of the filelist.full text file and214 FILELIST_FULL_STUB being "tmp/filelist.full" (relative path);215 - ditto BIGGIELIST_TXT, MONDO_CFG_FILE216 - added lots of assert()'s and log_OS_error()'s217 - in Nuke Mode, check mountlist's sanity before doing anything else;218 if it fails sanity test, offer to revert to Interactive Mode (or abort)219 - copy log to /mnt/RESTORING/root at end220 - read_cfg_file_into_bkpinfo() --- read iso-dev and isodir if bkptype==iso221 - line 1701 --- delete ramdisk file after extracting config info222 - moved call to make_relevant_partitions_bootable() from223 within run_boot_loader() to within interactive_mode() and224 nuke_mode(), after unmounting disks225 - if editing fstab or *.conf, try to use pico if available226 - better calling of make-me-bootable227 - don't sort mountlist anywhere anymore except _locally_ in228 mount_all_devices() and unmount_all_devices()229 - edit fstab, grub.conf _after_ stabgrub-me if it fails230 - run_boot_loader() --- backup all crucial files to /etc/ *.pristine first231 - added iso_fiddly_bits()232 - fixed ISO mode support233 - mount_cdrom() only searches for device if NOT in disaster recovery mode234 - changed lost of system()'s into run_program_and_log_output()'s235 - don't eject if bkpinfo->please_dont_eject_when_restoring236 - cleaned up post-nuke handling code237 - always eject CD at end, unless bkpinfo->please_dont_...238 - misc clean-up (Tom Mortell)239 - afio uses -c (1024L*1024L)/TAPE_BLOCK_SIZE now240 instead of -c 1024241 242 01/01 - 03/31/2003243 - commented out sort_... line (BB)244 - clean-up (Stan Benoit)245 - added code for LVM and SW Raid (Brian Borgeson)246 - line 814 - added -p to 'mkdir -p tmp'247 - mount_cdrom() - calls find_cdrom_device() if248 bkpinfo->media_device is blank (to fill it)249 250 11/01 - 12/31/2002251 - mount_cdrom() better at handling multiple CD drives252 - minor clean-up in restore_a_tarball_from_CD()253 - if --live-from-cd then assume restoring live from CD254 - tweaked it to run better w/ ArkLinux255 - create /mnt/RESTORING/mnt/.boot.d for Gentoo users256 after restoring257 - cleaned up iso_mode(); no longer asks for NFS info 3 times258 - mount_cdrom() was trying to mount /mnt/isodir/%s/%d.iso;259 is now just %s/%d.iso260 - mount/unmount /boot if necessary (Gentoo)261 - added RAW MBR support; added run_raw_mbr() for the purpose262 - unmount & remount supermounts at start/end of live restore263 - copy /tmp/mountlist.txt to /tmp/mountlist.txt.orig at start264 - cleaned up string-handling in get_cfg_info_from_archives()265 - fixed run_grub() to call new stabgrub-me script266 - popup list of changed files after Compare Mode267 - permit mondorestore --edit-mountlist even if live mode268 - create a repaired copy of grub-install which is RAID-friendly;269 use it when initializing boot sector with run_grub()270 - use grub-MR instead of grub-install271 - fixed read_cfg_file_into_bkpinfo() to ignore cfg file's backup_media_type272 if user has already specified a backup media type interactively273 274 10/01 - 10/31275 - run_grub() will let you specify the boot device as well as edit the system276 files, if grub-install fails277 - fixed bug in fwrite() call in restore_biggiefile_from_CD()278 - fixed bug affecting restoration of bigfiles from CD's w/0 compression279 - run_grub() will run 'grub-install {boot device}' instead of280 'grub-install (hd0)'281 282 09/01 - 09/30283 - use /tmp/tmpfs/mondo.tmp instead of /tmp/mondo.tmp284 - initialize MOUNTLIST_FNAME at start of main()285 - differential-related cleanup286 - better handling of CD-ROM drives which aren't /dev/cdrom :)287 - run_program_and_log_output() now takes boolean operator to specify288 whether it will log its activities in the event of _success_289 - always load config file from archive before operating on it290 - moved some subroutines around; now closer to alphabetical order291 - changed mount.mindi to mount.bootisk292 - mount disks readonly if in Compare Mode293 - set /dev/null's permissions to 777, just in case it somehow gets mangled294 ...which apparently happen with some devfs-based Linux distributions295 - remove /var/run/ *.pid after restoring296 - move spurious lockfiles from /home/ * to /home/ * /.disabled297 - if Interactive Mode then ask user which media, etc. (i.e. catchall mode298 is now same as Interactive Mode)299 300 08/01 - 08/30301 - use data structure to store the fname, checksum, mods & perms of each bigfile302 ... biggiestruct :)303 - if a filelist is tiny (2 bytes or less) then ignore it304 - insist_on_this_cd_number() --- now takes 2 params, not 1305 - re-enabled 'g_current_media_number = 1' in restore_everything()306 - added same to compare_mode()307 - replaced lots of global char[]'s with malloc()'s308 - if differential backup then don't permit formatting or fdisking,309 whether Interactive or Nuke mode310 - added call to register_pid() at start of main()311 - if Nuke Mode & it succeeds then ask user if they have contributed yet312 - changed tape-size to media-size (config file)313 - changed using_* to backup_media_type314 - changed *_from_tape to *_from_stream315 316 07/01 - 07/31317 - added find_and_mount_actual_cdrom()318 - temp dir is always random319 - skip tarballs if they don't contain files we're looking for320 (used to read the whole thing & _then_ skip)321 - use media_size[1] instead of media_size[0]322 - fixed serious bug in line 1546 - should have been !=, not ==; stopped323 mondorestore from correctly restoring big files324 - bigfile piping enhancements (Philippe de Muyter)325 - unmount CD-ROM after restoring from live filesystem326 - TAPE_BLOCK_SIZE treated as %ld, not %d327 328 06/01 - 06/30329 - added signal-trapping330 - disabled 'nr-failed-disks' flag331 - fixed problem w/selective restore332 - don't change /tmp's permissions unless it doesn't exist & must be created333 - fixed bug in --mbr334 - is_file_in_list() enhanced to exclude /mnt/RESTORING or whatever335 - added support for uncompressed archives336 - --monitas-live now accepts path-to-restore_to_, not just path to restore337 - added some debugging/tracking code to the NFS section338 - various monitas-related enhancements339 - added --isonuke and --mbr switches340 - better logging in run_grub()341 - improved --monitas-live342 - mkdir -p /mnt/RESTORING/var/run/console just in case user excludes it343 - afio now uses 16MB buffer instead of 8MB344 - always use bkpinfo->media_size[0], now that -s has been expanded345 - popup and ask where to restore data, if restoring selectively346 347 05/01 - 05/31348 - add '--monitas' flag349 - don't run chmod -R 1777 /mnt/RESTORING/tmp before unmounting unless350 restoring at the time...351 352 04/01 - 04/30353 - delete old /tmp/filelist.full,biggielist.txt if found when restoring to354 live filesystem355 - replace MONDO_VERSION #define with VERSION from ../config.h356 - write fname of bigfile to screen when having trouble reading/comparing it357 - if restoring to live filesystem then wipe /tmp/tmpfs/ * afterwards358 - removed spurious finish(0) from main()359 360 03/01 - 03/31/2002361 - if /tmp/m*ndo-restore.cfg not found then assume live restore; restore362 to / instead of /mnt/RESTORING363 - clean up is_file_in_list() to deal with the /mnt/RESTORING/ prefix364 - exclude leading '/' from filelist.restore-these365 - if /tmp/fstab.new exists then use _it_ instead of /tmp/fstab to label366 ext2 or ext3 partitions367 - improved logging368 369 [...]370 371 07/10/2001 --- first incarnation372 */373 374 5 375 6 /** … … 2575 2206 sprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.bz2", 2576 2207 current_tarball_number); 2577 sprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.gz", 2208 if (!does_file_exist(tarball_fname)) { 2209 sprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.gz", 2578 2210 current_tarball_number); 2211 } 2579 2212 if (!does_file_exist(tarball_fname)) { 2580 2213 sprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.lzo",
Note:
See TracChangeset
for help on using the changeset viewer.