make partman handle tape drives again, and support extension in future maybe
This commit is contained in:
parent
ac23911d6d
commit
3d99efded9
@ -1,11 +1,16 @@
|
|||||||
local diskpart = require "diskpart"
|
local diskpart = require "diskpart"
|
||||||
local vcomponent = require "vcomponent"
|
local vcomponent = require "vcomponent"
|
||||||
local partman = {}
|
local partman = {
|
||||||
|
dtypes={
|
||||||
|
drive=true,
|
||||||
|
["tape_drive"]=true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
local hooks = {}
|
local hooks = {}
|
||||||
|
|
||||||
function hooks.component_added(_,a,t)
|
function hooks.component_added(_,a,t)
|
||||||
if t ~= "drive" then return end
|
if not partman.dtypes[t] then return end
|
||||||
for k,v in ipairs(diskpart.getPartitions(a)) do
|
for k,v in ipairs(diskpart.getPartitions(a)) do
|
||||||
if v[4] > 0 then
|
if v[4] > 0 then
|
||||||
syslog(string.format("Registering vcomponent for partition %s/%i",a,k))
|
syslog(string.format("Registering vcomponent for partition %s/%i",a,k))
|
||||||
@ -23,7 +28,7 @@ function hooks.component_added(_,a,t)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function hooks.component_removed(_,a,t)
|
function hooks.component_removed(_,a,t)
|
||||||
if t ~= "drive" then return end
|
if not partman.dtypes[t] then return end
|
||||||
for ca,t in component.list() do
|
for ca,t in component.list() do
|
||||||
if (t == "partition" or t == "filesystem") and ca:sub(1,a:len()) == a then
|
if (t == "partition" or t == "filesystem") and ca:sub(1,a:len()) == a then
|
||||||
vcomponent.unregister(ca)
|
vcomponent.unregister(ca)
|
||||||
|
Loading…
Reference in New Issue
Block a user