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

NStaller - Customizable Installation Program

Started by Cin316, 21 November 2012 - 04:19 AM
Cin316 #1
Posted 21 November 2012 - 05:19 AM
NStaller

Customizable fully portable installation program.


NStaller is a fully customizable installation program for ComputerCraft. This makes it easy to install programs on many computers. It will only display the programs that are compatible with the computer they are being installed on. NStaller also has the ability to pick individually which programs to install.





Installation

Make sure you have the http-api enabled and type:

pastebin get JTW4LsVB /disk/NStaller
To get the lastest developer build of NStaller (WARNING: May be unstable), type:

pastebin get Q993Tm5m /disk/NStaller





Changelog
  • 1.0
    • ​Initial release
Customization

To customize NStaller, edit NStaller in ComputerCraft. There will be a table called programs. Add a table to programs for every program you would like NStaller to install. The table must have these five elements:
  • name (string)- The name of the program.
  • nPath (string)- The path to copy the program to.
  • oPath (string)- The path where the program currently is.
  • color (boolean)- Whether or not the program requires color.
  • turtle (boolean)- Whether or not the program requires to be on a turtle.
Here is an example of me adding NPaintPro into NStaller. I have NPaintPro in this location: /disk/downloads/npaintpro .

Before:

programs = {
{ name="Mail", nPath="/utilities/mail/mail", oPath="/disk/downloads/mail/client/mailclient", color=false, turtle=false},
{ name="Mail Prefs File", nPath="/utilities/mail/pref", oPath="/disk/downloads/mail/client/pref", color=false, turtle=false}
}
After:

programs = {
{ name="NPaintPro", nPath="/utilities/npaintpro", oPath="/disk/downloads/npaintpro", color=true, turtle=false},
{ name="Mail", nPath="/utilities/mail/mail", oPath="/disk/downloads/mail/client/mailclient", color=false, turtle=false},
{ name="Mail Prefs File", nPath="/utilities/mail/pref", oPath="/disk/downloads/mail/client/pref", color=false, turtle=false}
}

Images



nutcase84 #2
Posted 22 November 2012 - 06:27 AM
Cool! This can be useful…
bjornir90 #3
Posted 22 November 2012 - 06:44 AM
Really cool ! I suggest you to make it capable of download the program. :(/>/>
Cin316 #4
Posted 22 November 2012 - 06:48 AM
Really cool ! I suggest you to make it capable of download the program. :(/>/>
Do you mean it would download the programs from pastebin if the user added the pastebin codein the programs table? I could do that.
bjornir90 #5
Posted 22 November 2012 - 06:58 AM
Really cool ! I suggest you to make it capable of download the program. :(/>/>/>
Do you mean it would download the programs from pastebin if the user added the pastebin codein the programs table? I could do that.
Yes ! So there is no need to give a program file alongside the os program for example. Sorry for my bad english i'm french.
zekesonxx #6
Posted 22 November 2012 - 07:03 AM
No, make it so that instead of pastebin you put in a URL.
Just add:


downloadurl = "http://example.com/example.lua"
--To use Pastebin put in "http://pastebin.com/raw.php?i=[Pastebin Code Here]"
bjornir90 #7
Posted 22 November 2012 - 07:06 AM
No, make it so that instead of pastebin you put in a URL.
Just add:


downloadurl = "http://example.com/example.lua"
--To use Pastebin put in "http://pastebin.com/raw.php?i=[Pastebin Code Here]"
Or you can use shell.run("pastebin", "get", "id of code", "name of file")
zekesonxx #8
Posted 22 November 2012 - 07:34 AM
That would make it so that you could only download pastebin.

I want to be able to make installers that can download from places other than pastebin, like GitHub or a personal website.
bjornir90 #9
Posted 23 November 2012 - 05:41 AM
That would make it so that you could only download pastebin.

I want to be able to make installers that can download from places other than pastebin, like GitHub or a personal website.
Oh ok sorry
gknova61 #10
Posted 23 November 2012 - 08:59 AM
No, make it so that instead of pastebin you put in a URL.
Just add:


downloadurl = "http://example.com/example.lua"
--To use Pastebin put in "http://pastebin.com/raw.php?i=[Pastebin Code Here]"

Great, that would make it more modular! And maybe add an optional variable in the programs table for a pastebinID and if it's nil, just move on. And if there's something in it, just have it call a function for downloading from pastebin so people don't need to memorize that long url ;)/>/>/>/>
zekesonxx #11
Posted 23 November 2012 - 10:18 AM

todownload = ""
pastebin = ""
download = ""
if pastebin == "" then
todownload = download
else
todownload = pastebin
end

file = download(todownload)
(Warning, download() is not a valid function unless you made one.)