Changeset 127 in MondoRescue for trunk/mondo/mondo/common/libmondo-tools.c


Ignore:
Timestamp:
Nov 19, 2005, 2:27:31 AM (18 years ago)
Author:
bcornec
Message:

merge -r 125:126 $SVN_M/branches/2.05

File:
1 edited

Legend:

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

    r94 r127  
    168168
    169169    asprintf(&tmp,
    170           "for i in `find /root /home -type d -name Desktop -maxdepth 2`; do \
     170            "for i in `find /root /home -type d -name Desktop -maxdepth 2`; do \
    171171file=$i/.directory; if [ -f \"$file\" ] ; then mv -f $file $file.old ; \
    172172cat $file.old | awk '{if (index($0, \"rootimagesmindi\")) { while (length($0)>2) { getline;} ; } \
     
    189189
    190190    asprintf(&home_sz,
    191           call_program_and_get_last_line_of_output
    192           ("find /usr/lib/ /usr/local/ /usr/share/ /usr/local/share/ /opt/ /ramdisk/usr/share/ -type d -maxdepth 2 -name include -prune -o -type d -maxdepth 2 -path '*/mondo/restore-scripts' -printf '%h\n' 2> /dev/null"));
     191            call_program_and_get_last_line_of_output
     192            ("find /usr/lib/ /usr/local/ /usr/share/ /usr/local/share/ /opt/ /ramdisk/usr/share/ -type d -maxdepth 2 -name include -prune -o -type d -maxdepth 2 -path '*/mondo/restore-scripts' -printf '%h\n' 2> /dev/null"));
    193193
    194194    if (home_sz[0] == '\0') {
    195195        paranoid_free(home_sz);
    196196        asprintf(&home_sz,
    197               call_program_and_get_last_line_of_output
    198               ("find /usr -type d -path '*/mondo/restore-scripts' -follow -maxdepth 3 -printf '%h\n' 2> /dev/null"));
     197                call_program_and_get_last_line_of_output
     198                ("find /usr -type d -path '*/mondo/restore-scripts' -follow -maxdepth 3 -printf '%h\n' 2> /dev/null"));
    199199    }
    200200    if (home_sz[0] == '\0') {
     
    402402#ifdef __FreeBSD__
    403403    asprintf(&tmp,
    404           call_program_and_get_last_line_of_output
    405           ("vmstat | tail -1 | tr -s ' ' | cut -d' ' -f6"));
     404            call_program_and_get_last_line_of_output
     405            ("vmstat | tail -1 | tr -s ' ' | cut -d' ' -f6"));
    406406    avm += atol(tmp);
    407407    paranoid_free(tmp);
    408408    asprintf(&tmp,
    409           call_program_and_get_last_line_of_output
    410           ("swapinfo | grep -v Device | tr -s ' ' | cut -d' ' -f4 | tr '\n' '+' | sed 's/+$//' | bc"));
     409            call_program_and_get_last_line_of_output
     410            ("swapinfo | grep -v Device | tr -s ' ' | cut -d' ' -f4 | tr '\n' '+' | sed 's/+$//' | bc"));
    411411    avm += atol(tmp);
    412412    paranoid_free(tmp);
    413413    asprintf(&command, "mdmfs -s %d%c md9 %s", rdsiz_MB, 'm',
    414             g_tmpfs_mountpt);
     414             g_tmpfs_mountpt);
    415415#else
    416416    asprintf(&tmp,
    417           call_program_and_get_last_line_of_output
    418           ("free | grep \":\" | tr -s ' ' '\t' | cut -f2 | head -n1"));
     417            call_program_and_get_last_line_of_output
     418            ("free | grep \":\" | tr -s ' ' '\t' | cut -f2 | head -n1"));
    419419    avm += atol(tmp);
    420420    paranoid_free(tmp);
    421421    asprintf(&command, "mount /dev/shm -t tmpfs %s -o size=%d%c",
    422             g_tmpfs_mountpt, rdsiz_MB, 'm');
     422             g_tmpfs_mountpt, rdsiz_MB, 'm');
    423423    run_program_and_log_output("cat /proc/cpuinfo", 5);
    424424    /* BERLIOS: rpm is not necessarily there ! */
     
    453453
    454454    if (bkpinfo->backup_media_type == dvd) {
    455         if (! (find_home_of_exe("growisofs"))) {
     455        if (!(find_home_of_exe("growisofs"))) {
    456456            fatal_error("Please install growisofs.");
    457457        }
     
    483483            sprintf(bkpinfo->call_make_iso,
    484484                    "%s %s -Z %s . 2>> _ERR_",
    485                     mondo_mkisofs_sz,
    486                     "", bkpinfo->media_device);
     485                    mondo_mkisofs_sz, "", bkpinfo->media_device);
    487486        }
    488487        paranoid_free(mondo_mkisofs_sz);
     
    572571        log_it("isodir = %s", bkpinfo->isodir);
    573572        asprintf(&command, "df %s | tail -n1 | cut -d' ' -f1",
    574                 bkpinfo->isodir);
     573                 bkpinfo->isodir);
    575574        log_it("command = %s", command);
    576575        asprintf(&tmp, call_program_and_get_last_line_of_output(command));
     
    582581
    583582        asprintf(&command, "mount | grep -w %s | tail -n1 | cut -d' ' -f3",
    584                 tmp);
     583                 tmp);
    585584        paranoid_free(tmp);
    586585        log_it("command = %s", command);
     
    595594        log_it("isomnt: %s, %d", tmp, strlen(tmp));
    596595        if (strlen(bkpinfo->isodir) < strlen(tmp)) {
    597             asprintf(&iso_path,"");
     596            asprintf(&iso_path, "");
    598597        } else {
    599598            asprintf(&iso_path, "%s", bkpinfo->isodir + strlen(tmp));
     
    627626            } else {
    628627                asprintf(&ip_address, "%s%s", inet_ntoa((struct in_addr)
    629                                              *((struct in_addr *) hent->
    630                                                h_addr)), strchr(bkpinfo->nfs_mount, ':'));
     628                                                        *((struct in_addr
     629                                                           *) hent->
     630                                                          h_addr)),
     631                         strchr(bkpinfo->nfs_mount, ':'));
    631632                strcpy(bkpinfo->nfs_mount, ip_address);
    632633                paranoid_free(ip_address);
     
    789790
    790791    asprintf(&command, "df -m %s | tail -n1 | tr -s ' ' '\t' | cut -f4",
    791             partition);
     792             partition);
    792793    asprintf(&out_sz, call_program_and_get_last_line_of_output(command));
    793794    paranoid_free(command);
     
    836837    }
    837838    asprintf(&tmp,
    838           call_program_and_get_last_line_of_output
    839           ("free | grep Mem | head -n1 | tr -s ' ' '\t' | cut -f2"));
     839            call_program_and_get_last_line_of_output
     840            ("free | grep Mem | head -n1 | tr -s ' ' '\t' | cut -f2"));
    840841    if (atol(tmp) < 35000) {
    841842        retval++;
     
    926927        ("umount `mount | grep cdr | cut -d' ' -f3 | tr '\n' ' '`", 5);
    927928    asprintf(&tmp,
    928           call_program_and_get_last_line_of_output
    929           ("mount | grep -E \"cdr(om|w)\""));
     929            call_program_and_get_last_line_of_output
     930            ("mount | grep -E \"cdr(om|w)\""));
    930931    if (strcmp("", tmp)) {
    931932        if (strstr(tmp, "autofs")) {
     
    10271028    if (!does_file_exist(config_file)) {
    10281029        asprintf(&tmp, "(read_cfg_var) Cannot find %s config file",
    1029                 config_file);
     1030                 config_file);
    10301031        log_to_screen(tmp);
    10311032        paranoid_free(tmp);
     
    10391040    } else {
    10401041        asprintf(&command, "cat %s | grep \"%s .*\" | cut -d' ' -f2,3,4,5",
    1041                 config_file, label);
     1042                 config_file, label);
    10421043        strcpy(value, call_program_and_get_last_line_of_output(command));
    10431044        paranoid_free(command);
     
    11501151        log_it("Started autofs OK");
    11511152    }
    1152         paranoid_free(tmp);
     1153    paranoid_free(tmp);
    11531154}
    11541155
     
    11681169    log_msg(4, "Done. Great. Seeting command to something");
    11691170    asprintf(&command,
    1170           "cat /etc/fstab | grep -v \":\" | grep -vx \"#.*\" | grep -w \"/boot\" | tr -s ' ' '\t' | cut -f1 | head -n1");
     1171            "cat /etc/fstab | grep -v \":\" | grep -vx \"#.*\" | grep -w \"/boot\" | tr -s ' ' '\t' | cut -f1 | head -n1");
    11711172    log_msg(4, "Cool. Command = '%s'", command);
    11721173    asprintf(&tmp, call_program_and_get_last_line_of_output(command));
     
    11911192                asprintf(&g_boot_mountpt, tmp);
    11921193                asprintf(&tmp1,
    1193                         "%s (your /boot partition) is not mounted. I'll mount it before backing up",
    1194                         g_boot_mountpt);
     1194                         "%s (your /boot partition) is not mounted. I'll mount it before backing up",
     1195                         g_boot_mountpt);
    11951196                log_it(tmp1);
    11961197                paranoid_free(tmp1);
     
    12631264    if (!does_file_exist(config_file)) {
    12641265        asprintf(&tmp, "(write_cfg_file) Cannot find %s config file",
    1265                 config_file);
     1266                 config_file);
    12661267        log_to_screen(tmp);
    12671268        paranoid_free(tmp);
     
    12691270    }
    12701271    asprintf(&tempfile,
    1271           call_program_and_get_last_line_of_output
    1272           ("mktemp -q /tmp/mojo-jojo.blah.XXXXXX"));
     1272            call_program_and_get_last_line_of_output
     1273            ("mktemp -q /tmp/mojo-jojo.blah.XXXXXX"));
    12731274    if (does_file_exist(config_file)) {
    12741275        asprintf(&command, "cat %s | grep -vx \"%s .*\" > %s", config_file,
    1275                 label, tempfile);
     1276                 label, tempfile);
    12761277        paranoid_system(command);
    12771278        paranoid_free(command);
Note: See TracChangeset for help on using the changeset viewer.