Skip to content
Permalink
Browse files

Update nems-info to detect SCSI dev

  • Loading branch information...
NEMS Linux
NEMS Linux committed Sep 6, 2019
1 parent 6a0b26d commit 169867d7162f2afc092f375eef3e294f56f007be
Showing with 20 additions and 4 deletions.
  1. +2 −2 info.sh
  2. +18 −2 info2.sh
@@ -196,11 +196,11 @@ elif [[ $COMMAND == "rootfulldev" ]]; then
/bin/mount | /bin/sed -n 's|^/dev/\(.*\) on / .*|\1|p'

elif [[ $COMMAND == "rootdev" ]]; then
# output json response of detected wifi networks
# Root device name of the / filesystem (eg., sda or mmcblk0)
/usr/local/share/nems/nems-scripts/info2.sh 8

elif [[ $COMMAND == "rootpart" ]]; then
# output json response of detected wifi networks
# Root partition number of the / filesystem (eg., 1)
/usr/local/share/nems/nems-scripts/info2.sh 9

elif [[ $COMMAND == "wifi" ]]; then
@@ -112,9 +112,17 @@ switch($argv[1]) {
break;
case 8: // root device
// $fulldev=shell_exec("df /root | awk '/^\/dev/ {print $1}'");
$fulldev=trim(shell_exec("/usr/local/bin/nems-info rootfulldev"));
$tmp = explode('p',$fulldev);
if (!is_array($tmp) || !isset($tmp[1])) {
// Check if is SCSI
preg_match_all('!\d+!', $fulldev, $numbers);
if (is_array($numbers) && isset($numbers[0][0])) {
$tmp = array();
$tmp[0] = preg_replace('/' . $numbers[0][0] . '$/', '', $fulldev);
$tmp[1] = $numbers[0][0];
}
}
if (is_array($tmp)) {
end($tmp);
$lastkey = key($tmp);
@@ -130,9 +138,17 @@ switch($argv[1]) {
break;
case 9: // root partition on root device
// $fulldev=shell_exec("df /root | awk '/^\/dev/ {print $1}'");
$fulldev=trim(shell_exec("/usr/local/bin/nems-info rootfulldev"));
$tmp = explode('p',$fulldev);
if (!is_array($tmp) || !isset($tmp[1])) {
// Check if is SCSI
preg_match_all('!\d+!', $fulldev, $numbers);
if (is_array($numbers) && isset($numbers[0][0])) {
$tmp = array();
$tmp[0] = preg_replace('/' . $numbers[0][0] . '$/', '', $fulldev);
$tmp[1] = $numbers[0][0];
}
}
if (is_array($tmp)) {
end($tmp);
$partkey = key($tmp);

0 comments on commit 169867d

Please sign in to comment.
You can’t perform that action at this time.