From fdd0f8c554fc8c405810e5605865bcc7566ec518 Mon Sep 17 00:00:00 2001 From: payonel Date: Thu, 7 Feb 2019 14:16:05 -0800 Subject: [PATCH] check for etc before trying to install oppm closes #2875 --- .../assets/opencomputers/loot/oppm/.install | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/resources/assets/opencomputers/loot/oppm/.install b/src/main/resources/assets/opencomputers/loot/oppm/.install index a9c7b6b16..7f590eff9 100644 --- a/src/main/resources/assets/opencomputers/loot/oppm/.install +++ b/src/main/resources/assets/opencomputers/loot/oppm/.install @@ -3,6 +3,15 @@ if not install.root or #install.root == 0 then end if install.update then io.stderr:write("Please run 'oppm update oppm' from an installed version\nof this program to update oppm.\n") - return + return 1 end -os.execute(install.from:gsub("//","/") .. "usr/bin/oppm install --iKnowWhatIAmDoing -f oppm " .. install.to:gsub("//","/") .. install.root:gsub("//","/")) + +local to_path = install.to:gsub("//", "/") +local etc_path = to_path .. "etc" +if not require("filesystem").isDirectory(etc_path) then + io.stderr:write("Missing " .. etc_path .. " directory. Install openos first, or fix the installation.\n") + return 1 +end + +os.execute(install.from:gsub("//","/") .. "usr/bin/oppm install --iKnowWhatIAmDoing -f oppm " .. to_path .. install.root:gsub("//","/")) +