Commit ff51fd71 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

do not report sd[a-z] if there are sd[a-z][1-9]

parent 7b745b4b
...@@ -678,6 +678,8 @@ function get_partitions() ...@@ -678,6 +678,8 @@ function get_partitions()
function get_mnt_dev() function get_mnt_dev()
{ {
$partitions = get_partitions(); $partitions = get_partitions();
$devices = array();
$fs_types = array();
foreach ($partitions as $partition => $size) { foreach ($partitions as $partition => $size) {
$res = array(); $res = array();
$dev = "/dev/" . $partition; $dev = "/dev/" . $partition;
...@@ -708,6 +710,8 @@ function get_raw_dev() ...@@ -708,6 +710,8 @@ function get_raw_dev()
// filter out partitions with file system // filter out partitions with file system
$i = 0; $i = 0;
$raw_devices = array(); $raw_devices = array();
print_r($names);
print_r($devices);
foreach ($names as $name => $size) { foreach ($names as $name => $size) {
$found = false; $found = false;
foreach ($devices as $device) { foreach ($devices as $device) {
...@@ -721,6 +725,17 @@ function get_raw_dev() ...@@ -721,6 +725,17 @@ function get_raw_dev()
} }
} }
//special case
if (count($raw_devices)>1) {
foreach($raw_devices as $k=>$v){
if (preg_match('/sd[a-z][0-9]/',$k)==0) {
unset($raw_devices[$k]);
}
}
}
print_r($raw_devices);
return $raw_devices; return $raw_devices;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment