Changeset 3742 in MondoRescue for branches/3.3
- Timestamp:
- Nov 18, 2019, 12:02:21 PM (5 years ago)
- Location:
- branches/3.3/MondoRescue
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/MondoRescue/bin/mr-device-mounted
r3650 r3742 62 62 } 63 63 64 my $txt = "";65 my $txt2 = "";66 64 my $ans = ""; 67 65 68 66 if (defined $ARGV[0]) { 69 67 foreach my $i (@ARGV) { 68 my $txt = ""; 69 my $txt2 = ""; 70 70 $ans = mr_device_mounted($i); 71 71 $txt = " not" if (not defined $ans); -
branches/3.3/MondoRescue/lib/MondoRescue/Disk.pm
r3553 r3742 105 105 my $device = shift; 106 106 107 return( 1) if ((not defined $device) || ($device =~ "^/sys|^/proc"));107 return("") if ((not defined $device) || ($device =~ "^/sys|^/proc")); 108 108 109 # Beware of how hashes are handled in these functions 109 110 my $h = mr_file_read_all_link($device); 110 111 # Preserve that hash locally before earsing it to reuse another one … … 114 115 pb_log(2,"Working on device $f\n"); 115 116 # TODO: get them from a conf file - FreeBSD needs swapinfo for swap request 116 foreach my $dev ("mount"," cat/proc/swaps") {117 foreach my $dev ("mount","grep -Ev '^Filename' /proc/swaps") { 117 118 # Look for the device in the command result 118 119 open(MOUNT,"$dev|") || die "Unable to execute the $dev command"; 119 120 while (<MOUNT>) { 120 my ($mntp,$v oid) = split('\s',$_,2);121 my ($mntp,$v1,$dir,$v3) = split('\s',$_,4); 121 122 $h = mr_file_read_all_link($mntp); 122 123 foreach my $m (keys %$h) { … … 124 125 if ($m eq $f) { 125 126 # Find the mountpoint and return it 126 my ($void1,$mountpoint,$void2) = split('\s',$void); 127 pb_log(2,"*** Found $m on $mountpoint\n") if (defined $mountpoint); 128 return($mountpoint); 127 pb_log(2,"*** Found $m on $dir\n") if (defined $dir); 128 # Clean before returning 129 mr_file_erase_hash($h); 130 mr_file_erase_hash($h2); 131 return($dir); 129 132 } 130 133 } 131 m y $h3 = mr_file_copy_and_erase_hash($h);134 mr_file_erase_hash($h); 132 135 } 133 136 close(MOUNT); -
branches/3.3/MondoRescue/lib/MondoRescue/File.pm
r3447 r3742 26 26 27 27 our @ISA = qw(Exporter); 28 our @EXPORT = qw(mr_file_read_all_link mr_file_process_ldd mr_file_normalize mr_file_ copy_and_erase_hash);28 our @EXPORT = qw(mr_file_read_all_link mr_file_process_ldd mr_file_normalize mr_file_erase_hash mr_file_copy_and_erase_hash); 29 29 30 30 =pod … … 86 86 87 87 =item B<mr_file_erase_hash> 88 89 This function erases all elements in the hash passed in parameter (such as the one created in mr_file_read_all_link) 90 91 =cut 92 93 sub mr_file_erase_hash { 94 95 my $files = shift; 96 97 foreach my $i (keys %$files) { 98 delete $files->{$i}; 99 } 100 return(); 101 } 102 103 104 =over 4 105 106 =item B<mr_file_copy_and_erase_hash> 88 107 89 108 This function erases all elements in the hash passed in parameter (such as the one created in mr_file_read_all_link)
Note:
See TracChangeset
for help on using the changeset viewer.