add some requires and type casts to make diskpart and fdisk work on OpenOS without modification
This commit is contained in:
parent
b9216ff85b
commit
64951b513b
@ -1,3 +1,4 @@
|
||||
local component = require "component"
|
||||
local partition = {}
|
||||
|
||||
local eformat = "c20c4>I4>I4"
|
||||
|
@ -1,3 +1,4 @@
|
||||
local component = require "component"
|
||||
local tA = {...}
|
||||
local fdisk = {}
|
||||
local addr = component.get(table.remove(tA, 1))
|
||||
@ -15,15 +16,18 @@ function fdisk.show()
|
||||
end
|
||||
function fdisk.del(i)
|
||||
local pt = require("diskpart").getPartitions(addr)
|
||||
table.remove(pt, i)
|
||||
table.remove(pt, tonumber(i))
|
||||
require("diskpart").setPartitions(addr, pt)
|
||||
fdisk.show()
|
||||
end
|
||||
function fdisk.set(id, name, ftype, start, len)
|
||||
local pt = require("diskpart").getPartitions(addr)
|
||||
pt[tonumber(id)] = {name, ftype, tonumber(start), tonumber(len)}
|
||||
require("diskpart").setPartitions(addr, pt)
|
||||
fdisk.show()
|
||||
end
|
||||
function fdisk.add(name, ftype, start, len)
|
||||
local pt = require("diskpart").getPartitions(addr)
|
||||
pt[#pt+1] = {name, ftype, start, len}
|
||||
require("diskpart").setPartitions(addr, pt)
|
||||
fdisk.show()
|
||||
fdisk.set(#require("diskpart").getPartitions(addr)+1, name, ftype, start, len)
|
||||
end
|
||||
|
||||
assert(fdisk[cmd], "unknown command")
|
||||
|
Loading…
Reference in New Issue
Block a user