1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Detect if root FS is readonly

This commit is contained in:
Ycarus 2019-06-11 19:27:45 +02:00
parent 499baccfdc
commit 58d35b94e3
2 changed files with 19 additions and 0 deletions

View file

@ -914,6 +914,21 @@ function interfaces_status()
mArray.openmptcprouter["loadavg"] = sys.exec("cat /proc/loadavg 2>/dev/null"):match("[%d%.]+ [%d%.]+ [%d%.]+")
mArray.openmptcprouter["uptime"] = sys.exec("cat /proc/uptime 2>/dev/null"):match("[%d%.]+")
mArray.openmptcprouter["fstype"] = sys.exec("cat /proc/mounts | awk '/\/dev\/root/ {print $3}' | tr -d '\n'")
if mArray.openmptcprouter["fstype"] == "ext4" then
if sys.exec("cat /proc/mounts | awk '/\/dev\/root/ {print $4}' | grep ro") == "" then
mArray.openmptcprouter["fsro"] = false
else
mArray.openmptcprouter["fsro"] = true
end
elseif mArray.openmptcprouter["fstype"] == "squashfs" then
if sys.exec("cat /proc/mounts | awk '/overlayfs/ {print $4}' | grep overlay") == "" then
mArray.openmptcprouter["fsro"] = true
else
mArray.openmptcprouter["fsro"] = false
end
end
-- overview status
mArray.wans = {}
mArray.tunnels = {}

View file

@ -140,6 +140,10 @@
statusMessage += '<br/>';
}
}
if (mArray.openmptcprouter.fsro == true)
{
statusMessage += 'Filesystem is readonly<br/>';
}
if (mArray.openmptcprouter.tun_service == false)
{
statusMessage += 'GloryTUN is not running<br/>';