Skip to content
Permalink
Browse files

Add rootdev + rootpart

  • Loading branch information...
NEMS Linux
NEMS Linux committed Mar 25, 2019
1 parent 9c917f7 commit f973e3a24f86ef700ed9635a5aab858105d6d5ac
Showing with 39 additions and 0 deletions.
  1. +8 −0 info.sh
  2. +31 −0 info2.sh
@@ -97,6 +97,14 @@ elif [[ $COMMAND == "hwid" ]]; then
/sbin/ifconfig enp0s3 | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}' | md5sum | cut -d"-" -f1 -
fi

elif [[ $COMMAND == "rootdev" ]]; then
# output json response of detected wifi networks
/usr/local/share/nems/nems-scripts/info2.sh 8

elif [[ $COMMAND == "rootpart" ]]; then
# output json response of detected wifi networks
/usr/local/share/nems/nems-scripts/info2.sh 9

elif [[ $COMMAND == "wifi" ]]; then
# output json response of detected wifi networks
/usr/local/share/nems/nems-scripts/info2.sh 7
@@ -98,6 +98,37 @@ switch($argv[1]) {
echo json_encode($wifi);
break;
case 8: // root device
$fulldev=shell_exec("df /root | awk '/^\/dev/ {print $1}'");
$tmp = explode('p',$fulldev);
if (is_array($tmp)) {
end($tmp);
$lastkey = key($tmp);
reset($tmp);
foreach ($tmp as $key => $value) {
if ($key != $lastkey) {
echo trim($value);
if (count($tmp) > 2) echo 'p'; // actual device name contains a p in the name
}
}
}
break;
case 9: // root partition on root device
$fulldev=shell_exec("df /root | awk '/^\/dev/ {print $1}'");
$tmp = explode('p',$fulldev);
if (is_array($tmp)) {
end($tmp);
$partkey = key($tmp);
reset($tmp);
foreach ($tmp as $key => $value) {
if ($key == $partkey) {
echo trim($value);
}
}
}
break;
}

0 comments on commit f973e3a

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