From e85b948f4dd53382e2e021d0ddd2b78fa94db15d Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Tue, 1 Aug 2023 18:02:14 +1000 Subject: [PATCH] add module for booting from rtfs volumes --- module/rtfsboot.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 module/rtfsboot.lua diff --git a/module/rtfsboot.lua b/module/rtfsboot.lua new file mode 100644 index 0000000..10aee16 --- /dev/null +++ b/module/rtfsboot.lua @@ -0,0 +1,19 @@ +--#includepkglib "diskpart" "lib/diskpart.lua" "diskpart" +--#includepkglib "rtfs" "lib/rtfs.lua" "rtfs" +do + local a = computer.getBootAddress() + if component.type(a) == "drive" then + local diskpart = require "diskpart" + for k,v in ipairs(diskpart.getPartitions(a)) do + if v[2] == "rtfs" and v[1] == computer.address():sub(1,8) .. "-boot" then + syslog("Partition with suitable name detected, attempting to mount...") + local rtfs = require "rtfs" + fs.makeDirectory("boot") + local m = rtfs.mount(diskpart.proxyPartition(a,k)) + m.address = string.format("%s/%i/rtfs",a,k) + fs.mount("boot",m) + break + end + end + end +end