Changeset 2326 in MondoRescue for branches/2.2.10/mondo/src/common/libmondo-tools.c
- Timestamp:
- Aug 18, 2009, 3:19:54 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-tools.c
r2325 r2326 478 478 479 479 if (bkpinfo->use_lzo) { 480 strcpy(bkpinfo->zip_exe, "lzop");480 mr_asprintf(bkpinfo->zip_exe, "lzop"); 481 481 strcpy(bkpinfo->zip_suffix, "lzo"); 482 482 } else if (bkpinfo->use_gzip) { 483 strcpy(bkpinfo->zip_exe, "gzip");483 mr_asprintf(bkpinfo->zip_exe, "gzip"); 484 484 strcpy(bkpinfo->zip_suffix, "gz"); 485 485 } else if (bkpinfo->compression_level != 0) { 486 strcpy(bkpinfo->zip_exe, "bzip2");486 mr_asprintf(bkpinfo->zip_exe, "bzip2"); 487 487 strcpy(bkpinfo->zip_suffix, "bz2"); 488 } else {489 bkpinfo->zip_exe[0] = bkpinfo->zip_suffix[0] = '\0';490 488 } 491 489 … … 798 796 799 797 mr_free(bkpinfo->media_device); 798 mr_free(bkpinfo->boot_device); 799 mr_free(bkpinfo->zip_exe); 800 800 mr_free(bkpinfo->isodir); 801 801 mr_free(bkpinfo->prefix); … … 827 827 } 828 828 bkpinfo->boot_loader = '\0'; 829 bkpinfo->boot_device [0] = '\0';830 bkpinfo->zip_exe [0] = '\0';829 bkpinfo->boot_device = NULL; 830 bkpinfo->zip_exe = NULL; 831 831 bkpinfo->zip_suffix[0] = '\0'; 832 832 bkpinfo->image_devs[0] = '\0'; … … 1223 1223 * If this is a distribution like Gentoo that doesn't keep /boot mounted, mount it. 1224 1224 */ 1225 void mount_boot_if_necessary() 1226 { 1225 void mount_boot_if_necessary() { 1227 1226 char *tmp = NULL; 1228 1227 char *command = NULL; … … 1238 1237 1239 1238 log_msg(4, "tmp = '%s'", tmp); 1240 if (tmp[0]) { 1241 log_it("/boot is at %s according to /etc/fstab", tmp); 1242 mr_asprintf(command, "mount | grep -Ew '/boot'"); 1243 mr_free(tmp); 1244 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 1245 mr_free(command); 1246 1247 if (!strcmp(tmp,"")) { 1248 if ((strstr(tmp, "LABEL=") || strstr(tmp,"UUID="))) { 1249 if (!run_program_and_log_output("mount /boot", 5)) { 1250 strcpy(g_boot_mountpt, "/boot"); 1251 log_msg(1, "Mounted /boot"); 1252 } else { 1253 log_it("...ignored cos it's a label or uuid :-)"); 1239 log_it("/boot is at %s according to /etc/fstab", tmp); 1240 mr_asprintf(command, "mount | grep -Ew '/boot'"); 1241 mr_free(tmp); 1242 mr_asprintf(tmp, call_program_and_get_last_line_of_output(command)); 1243 mr_free(command); 1244 1245 if (!strcmp(tmp,"")) { 1246 if ((strstr(tmp, "LABEL=") || strstr(tmp,"UUID="))) { 1247 if (!run_program_and_log_output("mount /boot", 5)) { 1248 strcpy(g_boot_mountpt, "/boot"); 1249 log_msg(1, "Mounted /boot"); 1250 } else { 1251 log_it("...ignored cos it's a label or uuid :-)"); 1252 } 1253 } else { 1254 mr_asprintf(command, "mount | grep -E '^%s'", tmp); 1255 log_msg(3, "command = %s", command); 1256 if (run_program_and_log_output(command, 5)) { 1257 strcpy(g_boot_mountpt, tmp); 1258 mr_free(tmp); 1259 log_it("%s (your /boot partition) is not mounted. I'll mount it before backing up", g_boot_mountpt); 1260 1261 mr_asprintf(tmp, "mount %s", g_boot_mountpt); 1262 if (run_program_and_log_output(tmp, 5)) { 1263 g_boot_mountpt[0] = '\0'; 1264 log_msg(1, "Plan B"); 1265 if (!run_program_and_log_output("mount /boot", 5)) { 1266 strcpy(g_boot_mountpt, "/boot"); 1267 log_msg(1, "Plan B worked"); 1268 } else { 1269 log_msg(1, 1270 "Plan B failed. Unable to mount /boot for backup purposes. This probably means /boot is mounted already, or doesn't have its own partition."); 1271 } 1254 1272 } 1255 } else {1256 mr_asprintf(command, "mount | grep -E '^%s'", tmp);1257 log_msg(3, "command = %s", command);1258 if (run_program_and_log_output(command, 5)) {1259 strcpy(g_boot_mountpt, tmp);1260 mr_free(tmp);1261 log_it("%s (your /boot partition) is not mounted. I'll mount it before backing up", g_boot_mountpt);1262 1263 mr_asprintf(tmp, "mount %s", g_boot_mountpt);1264 if (run_program_and_log_output(tmp, 5)) {1265 g_boot_mountpt[0] = '\0';1266 log_msg(1, "Plan B");1267 if (!run_program_and_log_output("mount /boot", 5)) {1268 strcpy(g_boot_mountpt, "/boot");1269 log_msg(1, "Plan B worked");1270 } else {1271 log_msg(1,1272 "Plan B failed. Unable to mount /boot for backup purposes. This probably means /boot is mounted already, or doesn't have its own partition.");1273 }1274 }1275 mr_free(tmp);1276 }1277 mr_free(command);1278 1273 } 1279 } 1280 } 1274 mr_free(command); 1275 } 1276 } 1277 mr_free(tmp); 1281 1278 log_msg(1, "Ended sub"); 1282 1279 }
Note:
See TracChangeset
for help on using the changeset viewer.