Changeset 2704 in MondoRescue for branches/2.2.10/mondo/src/common/libmondo-devices.c
- Timestamp:
- Jan 27, 2011, 7:31:24 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-devices.c
r2696 r2704 532 532 if (tmp1) { 533 533 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); 535 535 mr_free(command); 536 536 } … … 812 812 813 813 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); 815 815 mr_free(command); 816 816 … … 840 840 } 841 841 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); 843 843 log_msg(5, "tmp = '%s'", tmp); 844 844 if (!tmp[0]) 845 845 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); 847 847 if (tmp[0]) { 848 848 devno = atoi(tmp) - 1; … … 1107 1107 int i = 2; 1108 1108 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); 1110 1110 i = atoi(tmp); 1111 1111 mr_free(tmp); … … 1122 1122 } else { 1123 1123 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); 1125 1125 if (!strstr(mddevice, "md")) { 1126 1126 return NULL; … … 1152 1152 } 1153 1153 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); 1155 1155 i = atoi(tmp); 1156 1156 mr_free(tmp); … … 1583 1583 mr_asprintf(command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $0}}'|wc -l"); 1584 1584 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); 1586 1586 mr_free(command); 1587 1587 … … 1593 1593 mr_asprintf(command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $1,$3}}'|head -n %d", i); 1594 1594 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); 1596 1596 mr_free(command); 1597 1597 … … 1673 1673 mr_asprintf(command, "ls -al %s 2>/dev/null | wc -l", dsf); 1674 1674 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); 1676 1676 mr_free(command); 1677 1677 … … 1699 1699 mr_asprintf(command, "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf); 1700 1700 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); 1702 1702 mr_free(command); 1703 1703 … … 1767 1767 mr_asprintf(command, "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'", ndsf, partitions[i]); 1768 1768 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); 1770 1770 mr_free(command); 1771 1771 … … 1781 1781 /* It's not swap. See if we can find the mount point from the mount command. */ 1782 1782 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); 1784 1784 mr_free(command); 1785 1785 … … 1803 1803 mr_asprintf(command, "pvdisplay -c %s | grep '%s:' 2> /dev/null", partitions[i], partitions[i]); 1804 1804 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); 1806 1806 mr_free(command); 1807 1807 … … 1811 1811 mr_asprintf(command, "pvdisplay -v %s 2>/dev/null|grep \"VG Name\"|awk '{print $NF}'", partitions[i]); 1812 1812 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)); 1814 1814 mr_free(command); 1815 1815 … … 1820 1820 mr_asprintf(command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s-|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG); 1821 1821 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)); 1823 1823 mr_free(command); 1824 1824 … … 1844 1844 mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'"); 1845 1845 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)); 1847 1847 mr_free(command); 1848 1848 … … 1853 1853 log_msg (5, "Running: %s", command); 1854 1854 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)); 1856 1856 mr_free(command); 1857 1857 … … 1889 1889 mr_asprintf(command, "mdadm --examine %s 2>/dev/null | awk '{if($1 == \"UUID\"){print $3}}'", partitions[i]); 1890 1890 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); 1892 1892 mr_free(command); 1893 1893 … … 1902 1902 mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'"); 1903 1903 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); 1905 1905 mr_free(command); 1906 1906 … … 1913 1913 mr_free(tmp); 1914 1914 1915 tmp = call_program_and_get_last_line_of_output(command );1915 tmp = call_program_and_get_last_line_of_output(command,TRUE); 1916 1916 mr_free(command); 1917 1917 … … 2076 2076 2077 2077 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); 2079 2079 snprintf(result_sz, 1023, "%s %s", exclude_these_directories, exclude_these_devices); 2080 2080 mr_free(exclude_these_devices); … … 2097 2097 static char result_sz[512]; 2098 2098 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); 2100 2100 snprintf(result_sz, 511, "%s", exclude_these_directories); 2101 2101 mr_free(exclude_these_directories); … … 2149 2149 2150 2150 #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); 2152 2152 #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); 2154 2154 #endif 2155 2155 … … 2245 2245 if (g_ISO_restore_mode) { 2246 2246 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); 2248 2248 mr_strcat(mountdev, "/archives/THIS-CD-NUMBER"); 2249 2249 mr_free(tmp); … … 2299 2299 2300 2300 #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); 2302 2302 #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); 2304 2304 if (strstr(output, "/dev/cciss/")) { 2305 2305 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); 2307 2307 } 2308 2308 if (strstr(output, "/dev/md")) { 2309 2309 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); 2311 2311 } 2312 2312 #endif … … 2546 2546 log_msg(1, "curr_fname = %s", curr_fname); 2547 2547 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); 2549 2549 mr_free(command); 2550 2550 for (p = tmp + strlen(tmp); p != tmp && *p != '`' && *p != ' '; p--); … … 2596 2596 mr_free(fdisk); 2597 2597 2598 tmp = call_program_and_get_last_line_of_output(command );2598 tmp = call_program_and_get_last_line_of_output(command,TRUE); 2599 2599 mr_free(command); 2600 2600 … … 2874 2874 /* Initiate bkpinfo netfs_mount path from running environment if not already done */ 2875 2875 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); 2877 2877 } 2878 2878 #ifdef __FreeBSD__ … … 2903 2903 mr_asprintf(command, "mount | grep \"%s \" | cut -d' ' -f3", bkpinfo->netfs_mount); 2904 2904 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); 2906 2906 mr_free(command); 2907 2907 … … 2953 2953 mr_free(bkpinfo->isodir); 2954 2954 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); 2956 2956 2957 2957 } else { … … 3060 3060 #ifdef __FreeBSD__ 3061 3061 #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); 3063 3063 #else 3064 3064 #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); 3066 3066 #endif 3067 3067 i = which_boot_loader(bkpinfo->boot_device); … … 3120 3120 mr_free(tmp); 3121 3121 // 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); 3123 3123 if (strlen(tmp) > 2) { 3124 3124 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.