Changeset 149 in MondoRescue for trunk/mondo/mondo/common


Ignore:
Timestamp:
Dec 3, 2005, 11:38:14 PM (18 years ago)
Author:
bcornec
Message:

merge -r144:148 $SVN_M/branches/2.05

Location:
trunk/mondo/mondo/common
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/mondo/mondo/common/libmondo-files.c

    r145 r149  
    11921192    char nfs_mount[MAX_STR_LEN];
    11931193    char nfs_client_ipaddr[MAX_STR_LEN];
     1194    char nfs_client_netmask[MAX_STR_LEN];
     1195    char nfs_client_defgw[MAX_STR_LEN];
    11941196    char nfs_server_ipaddr[MAX_STR_LEN];
    11951197    char tmp[MAX_STR_LEN];
     
    12191221    strcpy(nfs_client_ipaddr,
    12201222           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));
    12211231    sprintf(tmp,
    12221232            "nfs_client_ipaddr=%s; nfs_server_ipaddr=%s; nfs_mount=%s",
     
    12331243    }
    12341244    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);
    12371248    fprintf(fout, "ping -c 1 %s # ping server\n", nfs_server_ipaddr);
    12381249    fprintf(fout, "mount -t nfs -o nolock %s /tmp/isodir\n",
     
    12531264    sprintf(tmp, "%s/NFS-CLIENT-IPADDR", bkpinfo->tmpdir);
    12541265    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);
    12551270    sprintf(tmp, "%s/NFS-SERVER-IPADDR", bkpinfo->tmpdir);
    12561271    write_one_liner_data_file(tmp, nfs_server_ipaddr);
     
    12591274    sprintf(tmp, "%s/NFS-SERVER-PATH", bkpinfo->tmpdir);
    12601275    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);
    12611278    log_it("Finished storing NFS configuration");
    12621279}
  • trunk/mondo/mondo/common/libmondo-tools.c

    r146 r149  
    607607        log_it("isodir: %s", iso_path);
    608608        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);
    610613/* End patch */
    611614    }                           // end of iso code
     
    743746        strcpy(bkpinfo->isodir, "/root/images/mondo");
    744747    }
    745     strcpy(bkpinfo->prefix, "mondorescue");
     748    strcpy(bkpinfo->prefix, STD_PREFIX);
    746749
    747750    bkpinfo->scratchdir[0] = '\0';
     
    10411044        return (0);
    10421045    } 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);
    10451048        strcpy(value, call_program_and_get_last_line_of_output(command));
    10461049        paranoid_free(command);
     
    12751278             ("mktemp -q /tmp/mojo-jojo.blah.XXXXXX"));
    12761279    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);
    12791282        paranoid_system(command);
    12801283        paranoid_free(command);
  • trunk/mondo/mondo/common/my-stuff.h

    r146 r149  
    8080
    8181#define IA64_BOOT_SIZE "8192"   /* Should be coherent with mindi */
     82#define STD_PREFIX "mondorescue"    /* Should be coherent with mindi */
    8283
    8384/**
Note: See TracChangeset for help on using the changeset viewer.