Changeset 3464 in MondoRescue
- Timestamp:
- Sep 10, 2015, 11:52:41 AM (9 years ago)
- Location:
- branches/3.2/mondo/src/common
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mondo/src/common/libmondo-archive-EXT.h
r1885 r3464 2 2 3 3 4 extern int archive_this_fileset(char *filelist, 5 char *fname, int setno); 4 extern int archive_this_fileset(char *filelist, char *fname, int setno); 6 5 extern int backup_data(); 7 6 extern int call_mindi_to_supply_boot_disks(); … … 35 34 extern int call_growisofs(char *destfile); 36 35 extern int make_afioballs_and_images_SINGLETHREAD(); 37 extern int archive_this_fileset_with_star(38 char *filelist, char *fname,39 int setno);40 36 extern void setenv_mondo_share(void); -
branches/3.2/mondo/src/common/libmondo-archive.c
r3460 r3464 187 187 extern int g_tape_buffer_size_MB; 188 188 189 190 191 192 int193 archive_this_fileset_with_star(char *filelist, char *fname, int setno)194 {195 int retval = 0;196 unsigned int res = 0;197 int tries = 0;198 char *command = NULL;199 char *tmp = NULL;200 char *p;201 202 203 if (!does_file_exist(filelist)) {204 log_to_screen("(archive_this_fileset) - filelist %s does not exist", filelist);205 return (1);206 }207 208 mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname);209 if (system(tmp)) {210 mr_free(tmp);211 fatal_error("Unable to write tarball to scratchdir");212 }213 paranoid_free(tmp);214 215 mr_asprintf(command, "star H=exustar list=%s -c -sparse " STAR_ACL_SZ " file=%s", filelist, fname);216 if (bkpinfo->use_lzo) {217 mr_free(command);218 fatal_error("Can't use lzop");219 }220 if (bkpinfo->compression_level > 0) {221 mr_strcat(command, " -bz");222 }223 mr_strcat(command, " 2>> %s", MONDO_LOGFILE);224 log_msg(4, "command = '%s'", command);225 226 for (res = 99, tries = 0; tries < 3 && res != 0; tries++) {227 log_msg(5, "command='%s'", command);228 res = system(command);229 mr_asprintf(tmp, "%s", last_line_of_file(MONDO_LOGFILE));230 log_msg(1, "res=%d; tmp='%s'", res, tmp);231 if (bkpinfo->use_star && (res == 254 || res == 65024)232 && strstr(tmp, "star: Processed all possible files")233 && tries > 0) {234 log_msg(1, "Star returned nonfatal error");235 res = 0;236 }237 mr_free(tmp);238 239 if (res) {240 log_OS_error(command);241 p = strstr(command, "-acl ");242 if (p) {243 p[0] = p[1] = p[2] = p[3] = ' ';244 log_msg(1, "new command = '%s'", command);245 } else {246 log_msg(3,247 "Attempt #%d failed. Pausing 3 seconds and retrying...",248 tries + 1);249 sleep(3);250 }251 }252 }253 mr_free(command);254 255 retval += res;256 if (retval) {257 log_msg(3, "Failed to write set %d", setno);258 } else if (tries > 1) {259 log_msg(3, "Succeeded in writing set %d, on try #%d", setno,260 tries);261 }262 return (retval);263 }264 265 266 189 /** 267 190 * Call @c afio to archive the filelist @c filelist to the file @c fname. … … 286 209 /*@ int *************************************************************** */ 287 210 int retval = 0; 288 int res = 0;211 unsigned int res = 0; 289 212 int tries = 0; 290 213 /* … … 297 220 char *zipparams = NULL; 298 221 char *tmp = NULL; 222 char *p = NULL; 299 223 300 224 assert(bkpinfo != NULL); … … 302 226 assert_string_is_neither_NULL_nor_zerolength(fname); 303 227 304 if (bkpinfo->compression_level > 0 && bkpinfo->use_star) { 305 return (archive_this_fileset_with_star(filelist, fname, setno)); 228 if (!does_file_exist(bkpinfo->tmpdir)) { 229 log_OS_error("tmpdir not found"); 230 fatal_error("tmpdir not found"); 231 } 232 if (!does_file_exist(bkpinfo->scratchdir)) { 233 log_OS_error("scratchdir not found"); 234 fatal_error("scratchdir not found"); 306 235 } 307 236 … … 319 248 320 249 if (bkpinfo->compression_level > 0) { 321 mr_asprintf(tmp, "%s/do-not-compress-these", g_mondo_home);322 // -b %ld, TAPE_BLOCK_SIZE323 mr_asprintf(zipparams, "-Z -P %s -G %d -T 3k", bkpinfo->zip_exe, bkpinfo->compression_level);324 if (does_file_exist(tmp)) {325 mr_ strcat(zipparams, " -E %s",tmp);250 if (bkpinfo->use_star) { 251 if (bkpinfo->use_lzo) { 252 fatal_error("Can't use lzop with star"); 253 } 254 mr_asprintf(zipparams, " -bz"); 326 255 } else { 327 log_msg(3, "%s not found. Cannot exclude zipfiles, etc.", tmp); 328 } 329 mr_free(tmp); 256 mr_asprintf(tmp, "%s/do-not-compress-these", g_mondo_home); 257 // -b %ld, TAPE_BLOCK_SIZE 258 mr_asprintf(zipparams, "-Z -P %s -G %d -T 3k", bkpinfo->zip_exe, bkpinfo->compression_level); 259 if (does_file_exist(tmp)) { 260 mr_strcat(zipparams, " -E %s",tmp); 261 } else { 262 log_msg(3, "%s not found. Cannot exclude zipfiles, etc.", tmp); 263 } 264 mr_free(tmp); 265 } 330 266 } else { 331 267 mr_asprintf(zipparams, ""); 332 268 } 333 269 334 if (!does_file_exist(bkpinfo->tmpdir)) {335 log_OS_error("tmpdir not found");336 fatal_error("tmpdir not found");337 }338 if (!does_file_exist(bkpinfo->scratchdir)) {339 log_OS_error("scratchdir not found");340 fatal_error("scratchdir not found");341 }342 270 mr_asprintf(command, "rm -f %s %s. %s.gz %s.%s", fname, fname, fname, fname, bkpinfo->zip_suffix); 343 271 paranoid_system(command); 344 272 mr_free(command); 345 273 346 mr_asprintf(command, "afio -o -b %ld -M 16m %s %s < %s 2>> %s", TAPE_BLOCK_SIZE, zipparams, fname, filelist, MONDO_LOGFILE); 274 if (bkpinfo->use_star) { 275 mr_asprintf(command, "star H=exustar list=%s -c -sparse " STAR_ACL_SZ " file=%s %s 2>> %s", filelist, fname, zipparams, MONDO_LOGFILE); 276 } else { 277 mr_asprintf(command, "afio -o -b %ld -M 16m %s %s < %s 2>> %s", TAPE_BLOCK_SIZE, zipparams, fname, filelist, MONDO_LOGFILE); 278 } 347 279 mr_free(zipparams); 348 349 mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname); 350 if (system(tmp)) { 351 mr_free(tmp); 352 fatal_error("Unable to write tarball to scratchdir"); 353 } 354 mr_free(tmp); 280 log_msg(4, "command = '%s'", command); 355 281 356 282 for (res = 99, tries = 0; tries < 3 && res != 0; tries++) { 357 283 log_msg(5, "command='%s'", command); 358 284 res = system(command); 285 286 if (bkpinfo->use_star) { 287 mr_asprintf(tmp, "%s", last_line_of_file(MONDO_LOGFILE)); 288 log_msg(1, "res=%d; tmp='%s'", res, tmp); 289 if ((res == 254 || res == 65024) && strstr(tmp, "star: Processed all possible files") && tries > 0) { 290 log_msg(1, "Star returned nonfatal error"); 291 res = 0; 292 } 293 mr_free(tmp); 294 } 359 295 if (res) { 360 296 log_OS_error(command); 361 log_msg(3, 362 "Attempt #%d failed. Pausing 3 seconds and retrying...", 363 tries + 1); 297 if (bkpinfo->use_star) { 298 p = strstr(command, "-acl "); 299 if (p) { 300 p[0] = p[1] = p[2] = p[3] = ' '; 301 log_msg(1, "new command = '%s'", command); 302 } 303 } 304 log_msg(3, "Attempt #%d failed. Pausing 3 seconds and retrying...", tries + 1); 364 305 sleep(3); 365 306 } 366 307 } 367 paranoid_free(command);308 mr_free(command); 368 309 369 310 retval += res; … … 371 312 log_msg(3, "Failed to write set %d", setno); 372 313 } else if (tries > 1) { 373 log_msg(3, "Succeeded in writing set %d, on try #%d", setno, 374 tries); 314 log_msg(3, "Succeeded in writing set %d, on try #%d", setno, tries); 375 315 } 376 316 … … 2138 2078 2139 2079 log_msg(1, "Archiving set %ld", curr_set_no); 2140 res = 2141 archive_this_fileset(curr_filelist_fname, 2142 curr_afioball_fname, curr_set_no); 2080 res = archive_this_fileset(curr_filelist_fname, curr_afioball_fname, curr_set_no); 2143 2081 retval += res; 2144 2082 if (res) { -
branches/3.2/mondo/src/common/libmondo-archive.h
r1885 r3464 36 36 int call_growisofs(char *destfile); 37 37 int make_afioballs_and_images_SINGLETHREAD(); 38 int archive_this_fileset_with_star(39 char *filelist, char *fname, int setno);40 38 void setenv_mondo_share(void);
Note:
See TracChangeset
for help on using the changeset viewer.