Changeset 3272 for branches/3.2


Ignore:
Timestamp:
Apr 29, 2014, 9:24:56 PM (5 years ago)
Author:
bruno
Message:
  • Removes now useles code from the C part which has been moved into mr-net-get-config (remains to handle bonding cases)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mondo/src/common/libmondo-files.c

    r3238 r3272  
    11121112
    11131113    log_it("Storing Network configuration");
    1114     mr_asprintf(tmp, "%s", bkpinfo->netfs_mount);
    1115     p = strchr(tmp, ':');
    1116     if (!p) {
    1117         fatal_error("Network mount doesn't have a colon in it, e.g. 192.168.1.4:/home/nfs");
    1118     }
    1119     *(p++) = '\0';
    1120     mr_asprintf(netfs_server_ipaddr, "%s", tmp);
    1121     mr_asprintf(netfs_mount, "%s", p);
    1122     mr_free(tmp);
    1123 
    1124     /* BERLIOS : there is a bug #67 here as it only considers the first NIC */
    1125     mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\n' | head -n1 | cut -d' ' -f1");
    1126     mr_asprintf(netfs_dev, "%s", call_program_and_get_last_line_of_output(command));
    1127     mr_free(command);
    1128 
    1129     mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f7 | cut -d':' -f2");
    1130     mr_asprintf(netfs_client_ipaddr, "%s", call_program_and_get_last_line_of_output(command));
    1131     mr_free(command);
    1132 
    1133     mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f9 | cut -d':' -f2");
    1134     mr_asprintf(netfs_client_netmask, "%s", call_program_and_get_last_line_of_output(command));
    1135     mr_free(command);
    1136 
    1137     mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f8 | cut -d':' -f2");
    1138     mr_asprintf(netfs_client_broadcast, "%s", call_program_and_get_last_line_of_output(command));
    1139     mr_free(command);
    1140 
    1141     mr_asprintf(command, "%s", "route -n | grep '^0.0.0.0' | awk '{print $2}'");
    1142     mr_asprintf(netfs_client_defgw, "%s", call_program_and_get_last_line_of_output(command));
    1143     mr_free(command);
    1144 
    1145     mr_asprintf(command, "ifconfig %s | head -1 | awk '{print $5}'", netfs_dev);
    1146     mr_asprintf(netfs_client_hwaddr, "%s", call_program_and_get_last_line_of_output(command));
    1147     mr_free(command);
    1148 
    1149     log_it("netfs_client_hwaddr=%s; netfs_client_ipaddr=%s; netfs_server_ipaddr=%s; netfs_mount=%s", netfs_client_hwaddr, netfs_client_ipaddr, netfs_server_ipaddr, netfs_mount);
    1150     if (strlen(netfs_dev) < 2) {
    1151         fatal_error("Unable to find ethN (eth0, eth1, ...) adapter via Network mount you specified.");
    1152     }
    11531114
    11541115    /********
     
    11691130    }
    11701131
    1171     mr_asprintf(tmp, "%s/NETFS-DEV", bkpinfo->tmpdir);
    1172     write_one_liner_data_file(tmp, netfs_dev);
    1173     mr_free(netfs_dev);
    1174     mr_free(tmp);
    1175 
    1176     mr_asprintf(tmp, "%s/NETFS-CLIENT-HWADDR", bkpinfo->tmpdir);
    1177     write_one_liner_data_file(tmp, netfs_client_hwaddr);
    1178     mr_free(netfs_client_hwaddr);
    1179     mr_free(tmp);
    1180 
    1181     mr_asprintf(tmp, "%s/NETFS-CLIENT-IPADDR", bkpinfo->tmpdir);
    1182     write_one_liner_data_file(tmp, netfs_client_ipaddr);
    1183     mr_free(netfs_client_ipaddr);
    1184     mr_free(tmp);
    1185 
    1186     mr_asprintf(tmp, "%s/NETFS-CLIENT-NETMASK", bkpinfo->tmpdir);
    1187     write_one_liner_data_file(tmp, netfs_client_netmask);
    1188     mr_free(netfs_client_netmask);
    1189     mr_free(tmp);
    1190 
    1191     mr_asprintf(tmp, "%s/NETFS-CLIENT-BROADCAST", bkpinfo->tmpdir);
    1192     write_one_liner_data_file(tmp, netfs_client_broadcast);
    1193     mr_free(netfs_client_broadcast);
    1194     mr_free(tmp);
    1195 
    1196     mr_asprintf(tmp, "%s/NETFS-CLIENT-DEFGW", bkpinfo->tmpdir);
    1197     write_one_liner_data_file(tmp, netfs_client_defgw);
    1198     mr_free(netfs_client_defgw);
    1199     mr_free(tmp);
    1200 
    1201     mr_asprintf(tmp, "%s/NETFS-SERVER-IPADDR", bkpinfo->tmpdir);
    1202     write_one_liner_data_file(tmp, netfs_server_ipaddr);
    1203     mr_free(netfs_server_ipaddr);
    1204     mr_free(tmp);
    1205 
    1206     mr_asprintf(tmp, "%s/NETFS-SERVER-MOUNT", bkpinfo->tmpdir);
    1207     write_one_liner_data_file(tmp, bkpinfo->netfs_mount);
    1208     mr_free(tmp);
    1209 
    1210     if (bkpinfo->netfs_user) {
    1211         mr_asprintf(tmp, "%s/NETFS-SERVER-USER", bkpinfo->tmpdir);
    1212         write_one_liner_data_file(tmp, bkpinfo->netfs_user);
    1213         mr_free(tmp);
    1214     }
    1215     mr_asprintf(tmp, "%s/NETFS-SERVER-PATH", bkpinfo->tmpdir);
    1216     write_one_liner_data_file(tmp, bkpinfo->netfs_remote_dir);
    1217     mr_free(tmp);
    1218 
    1219     mr_asprintf(tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir);
    1220     write_one_liner_data_file(tmp, bkpinfo->prefix);
    1221     mr_free(tmp);
    1222 
    1223     mr_asprintf(tmp, "%s/NETFS-PROTO", bkpinfo->tmpdir);
    1224     write_one_liner_data_file(tmp, bkpinfo->netfs_proto);
    1225     mr_free(tmp);
    1226 
    1227 
    12281132    log_it("Finished storing Network configuration");
    12291133}
Note: See TracChangeset for help on using the changeset viewer.