From 3d99efded98a523d4d753f116852422c45bfc00b Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Sun, 12 Nov 2023 23:21:50 +1000 Subject: [PATCH] make partman handle tape drives again, and support extension in future maybe --- partman/service/partman.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/partman/service/partman.lua b/partman/service/partman.lua index caab4fc..39cd72e 100644 --- a/partman/service/partman.lua +++ b/partman/service/partman.lua @@ -1,11 +1,16 @@ local diskpart = require "diskpart" local vcomponent = require "vcomponent" -local partman = {} +local partman = { + dtypes={ + drive=true, + ["tape_drive"]=true + } +} local hooks = {} 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 if v[4] > 0 then syslog(string.format("Registering vcomponent for partition %s/%i",a,k)) @@ -23,7 +28,7 @@ function hooks.component_added(_,a,t) end 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 if (t == "partition" or t == "filesystem") and ca:sub(1,a:len()) == a then vcomponent.unregister(ca)