Changeset 2029 in MondoRescue for branches/2.2.7/mondo/src
- Timestamp:
- Oct 3, 2008, 1:15:28 AM (16 years ago)
- Location:
- branches/2.2.7/mondo/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.7/mondo/src/include/my-stuff.h
r1930 r2029 75 75 #define STD_PREFIX "mondorescue" /* Should be coherent with mindi */ 76 76 77 /**78 * The biggielist stub (appended to the directory where all.tar.gz was unpacked).79 */80 #define BIGGIELIST_TXT_STUB "./tmp/biggielist.txt"81 82 /**83 * The filelist stub (appended to the directory where all.tar.gz was unpacked).84 */85 #define FILELIST_FULL_STUB "./tmp/filelist.full.gz"86 87 /**88 * The mountlist stub (appended to the directory where all.tar.gz was unpacked).89 */90 #define MOUNTLIST_FNAME_STUB "./tmp/mountlist.txt"91 92 /**93 * The mondo-restore.cfg stub (appended to the directory where all.tar.gz was unpacked).94 */95 #define MONDO_CFG_FILE_STUB "./tmp/mondo-restore.cfg"96 77 /** 97 78 * The location where mindi media images are stored. -
branches/2.2.7/mondo/src/mondorestore/mondo-rstr-tools.c
r2022 r2029 1 1 /*************************************************************************** 2 mondo-rstr-tools.c - description 3 ----------------- 4 5 begin: Sun Sep 21 16:40:35 EDT 2003 6 copyright : (C) 2002 Mondo Hugo Rabson 7 email : Hugo Rabson <hugorabson@msn.com> 8 edited by : by Stan Benoit ?/2003 9 email : troff@nakedsoul.org 10 cvsid : $Id: mondo-rstr-tools.c 11 ***************************************************************************/ 2 $Id$ 12 3 13 4 /*************************************************************************** … … 19 10 * * 20 11 ***************************************************************************/ 21 /* mondo-rstr-tools.c Hugo Rabson22 23 24 07/2725 - if the user is foolish enough to use /dev/md0 as boot device,26 call lilo -M /dev/hda to make sure lilo does its job properly27 - better NFS+nuke support28 29 07/2030 - use backup's i-want-my-lvm file31 - be sure to use archives' raidtab when restoring32 33 07/1834 - use /tmp/isodir for NFS if DR mode35 - better support of users who boot from LVM CD and nuke-restore non-LVM backups36 37 07/1238 - bugfix to allow user to burn ISOs to CDs and restore from CDs (not original src)39 40 06/2941 - mount ext3 partitions as ext2, just in case :)42 43 06/2644 - delete make_relevant_partition_bootable()45 46 06/1947 - futzed with the call to mount floppy, to stop it from locking up on my AMD64 system48 49 06/1450 - shell out to /mnt/RESTORING chroot in order to let user install GRUB51 manually if automatic GRUB installation fails52 53 06/1554 - Added check for different 'isodir' chosen by user than stored in the archive55 Conor Daly <conor.daly@met.ie>56 57 04/1758 - replaced INTERNAL_TAPE_BLK_SIZE with bkpinfo->internal_tape_block_size59 60 04/0961 - don't try to mount CD if tape bkp62 63 04/0364 - trying to copy tmp/mondo-restore.cfg to itself - silly! - fixed65 66 04/0267 - when extracting cfg file and mountlist from all.tar.gz (tape copy),68 use block size of INTERNAL_TAPE_BLK_SIZE, not TAPE_BLOCK_SIZE69 70 02/2171 - don't use 'mv -v' cos Busybox won't support it72 73 02/0974 - make hole for cfg file before moving it (line 2094 or so)75 76 02/0377 - changed a couple of refs to filelist.full, to filelist.full.gz78 79 01/16/200480 - instead of copying filelist, use 'ln -sf' to link to original;81 saves space82 83 11/20/200384 - also retrieve /tmp/mountlist.txt if user wants85 86 11/1687 - fixed NFS path bug affecting the extractions of filelist/biggielist88 during selective restore89 90 11/0291 - fixed mount_cdrom() to run properly w/ nfs restores92 - mount_device() returns 0 if swap mount fails cos swap isn't crucial93 94 10/1795 - run_grub() uses MNT_RESTORING instead of "/mnt/RESTORING"96 97 10/2698 - cleaned up run_grub()99 100 10/25101 - fixed mount_cdrom() to run properly w/ nfs restores102 103 10/21104 - mount_device() returns 0 if swap mount fails cos swap isn't crucial105 106 10/15107 - run_grub() now uses its initiative instead108 of calling grub-install109 110 10/10111 - don't leave copies of filelist.full lying around, clogging up112 the ramdisk, there's a good fellow :-)113 114 10/02115 - added 'dvd' to the range of media types I'll understand116 - fixed iso->cdr problem (thanks, Stan Benoit & Fred Beondo)117 118 09/24119 - try lots of tape devs if /dev/st0 fails120 121 09/23/2003122 - first incarnation123 */124 125 12 126 13 #include <pthread.h> … … 130 17 #include "../common/libmondo.h" 131 18 #include "mr-externs.h" 132 //#include "mondo-restore.h"133 //#include "mondo-rstr-compare-EXT.h"134 19 #include "mondo-rstr-tools.h" 20 21 /** 22 * The biggielist stub (appended to the directory where all.tar.gz was unpacked). 23 */ 24 #define BIGGIELIST_TXT_STUB "tmp/biggielist.txt" 25 26 /** 27 * The filelist stub (appended to the directory where all.tar.gz was unpacked). 28 */ 29 #define FILELIST_FULL_STUB "tmp/filelist.full.gz" 30 31 /** 32 * The mountlist stub (appended to the directory where all.tar.gz was unpacked). 33 */ 34 #define MOUNTLIST_FNAME_STUB "tmp/mountlist.txt" 35 36 /** 37 * The mondo-restore.cfg stub (appended to the directory where all.tar.gz was unpacked). 38 */ 39 #define MONDO_CFG_FILE_STUB "tmp/mondo-restore.cfg" 40 /** 41 * The i-want-my-lvm stub 42 */ 43 #define IWANTMYLVM_STUB "tmp/i-want-my-lvm" 135 44 136 45 extern bool g_ISO_restore_mode; /* are we in Iso Mode? */ … … 1290 1199 log_to_screen("Extracting filelist and biggielist from media..."); 1291 1200 unlink("/tmp/filelist.full"); 1292 unlink( "/"FILELIST_FULL_STUB);1293 unlink("/ tmp/i-want-my-lvm");1201 unlink(FILELIST_FULL_STUB); 1202 unlink("/" IWANTMYLVM_STUB); 1294 1203 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 1295 1204 sprintf(command, 1296 "tar -b %ld -zxf %s %s %s %s %s%s",1205 "tar -b %ld -zxf %s ./%s ./%s ./%s ./%s ./%s", 1297 1206 bkpinfo->internal_tape_block_size, 1298 1207 bkpinfo->media_device, … … 1300 1209 BIGGIELIST_TXT_STUB, 1301 1210 FILELIST_FULL_STUB, 1302 "./tmp/i-want-my-lvm", MONDO_CFG_FILE_STUB); 1211 IWANTMYLVM_STUB, 1212 MONDO_CFG_FILE_STUB); 1303 1213 log_msg(1, "tarcommand = %s", command); 1304 1214 run_program_and_log_output(command, 1); 1215 if (!does_file_exist(FILELIST_FULL_STUB)) { 1216 /* Doing that allow us to remain compatible with pre-2.2.5 versions */ 1217 log_msg(2, "pre-2.2.4 compatible mode on"); 1218 sprintf(command, 1219 "tar -b %ld -zxf %s %s %s %s %s %s", 1220 bkpinfo->internal_tape_block_size, 1221 bkpinfo->media_device, 1222 MOUNTLIST_FNAME_STUB, 1223 BIGGIELIST_TXT_STUB, 1224 FILELIST_FULL_STUB, 1225 IWANTMYLVM_STUB, 1226 MONDO_CFG_FILE_STUB); 1227 log_msg(1, "tarcommand = %s", command); 1228 run_program_and_log_output(command, 1); 1229 } 1305 1230 } else { 1306 1231 log_msg(2, … … 1311 1236 run_program_and_log_output("mount", 1); 1312 1237 sprintf(command, 1313 "tar -zxf %s/images/all.tar.gz %s %s %s %s%s",1238 "tar -zxf %s/images/all.tar.gz ./%s ./%s ./%s ./%s ./%s", 1314 1239 MNT_CDROM, 1315 1240 MOUNTLIST_FNAME_STUB, 1316 1241 BIGGIELIST_TXT_STUB, 1317 1242 FILELIST_FULL_STUB, 1318 "./tmp/i-want-my-lvm", MONDO_CFG_FILE_STUB); 1243 IWANTMYLVM_STUB, 1244 MONDO_CFG_FILE_STUB); 1319 1245 1320 1246 log_msg(1, "tarcommand = %s", command); 1321 1247 run_program_and_log_output(command, 1); 1248 if (!does_file_exist(FILELIST_FULL_STUB)) { 1249 /* Doing that allow us to remain compatible with pre-2.2.5 versions */ 1250 log_msg(2, "pre-2.2.4 compatible mode on"); 1251 sprintf(command, 1252 "tar -zxf %s/images/all.tar.gz %s %s %s %s %s", 1253 MNT_CDROM, 1254 MOUNTLIST_FNAME_STUB, 1255 BIGGIELIST_TXT_STUB, 1256 FILELIST_FULL_STUB, 1257 IWANTMYLVM_STUB, 1258 MONDO_CFG_FILE_STUB); 1259 1260 log_msg(1, "tarcommand = %s", command); 1261 run_program_and_log_output(command, 1); 1262 } 1322 1263 if (!does_file_exist(BIGGIELIST_TXT_STUB)) { 1323 1264 fatal_error 1324 ("all.tar.gz did not include ./tmp/biggielist.txt");1265 ("all.tar.gz did not include " BIGGIELIST_TXT_STUB); 1325 1266 } 1326 1267 if (!does_file_exist(FILELIST_FULL_STUB)) { 1327 1268 fatal_error 1328 ("all.tar.gz did not include ./tmp/filelist.full.gz");1269 ("all.tar.gz did not include " FILELIST_FULL_STUB); 1329 1270 } 1330 1271 } … … 1347 1288 ask_me_yes_or_no("Do you want to retrieve the mountlist as well?")) 1348 1289 { 1349 // sprintf(command, "cp -f tmp/mountlist.txt /tmp");1350 1290 sprintf(command, "ln -sf %s/%s /tmp", MOUNTLIST_FNAME_STUB, 1351 1291 bkpinfo->tmpdir); … … 2230 2170 2231 2171 sprintf(command, 2232 "dd if=%s bs=%ld count=%ld 2> /dev/null | tar -zx %s %s %s %s%s",2172 "dd if=%s bs=%ld count=%ld 2> /dev/null | tar -zx ./%s ./%s ./%s ./%s ./%s", 2233 2173 dev, 2234 2174 bkpinfo->internal_tape_block_size, 2235 2175 1024L * 1024 * 32 / bkpinfo->internal_tape_block_size, 2236 2176 MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, 2237 BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, "./tmp/i-want-my-lvm");2177 BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB); 2238 2178 log_msg(2, "command = '%s'", command); 2239 2179 res = run_program_and_log_output(command, -1); 2240 if (res != 0 && does_file_exist(MONDO_CFG_FILE_STUB)) { 2241 res = 0; 2180 if (res != 0) { 2181 if (does_file_exist(MONDO_CFG_FILE_STUB)) { 2182 res = 0; 2183 } else { 2184 /* Doing that allow us to remain compatible with pre-2.2.5 versions */ 2185 log_msg(2, "pre-2.2.4 compatible mode on"); 2186 sprintf(command, 2187 "dd if=%s bs=%ld count=%ld 2> /dev/null | tar -zx %s %s %s %s %s", 2188 dev, 2189 bkpinfo->internal_tape_block_size, 2190 1024L * 1024 * 32 / bkpinfo->internal_tape_block_size, 2191 MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, 2192 BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB); 2193 log_msg(2, "command = '%s'", command); 2194 res = run_program_and_log_output(command, -1); 2195 if ((res != 0) && (does_file_exist(MONDO_CFG_FILE_STUB))) { 2196 res = 0; 2197 } 2198 } 2242 2199 } 2243 2200 paranoid_free(command); … … 2289 2246 unlink(FILELIST_FULL_STUB); 2290 2247 unlink(BIGGIELIST_TXT_STUB); 2291 unlink( "tmp/i-want-my-lvm");2248 unlink(IWANTMYLVM_STUB); 2292 2249 sprintf(command, "mkdir -p %s", mountpt); 2293 2250 run_program_and_log_output(command, FALSE); … … 2355 2312 log_msg(2, 2356 2313 "gcffa --- Plan B, a.k.a. untarring some file from all.tar.gz"); 2357 sprintf(command, "tar -zxvf " MNT_CDROM "/images/all.tar.gz %s %s %s %s %s", MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, "./tmp/i-want-my-lvm"); // add -b TAPE_BLOCK_SIZE if you _really_ think it's necessary2314 sprintf(command, "tar -zxvf " MNT_CDROM "/images/all.tar.gz ./%s ./%s ./%s ./%s ./%s", MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB); // add -b TAPE_BLOCK_SIZE if you _really_ think it's necessary 2358 2315 run_program_and_log_output(command, TRUE); 2359 2316 if (!does_file_exist(MONDO_CFG_FILE_STUB)) { 2360 fatal_error 2361 ("Please reinsert the disk/CD and try again."); 2317 /* Doing that allow us to remain compatible with pre-2.2.5 versions */ 2318 log_msg(2, "pre-2.2.4 compatible mode on"); 2319 sprintf(command, "tar -zxvf " MNT_CDROM "/images/all.tar.gz %s %s %s %s %s", MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB); // add -b TAPE_BLOCK_SIZE if you _really_ think it's necessary 2320 run_program_and_log_output(command, TRUE); 2321 if (!does_file_exist(MONDO_CFG_FILE_STUB)) { 2322 fatal_error 2323 ("Please reinsert the disk/CD and try again."); 2324 } 2362 2325 } 2363 2326 } … … 2393 2356 } else { 2394 2357 log_msg(1, "Copied mountlist to /tmp as well OK"); 2395 sprintf(command, "cp -f tmp/i-want-my-lvm /tmp/");2358 sprintf(command, "cp -f %s /tmp/",IWANTMYLVM_STUB); 2396 2359 run_program_and_log_output(command, 1); 2397 2360 } … … 2431 2394 sprintf(command, "cp -f etc/raidtab /etc/"); 2432 2395 run_program_and_log_output(command, FALSE); 2433 sprintf(command, "cp -f tmp/i-want-my-lvm /tmp/");2396 sprintf(command, "cp -f %s /tmp/",IWANTMYLVM_STUB); 2434 2397 run_program_and_log_output(command, FALSE); 2435 2398 g_backup_media_type = bkpinfo->backup_media_type;
Note:
See TracChangeset
for help on using the changeset viewer.