From 0aa574ea7a11ae9f23203d7521bcef0b47a9186b Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Fri, 13 Oct 2023 11:52:01 +1000 Subject: [PATCH] early work on OpenOS bootstrapping --- INSTALL.md | 8 ++++++++ obootstrap.lua | 31 +++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 obootstrap.lua diff --git a/INSTALL.md b/INSTALL.md index e5fe5c2..4e39432 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -12,6 +12,14 @@ For installing to an unmanaged drive or tape - rtfs - boopu +There are two easy methods to get these packages. +1. With oppm, if available, you can run `oppm install mtar partman rtfs boopu`. +2. You can use the `obootstrap.lua` script to set up a temporary environment for installing PsychOS. This can even be used from the OpenOS installer disk. +``` +# wget https://git.shadowkat.net/izaya/OC-PsychOS2/raw/branch/master/obootstrap.lua /tmp/obootstrap.lua +# /tmp/obootstrap.lua +``` + ### Preparing the target disk #### Managed filesystem Preparing a managed filesystem is extremely simple: attach it to your computer, and make sure there's nothing that you want to keep in the following locations on the filesystem: diff --git a/obootstrap.lua b/obootstrap.lua new file mode 100644 index 0000000..8de23f1 --- /dev/null +++ b/obootstrap.lua @@ -0,0 +1,31 @@ +local fs = require "filesystem" + +local wdir = "/tmp/psbootstrap" +local dlfiles = { + ["/lib/libmtar.lua"] = "https://git.shadowkat.net/izaya/OC-misc/raw/branch/master/mtar/libmtar.lua", + ["/lib/fs/rtfs/init.lua"] = "https://git.shadowkat.net/izaya/PsychOSPackages/raw/branch/master/rtfs/lib/fs/rtfs/init.lua", + ["/lib/fs/rtfs/v1.lua"] = "https://git.shadowkat.net/izaya/PsychOSPackages/raw/branch/master/rtfs/lib/fs/rtfs/v1.lua", + ["/lib/diskpart.lua"] = "https://git.shadowkat.net/izaya/PsychOSPackages/raw/branch/master/diskpart/lib/diskpart.lua", + ["/etc/rc.d/partman.lua"] = "https://git.shadowkat.net/izaya/OC-misc/raw/branch/master/partition/OpenOS/etc/rc.d/partman.lua", + ["/bin/slicer.lua"] = "https://git.shadowkat.net/izaya/PsychOSPackages/raw/branch/master/slicer/exec/slicer.lua", + ["/bin/boopu.lua"] = "https://git.shadowkat.net/izaya/PsychOSPackages/raw/branch/master/boopu/exec/boopu.lua", +} + +local function run(cmd) + print(cmd) + os.execute(cmd) +end + +print("Downloading and linking files...") +for k,v in pairs(dlfiles) do + local tpath = string.format("%s/%s", wdir, k) + local isdir = fs.isDirectory(fs.path(tpath)) or fs.makeDirectory(fs.path(tpath)) + run(string.format("wget '%s' '%s'", v, tpath)) + local lt = k + while not fs.isDirectory(fs.path(lt)) and not fs.isLink(fs.path(lt)) do + lt = fs.path(lt) + end + if fs.get(tpath) ~= fs.get(lt) then + run(string.format("ln '%s/%s' '%s'", wdir, lt, lt)) + end +end