New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move CraftOS out of bios.lua #347
base: master
Are you sure you want to change the base?
Conversation
Have you tested this actually works? From what I can tell, you're declaring May be worth checking if boot isn't a directory and has no syntax errors before trying to do anything else. |
Sorry for being rather negative, but there do seem to be some other issues which would prevent this from working/being ideal.
Again, sorry for all the complaints - it looks a good idea, we just need to make sure it all works OK. |
I fully understand you, thank's for bringing up that many concerns ;-). |
CC now support |
supporting |
And I don't want to use pcall, because I have no idea how to deal with errors on such a basic level. |
@ecktec regarding not knowing how to use pcall; see the original bios.lua as well as the pcall documentation. Regarding this PR, I do not believe this is a good idea. Top-level coroutine overrides can be utilized to do this already. |
Personally, I would just rig this block here to check On the other hand, most users who write "OSes" for ComputerCraft don't know what an OS is, and produce things which could charitably be called "shells" (assuming they're even that complex). Their code typically runs on top of CraftOS and would break without it. Very few replace the |
@BombBloke I was part way through a fork which did partly what you have described. I was about to do a rewrite when I needed to work on a Uni resit. Links: |
@MineRobber9000 I meant I have no idea how to output it. @BombBloke I think things like *nix kernels would get much better with that change, this is the purpose, if someone wants to replace the inner functions of CraftOS in a non hacky way, not replacing shell. |
Please look at #272 Dan will only accept a PR, who makes bios.lua Changeable by Resourcepacks and not by normal users. So please remove the part who allow users to make their own bootfile. btw. Please rename /rom/boot to /rom/boot.lua |
@Wilma456 I think doesn't want anyone to be able to change it, because of the top part of bios.lua, which I kept there. |
What Dan200 said is that he would prefer resource pack changing bios.lua. |
People want to install OSes on single computers with vanilla computercraft. |
Quote from #272 dan200 |
The problem is, that is doesn't achieve these aims, becuase people are lazy and don't want to have to install a resourcepack for that. It destroys the "just enter |
@Wojbie I'm going to just quote my original response to that comment that @dan200 posted:
|
Resource packs means the server owner has control over whether they want people to be able to run custom operating systems or not. Personally I think the resource pack option is the way to go, but then I've never really seen the point of custom operating systems. |
Could just make it a config option for if per computer override is possible. With Resource pack override being always possible. |
you could override it by injecting something in rom/boot to not allow to have a boot file which would be very hacky |
@ecktec what about a per computer setting? (i.e; "set bios.use_bootfile true") |
@MineRobber9000 The settings are defintely part of CraftOS. Also you can just not create a bootfile. |
I just tested it ingame, it works as expected. (copied rom/boot and added a debug message) |
Would it be worth printing a debug error message if |
I have no idea how to print an error message, because the print and write functions are both part of CraftOS. The Errors would come through load() (is there) and pcall() (not there, but easy to add), but I don't know how to output them. EDIT: ok, it's term.write() |
I agree with this PR because it wouldn't prevent server owners from doing anything. They could simply change |
@manu-03 You cannot change bios.lua with resourcepacks. This change would give server owners no more and no less control over what their users do. All your arguments are actually wrong, this change is just philosophical and has no more advantages than allowing less hacky code. |
Another issue, this could potentially brick a computer if the |
@CrazedProgrammer you can place computers in diskdrives, which will allow you to fix it |
Ahh, didn't think about that. This looks neat. |
@CrazedProgrammer you can do the same pseudo-bricking with startup.lua already |
How about we use pcall and a failsafe? Something like: local ok, err = pcall(function() os.run(bootfile,_G) end)
if not ok then term.write(err.."\n") sleep(1) os.run("rom/boot.lua",{}) end Then, if the bootfile errors, it runs CraftOS, allowing the user to fix their error. (Note: while |
I also thought about that already, but I was not sure, if it should be there, but in case I implement it, i’ll also have to try them after each other, should I remove the ability to call it |
@ektec no, they couldn't modify the BIOS, you have a point there. But it'd be as easy as adding an option so that the computer would just boot in legacy (capped) mode to the config file, which can be modified only by server owners. |
@ecktec Yes. There should only be a |
@manu-03 This change will not open any new possibilities, I don't see any reason why someone would like to not enable it. You can do the same things in "legacy mode". |
It's easy. It can lead to exploits if the server has limited OS functionality |
@manu-03 Can you give an example of such a potential exploit? None of the sandboxing-related code has been changed/deleted so this shouldn't be any more exploitable than the current system. |
@SquidDev Just imagine a server owner wants to allow only certain computers (such as advanced ones or some specific IDs) to use HTTP. They can do it by three ways:
Even if the other two would still be avaliable, they are less accessible than the second one. Having an option to disable boot.lua (or force running /rom/startup.lua before it) would make the second one safe, while a simple boot.lua would just override the restriction. |
@manu-03 That's what the |
@apemanzilla That gets loaded from |
Ah, I misread it. Thanks for clarifying. |
What does it do?
bios.lua
intorom/boot.lua
boot.lua
and if it exists, it executes it, else it executesrom/boot.lua
(CraftOS)How to use it?
rom/boot.lua
boot.lua
fileHow is that useful?
It is't; it's just a philosophical thing, but people always wanted to replace CraftOS instead of just hiding it.