Ignore:
Timestamp:
Jan 27, 2011, 7:31:24 PM (13 years ago)
Author:
Bruno Cornec
Message:

r4180@localhost: bruno | 2011-01-27 10:26:41 +0100

  • Fix multiple port issues from 2.2.9 that prevented mindi to work
  • Change interface of call_program_and_get_last_line_of_output to allow not logging (call to mindi)
  • Status is working boot, but NFS interface broken due to conf file issues
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mondo/src/common/libmondo-devices.c

    r2696 r2704  
    532532    if (tmp1) {
    533533        mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep CD | cut -d' ' -f2 | head -n1", cdr_exe);
    534         tmp = call_program_and_get_last_line_of_output(command);
     534        tmp = call_program_and_get_last_line_of_output(command,TRUE);
    535535        mr_free(command);
    536536    }
     
    812812
    813813    log_msg(1, "command=%s", command);
    814     tmp = call_program_and_get_last_line_of_output(command);
     814    tmp = call_program_and_get_last_line_of_output(command,TRUE);
    815815    mr_free(command);
    816816
     
    840840    }
    841841
    842     tmp = call_program_and_get_last_line_of_output("dvdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1");
     842    tmp = call_program_and_get_last_line_of_output("dvdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1",TRUE);
    843843    log_msg(5, "tmp = '%s'", tmp);
    844844    if (!tmp[0])
    845845        mr_free(tmp);
    846         tmp = call_program_and_get_last_line_of_output("cdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1");
     846        tmp = call_program_and_get_last_line_of_output("cdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1",TRUE);
    847847    if (tmp[0]) {
    848848        devno = atoi(tmp) - 1;
     
    11071107    int i = 2;
    11081108
    1109     tmp = call_program_and_get_last_line_of_output("/sbin/sysctl -n kern.osreldate");
     1109    tmp = call_program_and_get_last_line_of_output("/sbin/sysctl -n kern.osreldate",TRUE);
    11101110    i = atoi(tmp);
    11111111    mr_free(tmp);
     
    11221122    } else {
    11231123        sprintf(command, "mdconfig -a -t vnode -f %s", fname);
    1124         mddevice = call_program_and_get_last_line_of_output(command);
     1124        mddevice = call_program_and_get_last_line_of_output(command,TRUE);
    11251125        if (!strstr(mddevice, "md")) {
    11261126            return NULL;
     
    11521152    }
    11531153
    1154     tmp = call_program_and_get_last_line_of_output("/sbin/sysctl -n kern.osreldate"));
     1154    tmp = call_program_and_get_last_line_of_output("/sbin/sysctl -n kern.osreldate",TRUE);
    11551155    i = atoi(tmp);
    11561156    mr_free(tmp);
     
    15831583    mr_asprintf(command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $0}}'|wc -l");
    15841584    log_msg(5, "Running: %s", command);
    1585     mounted_file_system = call_program_and_get_last_line_of_output(command);
     1585    mounted_file_system = call_program_and_get_last_line_of_output(command,TRUE);
    15861586    mr_free(command);
    15871587
     
    15931593        mr_asprintf(command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $1,$3}}'|head -n %d", i);
    15941594        log_msg(5, "Running: %s", command);
    1595         mounted_file_system = call_program_and_get_last_line_of_output(command);
     1595        mounted_file_system = call_program_and_get_last_line_of_output(command,TRUE);
    15961596        mr_free(command);
    15971597
     
    16731673    mr_asprintf(command, "ls -al %s 2>/dev/null | wc -l", dsf);
    16741674    log_msg(5, "  Executing: %s", command);
    1675     tmp = call_program_and_get_last_line_of_output(command);
     1675    tmp = call_program_and_get_last_line_of_output(command,TRUE);
    16761676    mr_free(command);
    16771677
     
    16991699    mr_asprintf(command, "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf);
    17001700    log_msg(5, "Executing: %s", command);
    1701     partition_list = call_program_and_get_last_line_of_output(command);
     1701    partition_list = call_program_and_get_last_line_of_output(command,TRUE);
    17021702    mr_free(command);
    17031703
     
    17671767        mr_asprintf(command, "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'", ndsf, partitions[i]);
    17681768        log_msg(5, "  Running: %s", command);
    1769         tmp = call_program_and_get_last_line_of_output(command);
     1769        tmp = call_program_and_get_last_line_of_output(command,TRUE);
    17701770        mr_free(command);
    17711771
     
    17811781        /* It's not swap. See if we can find the mount point from the mount command. */
    17821782        mr_asprintf(command, "mount 2>/dev/null | awk '{if((NF>0)&&($1==\"%s\")){print $3}}'", partitions[i]);
    1783         tmp = call_program_and_get_last_line_of_output(command);
     1783        tmp = call_program_and_get_last_line_of_output(command,TRUE);
    17841784        mr_free(command);
    17851785
     
    18031803        mr_asprintf(command, "pvdisplay -c %s | grep '%s:' 2> /dev/null", partitions[i], partitions[i]);
    18041804        log_msg(5, "  Running: %s", command);
    1805         tmp = call_program_and_get_last_line_of_output(command);
     1805        tmp = call_program_and_get_last_line_of_output(command,TRUE);
    18061806        mr_free(command);
    18071807
     
    18111811            mr_asprintf(command, "pvdisplay -v %s 2>/dev/null|grep \"VG Name\"|awk '{print $NF}'", partitions[i]);
    18121812            log_msg(5, "  Running: %s", command);
    1813             strcpy(VG, call_program_and_get_last_line_of_output(command));
     1813            strcpy(VG, call_program_and_get_last_line_of_output(command,TRUE));
    18141814            mr_free(command);
    18151815
     
    18201820                mr_asprintf(command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s-|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG);
    18211821                log_msg(5, "  Running: %s", command);
    1822                 mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command));
     1822                mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command,TRUE));
    18231823                mr_free(command);
    18241824
     
    18441844                mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
    18451845                log_msg (5, "Running: %s", command);
    1846                 mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command));
     1846                mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command,TRUE));
    18471847                mr_free(command);
    18481848
     
    18531853                    log_msg (5, "Running: %s", command);
    18541854                    mr_free(tmp);
    1855                     mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
     1855                    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command,TRUE));
    18561856                    mr_free(command);
    18571857
     
    18891889        mr_asprintf(command, "mdadm --examine %s 2>/dev/null | awk '{if($1 == \"UUID\"){print $3}}'", partitions[i]);
    18901890        log_msg(4, "  Running: %s", command);
    1891         tmp = call_program_and_get_last_line_of_output(command);
     1891        tmp = call_program_and_get_last_line_of_output(command,TRUE);
    18921892        mr_free(command);
    18931893
     
    19021902        mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
    19031903        log_msg (5, "  Running: %s", command);
    1904         mount_list = call_program_and_get_last_line_of_output(command);
     1904        mount_list = call_program_and_get_last_line_of_output(command,TRUE);
    19051905        mr_free(command);
    19061906
     
    19131913            mr_free(tmp);
    19141914
    1915             tmp = call_program_and_get_last_line_of_output(command);
     1915            tmp = call_program_and_get_last_line_of_output(command,TRUE);
    19161916            mr_free(command);
    19171917
     
    20762076
    20772077    mr_asprintf(exclude_these_directories,"%s",list_of_NETFS_mounts_only());
    2078     exclude_these_devices = call_program_and_get_last_line_of_output("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|sshfs|nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'");
     2078    exclude_these_devices = call_program_and_get_last_line_of_output("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|sshfs|nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'",TRUE);
    20792079    snprintf(result_sz, 1023, "%s %s", exclude_these_directories, exclude_these_devices);
    20802080    mr_free(exclude_these_devices);
     
    20972097    static char result_sz[512];
    20982098
    2099     exclude_these_directories = call_program_and_get_last_line_of_output("mount -t coda,ncpfs,fuse.sshfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'");
     2099    exclude_these_directories = call_program_and_get_last_line_of_output("mount -t coda,ncpfs,fuse.sshfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'",TRUE);
    21002100    snprintf(result_sz, 511, "%s", exclude_these_directories);
    21012101    mr_free(exclude_these_directories);
     
    21492149
    21502150#ifdef __FreeBSD__
    2151     tmp = call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;} | while read x ; do test -w $x && echo $x && break ; done'");
     2151    tmp = call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;} | while read x ; do test -w $x && echo $x && break ; done'",TRUE);
    21522152#else
    2153     tmp = call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x fuse.sshfs -x fuse -x vfat -x ntfs -x ntfs-3g -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660 | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}' | while read x ; do test -w $x && echo $x && break ; done");
     2153    tmp = call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x fuse.sshfs -x fuse -x vfat -x ntfs -x ntfs-3g -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660 | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}' | while read x ; do test -w $x && echo $x && break ; done",TRUE);
    21542154#endif
    21552155
     
    22452245    if (g_ISO_restore_mode) {
    22462246        mr_asprintf(tmp, "mount | grep iso9660 | awk '{print $3;}'");
    2247         mountdev = call_program_and_get_last_line_of_output(tmp);
     2247        mountdev = call_program_and_get_last_line_of_output(tmp,TRUE);
    22482248        mr_strcat(mountdev, "/archives/THIS-CD-NUMBER");
    22492249        mr_free(tmp);
     
    22992299
    23002300#ifdef __FreeBSD__
    2301     output = call_program_and_get_last_line_of_output("mount | grep ' on / ' | cut -d' ' -f1");
     2301    output = call_program_and_get_last_line_of_output("mount | grep ' on / ' | cut -d' ' -f1",TRUE);
    23022302#else
    2303     output = call_program_and_get_last_line_of_output("mount | grep ' on / ' | cut -d' ' -f1 | sed 's/[0-9]//' | sed 's/[0-9]//'");
     2303    output = call_program_and_get_last_line_of_output("mount | grep ' on / ' | cut -d' ' -f1 | sed 's/[0-9]//' | sed 's/[0-9]//'",TRUE);
    23042304    if (strstr(output, "/dev/cciss/")) {
    23052305        mr_free(output);
    2306         output = call_program_and_get_last_line_of_output("mount | grep ' on / ' | cut -d' ' -f1 | cut -dp -f1");
     2306        output = call_program_and_get_last_line_of_output("mount | grep ' on / ' | cut -d' ' -f1 | cut -dp -f1",TRUE);
    23072307    }
    23082308    if (strstr(output, "/dev/md")) {
    23092309        mr_free(output);
    2310         output = call_program_and_get_last_line_of_output("mount | grep ' on / ' | cut -d' ' -f1");
     2310        output = call_program_and_get_last_line_of_output("mount | grep ' on / ' | cut -d' ' -f1",TRUE);
    23112311    }
    23122312#endif
     
    25462546            log_msg(1, "curr_fname = %s", curr_fname);
    25472547            mr_asprintf(command, "file %s", curr_fname);
    2548             tmp = call_program_and_get_last_line_of_output(command);
     2548            tmp = call_program_and_get_last_line_of_output(command,TRUE);
    25492549            mr_free(command);
    25502550            for (p = tmp + strlen(tmp); p != tmp && *p != '`' && *p != ' '; p--);
     
    25962596    mr_free(fdisk);
    25972597
    2598     tmp = call_program_and_get_last_line_of_output(command);
     2598    tmp = call_program_and_get_last_line_of_output(command,TRUE);
    25992599    mr_free(command);
    26002600
     
    28742874        /* Initiate bkpinfo netfs_mount path from running environment if not already done */
    28752875        if (bkpinfo->netfs_mount == NULL) {
    2876             bkpinfo->netfs_mount = call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f1 | head -n1");
     2876            bkpinfo->netfs_mount = call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f1 | head -n1",TRUE);
    28772877        }
    28782878#ifdef __FreeBSD__
     
    29032903            mr_asprintf(command, "mount | grep \"%s \" | cut -d' ' -f3", bkpinfo->netfs_mount);
    29042904            mr_free(bkpinfo->isodir);
    2905             bkpinfo->isodir = call_program_and_get_last_line_of_output(command);
     2905            bkpinfo->isodir = call_program_and_get_last_line_of_output(command,TRUE);
    29062906            mr_free(command);
    29072907
     
    29532953        mr_free(bkpinfo->isodir);
    29542954        if (is_this_device_mounted(bkpinfo->netfs_mount)) {
    2955             bkpinfo->isodir = call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f3 | head -n1");
     2955            bkpinfo->isodir = call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f3 | head -n1",TRUE);
    29562956
    29572957        } else {
     
    30603060#ifdef __FreeBSD__
    30613061#define EXAMPLEBD   "/dev/ad0"
    3062         bkpinfo->boot_device = call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'");
     3062        bkpinfo->boot_device = call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'",TRUE);
    30633063#else
    30643064#define EXAMPLEBD   "/dev/hda"
    3065         bkpinfo->boot_device = call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'");
     3065        bkpinfo->boot_device = call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'",TRUE);
    30663066#endif
    30673067        i = which_boot_loader(bkpinfo->boot_device);
     
    31203120        mr_free(tmp);
    31213121// NTFS
    3122         tmp = call_program_and_get_last_line_of_output("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'");
     3122        tmp = call_program_and_get_last_line_of_output("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'",TRUE);
    31233123        if (strlen(tmp) > 2) {
    31243124            p = popup_and_get_string("NTFS partitions", "Please enter/confirm the NTFS partitions you wish to backup as well.", tmp);
Note: See TracChangeset for help on using the changeset viewer.