luci-mod-admin-full: Fix display problems of mount
[project/luci.git] / modules / luci-mod-admin-full / luasrc / model / cbi / admin_system / fstab / mount.lua
index 54beb63..a85872a 100644 (file)
@@ -56,36 +56,46 @@ mount:taboption("general", Flag, "enabled", translate("Enable this mount")).rmem
 o = mount:taboption("general", Value, "uuid", translate("UUID"),
        translate("If specified, mount the device by its UUID instead of a fixed device node"))
 
+o:value("", translate("-- match by uuid --"))
+
 for i, d in ipairs(devices) do
-       if d.uuid then
+       if d.uuid and d.size then
                o:value(d.uuid, "%s (%s, %d MB)" %{ d.uuid, d.dev, d.size })
+       elseif d.uuid then
+               o:value(d.uuid, "%s (%s)" %{ d.uuid, d.dev })
        end
 end
 
-o:value("", translate("-- match by label --"))
-
 
 o = mount:taboption("general", Value, "label", translate("Label"),
        translate("If specified, mount the device by the partition label instead of a fixed device node"))
 
+o:value("", translate("-- match by label --"))
+
 o:depends("uuid", "")
 
 for i, d in ipairs(devices) do
-       if d.label then
+       if d.label and d.size then
                o:value(d.label, "%s (%s, %d MB)" %{ d.label, d.dev, d.size })
+       elseif d.label then
+               o:value(d.label, "%s (%s)" %{ d.label, d.dev })
        end
 end
 
-o:value("", translate("-- match by device --"))
-
 
 o = mount:taboption("general", Value, "device", translate("Device"),
        translate("The device file of the memory or partition (<abbr title=\"for example\">e.g.</abbr> <code>/dev/sda1</code>)"))
 
+o:value("", translate("-- match by device --"))
+
 o:depends({ uuid = "", label = "" })
 
 for i, d in ipairs(devices) do
-       o:value(d.dev, "%s (%d MB)" %{ d.dev, d.size })
+       if d.size then
+               o:value(d.dev, "%s (%d MB)" %{ d.dev, d.size })
+       else
+               o:value(d.dev)
+       end
 end
 
 
@@ -104,7 +114,7 @@ o.default = [[
 mkdir -p /tmp/extroot
 mount --bind / /tmp/introot
 mount /dev/sda1 /tmp/extroot
-tar -C /tmp/intproot -cvf - . | tar -C /tmp/extroot -xf -
+tar -C /tmp/introot -cvf - . | tar -C /tmp/extroot -xf -
 umount /tmp/introot
 umount /tmp/extroot</pre>
 ]] %{