Skip to content

Commit

Permalink
diskman: fix no '-B' option in df of openwrt
Browse files Browse the repository at this point in the history
  • Loading branch information
lisaac committed Feb 7, 2020
1 parent b99aa85 commit e1584ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions luasrc/model/diskman.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ end

local mounts = nixio.fs.readfile("/proc/mounts") or ""
local swaps = nixio.fs.readfile("/proc/swaps") or ""
local df = luci.sys.exec(d.command.df .. " -B1") or ""
local df = luci.sys.exec(d.command.df) or ""

function byte_format(byte)
local suff = {"B", "KB", "MB", "GB", "TB"}
Expand Down Expand Up @@ -143,8 +143,8 @@ local get_partition_usage = function(partition)
local used, free, usage = df:match("\n/dev/" .. partition .. "%s+%d+%s+(%d+)%s+(%d+)%s+(%d+)%%%s-")

usage = usage and (usage .. "%") or "-"
used = used and tonumber(used) or 0
free = free and tonumber(free) or 0
used = used and (tonumber(used) * 1024) or 0
free = free and (tonumber(free) * 1024) or 0

return used, free, usage
end
Expand Down
2 changes: 1 addition & 1 deletion po/zh-cn/diskman.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8\n"

msgid "DiskMan"
msgstr "DiskMan磁盘管理"
msgstr "DiskMan 磁盘管理"

msgid "Manage Disks over LuCI."
msgstr "通过LuCI管理磁盘"
Expand Down

0 comments on commit e1584ff

Please sign in to comment.