Changeset 149 in MondoRescue for trunk/mondo
- Timestamp:
- Dec 3, 2005, 11:38:14 PM (18 years ago)
- Location:
- trunk/mondo/mondo
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mondo/mondo/common/libmondo-files.c
r145 r149 1192 1192 char nfs_mount[MAX_STR_LEN]; 1193 1193 char nfs_client_ipaddr[MAX_STR_LEN]; 1194 char nfs_client_netmask[MAX_STR_LEN]; 1195 char nfs_client_defgw[MAX_STR_LEN]; 1194 1196 char nfs_server_ipaddr[MAX_STR_LEN]; 1195 1197 char tmp[MAX_STR_LEN]; … … 1219 1221 strcpy(nfs_client_ipaddr, 1220 1222 call_program_and_get_last_line_of_output(command)); 1223 sprintf(command, 1224 "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f9 | cut -d':' -f2"); 1225 strcpy(nfs_client_netmask, 1226 call_program_and_get_last_line_of_output(command)); 1227 sprintf(command, 1228 "route | egrep '^default' | awk '{printf $2}'"); 1229 strcpy(nfs_client_defgw, 1230 call_program_and_get_last_line_of_output(command)); 1221 1231 sprintf(tmp, 1222 1232 "nfs_client_ipaddr=%s; nfs_server_ipaddr=%s; nfs_mount=%s", … … 1233 1243 } 1234 1244 fprintf(fout, "ifconfig lo 127.0.0.1 # config loopback\n"); 1235 fprintf(fout, "ifconfig %s %s # config client\n", nfs_dev, 1236 nfs_client_ipaddr); 1245 fprintf(fout, "ifconfig %s %s netmask %s # config client\n", nfs_dev, 1246 nfs_client_ipaddr, nfs_client_netmask); 1247 fprintf(fout, "route add default gw %s # default route\n", nfs_client_defgw); 1237 1248 fprintf(fout, "ping -c 1 %s # ping server\n", nfs_server_ipaddr); 1238 1249 fprintf(fout, "mount -t nfs -o nolock %s /tmp/isodir\n", … … 1253 1264 sprintf(tmp, "%s/NFS-CLIENT-IPADDR", bkpinfo->tmpdir); 1254 1265 write_one_liner_data_file(tmp, nfs_client_ipaddr); 1266 sprintf(tmp, "%s/NFS-CLIENT-NETMASK", bkpinfo->tmpdir); 1267 write_one_liner_data_file(tmp, nfs_client_netmask); 1268 sprintf(tmp, "%s/NFS-CLIENT-DEFGW", bkpinfo->tmpdir); 1269 write_one_liner_data_file(tmp, nfs_client_defgw); 1255 1270 sprintf(tmp, "%s/NFS-SERVER-IPADDR", bkpinfo->tmpdir); 1256 1271 write_one_liner_data_file(tmp, nfs_server_ipaddr); … … 1259 1274 sprintf(tmp, "%s/NFS-SERVER-PATH", bkpinfo->tmpdir); 1260 1275 write_one_liner_data_file(tmp, bkpinfo->nfs_remote_dir); 1276 sprintf(tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir); 1277 write_one_liner_data_file(tmp, bkpinfo->prefix); 1261 1278 log_it("Finished storing NFS configuration"); 1262 1279 } -
trunk/mondo/mondo/common/libmondo-tools.c
r146 r149 607 607 log_it("isodir: %s", iso_path); 608 608 paranoid_free(iso_path); 609 609 asprintf(&tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir); 610 write_one_liner_data_file(tmp, bkpinfo->prefix); 611 log_it("iso-prefix: %s", bkpinfo->prefix); 612 paranoid_free(tmp); 610 613 /* End patch */ 611 614 } // end of iso code … … 743 746 strcpy(bkpinfo->isodir, "/root/images/mondo"); 744 747 } 745 strcpy(bkpinfo->prefix, "mondorescue");748 strcpy(bkpinfo->prefix, STD_PREFIX); 746 749 747 750 bkpinfo->scratchdir[0] = '\0'; … … 1041 1044 return (0); 1042 1045 } else { 1043 asprintf(&command, " cat %s | grep \"%s .*\"| cut -d' ' -f2,3,4,5",1044 config_file, label);1046 asprintf(&command, "grep '%s .*' %s| cut -d' ' -f2,3,4,5", 1047 label, config_file); 1045 1048 strcpy(value, call_program_and_get_last_line_of_output(command)); 1046 1049 paranoid_free(command); … … 1275 1278 ("mktemp -q /tmp/mojo-jojo.blah.XXXXXX")); 1276 1279 if (does_file_exist(config_file)) { 1277 asprintf(&command, " cat %s | grep -vx \"%s .*\" > %s", config_file,1278 label, tempfile);1280 asprintf(&command, "grep -vx '%s .*' %s > %s", 1281 label, config_file, tempfile); 1279 1282 paranoid_system(command); 1280 1283 paranoid_free(command); -
trunk/mondo/mondo/common/my-stuff.h
r146 r149 80 80 81 81 #define IA64_BOOT_SIZE "8192" /* Should be coherent with mindi */ 82 #define STD_PREFIX "mondorescue" /* Should be coherent with mindi */ 82 83 83 84 /** -
trunk/mondo/mondo/mondorestore/mondo-rstr-tools.c
r142 r149 737 737 } 738 738 #ifdef __FreeBSD__ 739 sprintf(mount_cmd, "/mnt/isodir/%s/%s/% d.iso", bkpinfo->isodir,740 bkpinfo->nfs_remote_dir, g_current_media_number);739 sprintf(mount_cmd, "/mnt/isodir/%s/%s/%s-%d.iso", bkpinfo->isodir, 740 bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number); 741 741 mddev = make_vn(mount_cmd); 742 742 sprintf(mount_cmd, "mount_cd9660 -r %s " MNT_CDROM, mddev); 743 743 #else 744 sprintf(mount_cmd, "mount %s/%s/% d.iso -t iso9660 -o loop,ro %s",744 sprintf(mount_cmd, "mount %s/%s/%s-%d.iso -t iso9660 -o loop,ro %s", 745 745 bkpinfo->isodir, bkpinfo->nfs_remote_dir, 746 g_current_media_number, MNT_CDROM);746 bkpinfo->prefix, g_current_media_number, MNT_CDROM); 747 747 #endif 748 748 749 749 } else if (bkpinfo->backup_media_type == iso) { 750 750 #ifdef __FreeBSD__ 751 sprintf(mount_cmd, "%s/% d.iso", bkpinfo->isodir,752 g_current_media_number);751 sprintf(mount_cmd, "%s/%s-%d.iso", bkpinfo->isodir, 752 bkpinfo->prefix, g_current_media_number); 753 753 mddev = make_vn(mount_cmd); 754 754 sprintf(mount_cmd, "mount_cd9660 -r %s %s", mddev, MNT_CDROM); 755 755 #else 756 sprintf(mount_cmd, "mount %s/% d.iso -t iso9660 -o loop,ro %s",757 bkpinfo->isodir, g_current_media_number, MNT_CDROM);756 sprintf(mount_cmd, "mount %s/%s-%d.iso -t iso9660 -o loop,ro %s", 757 bkpinfo->isodir, bkpinfo->prefix, g_current_media_number, MNT_CDROM); 758 758 #endif 759 759 } else if (strstr(bkpinfo->media_device, "/dev/")) … … 1035 1035 } else { 1036 1036 bkpinfo->backup_media_type = iso; 1037 if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) { 1038 strcpy(bkpinfo->prefix,value); 1039 } else { 1040 strcpy(bkpinfo->prefix,STD_PREFIX); 1041 } 1037 1042 } 1038 1043 } 1039 1044 } else if (!strcmp(value, "nfs")) { 1040 1045 bkpinfo->backup_media_type = nfs; 1046 if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) { 1047 strcpy(bkpinfo->prefix,value); 1048 } else { 1049 strcpy(bkpinfo->prefix,STD_PREFIX); 1050 } 1041 1051 } else if (!strcmp(value, "tape")) { 1042 1052 bkpinfo->backup_media_type = tape; … … 1201 1211 } 1202 1212 } 1203 /* bkpinfo->isodir should now be the true path to 1.iso etc... */1213 /* bkpinfo->isodir should now be the true path to prefix-1.iso etc... */ 1204 1214 if (bkpinfo->backup_media_type == iso) { 1205 1215 sprintf(bkpinfo->isodir, "%s%s", iso_mnt, iso_path);
Note:
See TracChangeset
for help on using the changeset viewer.