Changeset 2290 in MondoRescue for branches/2.2.9/mondo/src/common/libmondo-devices.c
- Timestamp:
- Jul 22, 2009, 2:03:44 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mondo/src/common/libmondo-devices.c
r2257 r2290 1148 1148 mr_free(device_with_space); 1149 1149 paranoid_pclose(fin); 1150 mr_asprintf(&tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", 1151 SWAPLIST_COMMAND, device_with_space); 1150 mr_asprintf(&tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", SWAPLIST_COMMAND, device_with_space); 1152 1151 log_msg(4, "tmp (command) = '%s'", tmp); 1153 1152 if (!system(tmp)) { … … 1298 1297 1299 1298 #ifdef __FreeBSD__ 1300 mr_asprintf(&dev, make_vn(device));1299 mr_asprintf(&dev, "%s", make_vn(device)); 1301 1300 if (!dev) { 1302 1301 mr_asprintf(&command, "Unable to mount ISO (make_vn(%s) failed)", device); … … 1315 1314 1316 1315 #ifdef __FreeBSD__ 1317 mr_asprintf(&command, "mount_cd9660 -r %s %s 2>> %s", 1318 device, mountpoint, MONDO_LOGFILE); 1316 mr_asprintf(&command, "mount_cd9660 -r %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE); 1319 1317 1320 1318 #else 1321 mr_asprintf(&command, "mount %s -o %s -t iso9660 %s 2>> %s", 1322 device, options, mountpoint, MONDO_LOGFILE); 1319 mr_asprintf(&command, "mount %s -o %s -t iso9660 %s 2>> %s", device, options, mountpoint, MONDO_LOGFILE); 1323 1320 paranoid_free(options); 1324 1321 #endif … … 1608 1605 if (bkpinfo->media_device[0]) { 1609 1606 if (bkpinfo->backup_media_type == usb) { 1610 mr_asprintf(&tmp, 1611 "I think your %s media corresponds to %s. Is this correct?", mds, 1612 bkpinfo->media_device); 1607 mr_asprintf(&tmp, "I think your %s media corresponds to %s. Is this correct?", mds, bkpinfo->media_device); 1613 1608 } else { 1614 mr_asprintf(&tmp, 1615 "I think I've found your %s burner at SCSI node %s. Is this correct? (Say no if you have an IDE burner and you are running a 2.6 kernel. You will then be prompted for further details.)", mds, 1616 bkpinfo->media_device); 1609 mr_asprintf(&tmp, "I think I've found your %s burner at SCSI node %s. Is this correct? (Say no if you have an IDE burner and you are running a 2.6 kernel. You will then be prompted for further details.)", mds, bkpinfo->media_device); 1617 1610 } 1618 1611 if (!ask_me_yes_or_no(tmp)) { … … 1682 1675 } 1683 1676 if (bkpinfo->media_device[0]) { 1684 mr_asprintf(&tmp, 1685 "I think I've found your tape streamer at %s; am I right on the money?", 1686 bkpinfo->media_device); 1677 mr_asprintf(&tmp, "I think I've found your tape streamer at %s; am I right on the money?", bkpinfo->media_device); 1687 1678 if (!ask_me_yes_or_no(tmp)) { 1688 1679 bkpinfo->media_device[0] = '\0'; … … 1811 1802 sprintf(command, "mkdir -p %s", bkpinfo->isodir); 1812 1803 run_program_and_log_output(command, 5); 1813 mr_asprintf(&tmp, "mount -t nfs -o nolock %s %s", bkpinfo->nfs_mount, 1814 bkpinfo->isodir); 1804 mr_asprintf(&tmp, "mount -t nfs -o nolock %s %s", bkpinfo->nfs_mount, bkpinfo->isodir); 1815 1805 run_program_and_log_output(tmp, 3); 1816 1806 mr_free(tmp); … … 1824 1814 finish(1); 1825 1815 } 1826 mr_asprintf(&tmp, bkpinfo->nfs_remote_dir);1816 mr_asprintf(&tmp, "%s", bkpinfo->nfs_remote_dir); 1827 1817 if (!popup_and_get_string 1828 1818 ("Directory", "Which directory within that mountpoint?", tmp, … … 1976 1966 mr_free(tmp); 1977 1967 // NTFS 1978 mr_asprintf(&tmp, "%s", 1979 call_program_and_get_last_line_of_output 1980 ("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'")); 1968 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'")); 1981 1969 if (strlen(tmp) > 2) { 1982 1970 if (!popup_and_get_string … … 2106 2094 2107 2095 mr_asprintf(&exclude_these_directories,"%s",list_of_NFS_mounts_only()); 2108 mr_asprintf(&exclude_these_devices,"%s", 2109 call_program_and_get_last_line_of_output 2110 ("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'")); 2096 mr_asprintf(&exclude_these_devices,"%s", call_program_and_get_last_line_of_output("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'")); 2111 2097 snprintf(result_sz, 1023, "%s %s", exclude_these_directories, exclude_these_devices); 2112 2098 mr_free(exclude_these_devices); … … 2129 2115 static char result_sz[512]; 2130 2116 2131 mr_asprintf(&exclude_these_directories,"%s", 2132 call_program_and_get_last_line_of_output 2133 ("mount -t coda,ncpfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'")); 2117 mr_asprintf(&exclude_these_directories,"%s", call_program_and_get_last_line_of_output("mount -t coda,ncpfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'")); 2134 2118 snprintf(result_sz, 511, "%s", exclude_these_directories); 2135 2119 mr_free(exclude_these_directories); … … 2186 2170 2187 2171 #ifdef __FreeBSD__ 2188 mr_asprintf(&tmp, 2189 call_program_and_get_last_line_of_output 2190 ("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'")); 2172 mr_asprintf(&tmp, "%s", 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 | tr -s '\t' ' ' | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'")); 2191 2173 #else 2192 mr_asprintf(&tmp, 2193 call_program_and_get_last_line_of_output 2194 ("LANGUAGE=C df -m -P -x nfs -x nfs4 -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| sed 's/ /devdev/' | tr -s '\t' ' ' | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'")); 2174 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -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| sed 's/ /devdev/' | tr -s '\t' ' ' | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'")); 2195 2175 #endif 2196 2176 2197 2177 if (tmp[0] != '/') { 2198 mr_asprintf(&sz, tmp);2178 mr_asprintf(&sz, "%s", tmp); 2199 2179 paranoid_free(tmp); 2200 2180 mr_asprintf(&tmp, "/%s", sz); … … 2294 2274 } 2295 2275 2296 mr_asprintf(&mountdev, bkpinfo->media_device);2276 mr_asprintf(&mountdev, "%s", bkpinfo->media_device); 2297 2277 if (!mountdev[0]) { 2298 2278 log_it … … 2427 2407 assert(which_device != NULL); 2428 2408 2429 mr_asprintf(&list_drives_cmd, 2430 "parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s", 2431 where_is_root_mounted()); 2409 mr_asprintf(&list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s", where_is_root_mounted()); 2432 2410 log_it("list_drives_cmd = %s", list_drives_cmd); 2433 2411 … … 2471 2449 } else { 2472 2450 // We need to look on each partition then 2473 mr_asprintf(&list_drives_cmd, 2474 "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/"); 2451 mr_asprintf(&list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/"); 2475 2452 log_it("list_drives_cmd = %s", list_drives_cmd); 2476 2453 … … 2575 2552 log_msg(1, "curr_fname = %s", curr_fname); 2576 2553 sprintf(command, "file %s", curr_fname); 2577 mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));2554 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command)); 2578 2555 for (p = tmp + strlen(tmp); p != tmp && *p != '`' && *p != ' '; 2579 2556 p--); 2580 2557 p++; 2581 mr_asprintf(&scratch, p);2558 mr_asprintf(&scratch, "%s", p); 2582 2559 for (p = scratch; *p != '\0' && *p != '\''; p++); 2583 2560 *p = '\0'; … … 2629 2606 log_msg(1, "Using %s", fdisk); 2630 2607 sprintf(command, "%s -l %s | grep 'EFI GPT'", fdisk, drive); 2631 mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));2608 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command)); 2632 2609 if (strstr(tmp, "GPT") == NULL) { 2633 2610 strcpy(output, "MBR");
Note:
See TracChangeset
for help on using the changeset viewer.