This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Maccraft123's profile picture

[BETA] CCBoot - Try multiple OS

Started by Maccraft123, 06 November 2016 - 09:11 AM
Maccraft123 #1
Posted 06 November 2016 - 10:11 AM
CCBoot - A grub-like ComputerCraft Program
Try Multiple OS!

Code:

--CCBoot by Maccraft123
--Functions:
function SetUp()
term.setBackgroundColor(colors.black)
term.clear()
term.setCursorPos(1,1)
print(" CCBoot")
print(" Choose An OS:")
print("1: CraftOS")
write("OS Choice: ")
choice = read()
if choice == 1 then
  shell.run("/rom/programs/shell")
end
end
SetUp()

How to add OS:

1. Change it:

if choice == 1 then
shell.run("/rom/programs/shell")
end
To it:
if choice == 1 then
shell.run("/rom/programs/shell")
elseif choice == then
shell.run("path-to-os-bootloader")
end
2. Add OS name:

print(" CCBoot")
print(" Choose An OS:")
print("1: CraftOS")
print("2: Yoour-os-name")
3. Reboot




Pastebin: http://pastebin.com/F2wZFSjt
H4X0RZ #2
Posted 06 November 2016 - 04:21 PM
The code you posted won't work. read() returns a string and you are comparing it to a number which will always return false. The only reason you are thrown into a shell after entering something is because I suppose you saved this as startup which, in fact, is executed by the shell (/CraftOS) and after the startup finished it will return to the shell itself.

If you really want a boot manager (which is somewhat advanced and actually "manages" booting) you should look into TLCOs. First you break the shell the computer boots into, then you do whatever you want this the env, show some boot dialog and start the OS.