From ab4b4ce08c76f25d96727f7bf5bb1de4a439cb94 Mon Sep 17 00:00:00 2001 From: lisaac Date: Fri, 10 Apr 2020 21:14:24 +0800 Subject: [PATCH] diskman: fix filesystem string --- luasrc/model/cbi/diskman/partition.lua | 2 +- luasrc/model/diskman.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/luasrc/model/cbi/diskman/partition.lua b/luasrc/model/cbi/diskman/partition.lua index 3ec5196..348a617 100755 --- a/luasrc/model/cbi/diskman/partition.lua +++ b/luasrc/model/cbi/diskman/partition.lua @@ -196,7 +196,7 @@ if not disk_info.p_table:match("Raid") then if disk_info.partitions[section].mount_point == "-" and disk_info.partitions[section].number ~= -1 and disk_info.partitions[section].type ~= "extended" then self.template = "diskman/cbi/format_button" self.inputstyle = "reset" - self.inputtitle = disk_info.partitions[section].fs:match("^%s+$") and translate("Format") or disk_info.partitions[section].fs + self.inputtitle = disk_info.partitions[section].fs == "raw" and translate("Format") or disk_info.partitions[section].fs Button.render(self, section, scope) -- self:reset_values() -- self.keylist = {} diff --git a/luasrc/model/diskman.lua b/luasrc/model/diskman.lua index 73fa8aa..27698cf 100755 --- a/luasrc/model/diskman.lua +++ b/luasrc/model/diskman.lua @@ -185,7 +185,7 @@ local get_parted_info = function(device) partition_temp["name"] = device.."p"..partition_temp["number"] end if partition_temp["number"] > 0 and partition_temp["fs"] == "" and d.command.lsblk then - partition_temp["fs"] = luci.util.exec(d.command.lsblk .. " /dev/"..device.. tostring(partition_temp["number"]) .. " -no fstype") + partition_temp["fs"] = luci.util.exec(d.command.lsblk .. " /dev/"..device.. tostring(partition_temp["number"]) .. " -no fstype"):match("([^%s]+)") or "" end partition_temp["fs"] = partition_temp["fs"] == "" and "raw" or partition_temp["fs"] partition_temp["sec_start"] = partition_temp["sec_start"] and partition_temp["sec_start"]:sub(1,-2) @@ -459,7 +459,7 @@ d.get_format_cmd = function() exfat = { cmd = "mkexfat", option = "-f" }, hfsplus = { cmd = "mkhfs", option = "-f" }, ntfs = { cmd = "mkntfs", option = "-f" }, - swap = { cmd = "mkswap", option = "-f" }, + swap = { cmd = "mkswap", option = "" }, btrfs = { cmd = "mkfs.btrfs", option = "-f" } } result = {}