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

Easy Boot Disk Creator

Started by Mandrake Fernflower, 16 February 2012 - 03:29 PM
Mandrake Fernflower #1
Posted 16 February 2012 - 04:29 PM
This was one of my first programs i made (I am still learing LUA)
this was a installer for a rescue floppy incase of a virus infection. but it can be used for anything that needs to be made into a boot disk.

Here it is:



You are welcome to make any changes or fixes but just keep the first 2 print()'s

-- SYSLINUX like installer by Mandrake25
file = "/rom/programs/mandrakeav"
title = "Mandrake Disinfector"
label = "Rescue Disk"
print("Bootdisk Maker 1.0")
print("By Mandrake25")
print("Press any key to continue")
read()
print("Would you like to install "..title.." to a floppy disk?")
print("y or n")
check = io.read()
if check == "y" then
print("Please enter the side the disk is in")
side = io.read()
path = disk.getMountPath(side)
if path then
print("Will install to that disk")
read()
fs.copy(file,path.."/".."startup")
disk.setLabel(side,label)
print("Done")
read()
disk.eject(side)
os.reboot()
else
print("Not a valid disk")
end
else
print("Will not install")
end
Advert #2
Posted 16 February 2012 - 04:44 PM
This was one of my first programs i made (I am still learing LUA)
this was a installer for a rescue floppy incase of a virus infection. but it can be used for anything that needs to be made into a boot disk.

Here it is:



You are welcome to make any changes or fixes but just keep the first 2 print()'s

-- SYSLINUX like installer by Mandrake25
file = "/rom/programs/mandrakeav"
title = "Mandrake Disinfector"
label = "Rescue Disk"
print("Bootdisk Maker 1.0")
print("By Mandrake25")
print("Press any key to continue")
read()
print("Would you like to install "..title.." to a floppy disk?")
print("y or n")
check = io.read()
if check == "y" then
print("Please enter the side the disk is in")
side = io.read()
path = disk.getMountPath(side)
if path then
print("Will install to that disk")
read()
fs.copy(file,path.."/".."startup")
disk.setLabel(side,label)
print("Done")
read()
disk.eject(side)
os.reboot()
else
print("Not a valid disk")
end
else
print("Will not install")
end

Pretty interesting idea!

I would reccomend that you confirm the disk path with the user, e.g

You are installing 'file' to 'diskdir' (side Disk Drive). Is this correct?
Mandrake Fernflower #3
Posted 16 February 2012 - 09:40 PM
Pretty interesting idea!

I would reccomend that you confirm the disk path with the user, e.g

You are installing 'file' to 'diskdir' (side Disk Drive). Is this correct?

Well thats a ok idea, I would need to learn more Lua to do it. But in my newist version I added a log of what it did


-- SYSLINUX like installer by Mandrake25
file = "/rom/programs/mandrakeav"
title = "Mandrake Disinfector"
label = "Rescue Disk"
print("Bootdisk Maker 1.0")
print("By Mandrake25")
print("Press any key to continue")
read()
print("Would you like to install "..title.." to a floppy disk?")
print("y or n")
check = io.read()
if check == "y" then
print("Please enter the side the disk is in")
side = io.read()
path = disk.getMountPath(side)
if path then
print("Will install to that disk")
read()
fs.copy(file,path.."/".."startup")
disk.setLabel(side,label)
print("Done")
print("BOOTIMAGE "..file.." has been installed to "..path)
read()
disk.eject(side)
os.reboot()
else
print("Not a valid disk")
end
else
print("Will not install")
end

ChaddJackson12 #4
Posted 30 July 2012 - 09:13 PM
To get the confirmation to work.. You COULD do this, but it isn't the most efficient way… Make a file called "confirm" in your computer/disk then replace your if statement with this:


shell.run("confirm")
Then the else statement

In the confirm file type:

print("Please enter the side the disk is in")
side = io.read()
path = disk.getMountPath(side)
if path then
print("Will install to that disk")
read()
fs.copy(file,path.."/".."startup")
disk.setLabel(side,label)
print("Done")
print("BOOTIMAGE "..file.." has been installed to "..path)
read()
disk.eject(side)
os.reboot()

Hope that this helps… Also, instead of doing something like this in your file:

print("stuff")
print("stuff")
print("stuff")
You could just do this:
print("stuff nstuff nstuff nstuff nect")

It should make 4 'stuff' lines and an ect line in your game. IF that doesn't work then it would work with the command 'write("")' which does the same function