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

Mad-DL, apt-get for ComputerCraft! Now v2.1

Started by Mads, 13 January 2013 - 08:08 AM
Mads #1
Posted 13 January 2013 - 09:08 AM
I have been wanting to update my old program "Mad-DL" for a while, so here it is: Mad-DL v2.0.

It works kind of like apt-get in certain Linux distros. Though, it does not have as many commands as apt-get.

For users:
SpoilerDownloads:
2.0: pastebin get PcPcLfur mad-dl
2.1: pastebin get BwgBsRpx mad-dl

Or get the latest version of Mad-DL:

mad-dl install mad_dl
rm mad_dl

How to use it:
When you have installed the program, just run the help command:

mad-dl help

For repository hosters:
SpoilerThis is a bit more advanced. A repository basically consists of one file: ".mad_dl". This file contains a list of all of the packages located in this repository.

This is an example of a Mad-DL repo file:

# MAD-DL REPOSITORY DESCRIPTION FILE


# Lists all packages and their respective aliases
START INDEX

# <package name> <path to pkg file>

# Example:
test pkgs/test.pkg

END INDEX

As you can see, this file links the package "test" to the .pkg file "test.pkg", which is located in the directory "pkgs". This file looks like this:

# PACKAGE FILE FOR PACKAGE test


# Lists all of the files that need to be downloaded, and where they should be downloaded to
# NOTE: "__PKG__" will always get interpreted, and automatically replaced with the name of the package
# NOTE: You CANNOT list a file in a directory, which is in a directory that doesn't exist.

LOCATION pkg_test

START CONTENT

# <path to file on server> <path to save destination on client machine>
# OR
# <command> <parameters>

# Example:
main.lua __PKG__/main.lua

conf.lua __PKG__/conf.lua

CMD_MAKE_DIR __PKG__/entities

entities/sheep.lua __PKG__/entities/sheep.lua # The directory "entities" will be created on client machine

END CONTENT

START INFO


This is just a package meant for testing, if Mad-DL works.
This will (hopefully) show, if you type this: mad-dl info test

END INFO

END PKG

Here, "__PKG__" gets translated to the installation path of the package on the clients computer, so it's a good idea to put it there.
You can also execute commands, though for now you can only create directories. This is done with the "CMD_MAKE_DIR" command. This HAS TO BE DONE before letting the client download any files inside that directory.

Whatever text is between "START INFO" and "END INFO" will be printed when the user executes 'mad-dl info <package name'.

The "main.lua" and "conf.lua" files are not located in this folder. They are located in "&#46;&#46;/pkg_test/"(because we stated that with "LOCATION pkg_test". This could be replaced by "LOCATION pkg___PKG__), which is again located in the same folder that ".mad_dl" is in. It's name "pkg_test" because the package name is "test". If the package name was "ketchup", it would be named "pkg_ketchup". Inside this folder, you will find all of the neccesary files, in this case the files "main.lua" and "conf.lua", and a directory named "entities", which contains a file named "sheep.lua".

All of that will then be downloaded onto the clients computer, into a folder with the same name as the package.

This is what the repository folder looks like:


———————————————————————————————————————————————————————

Client changelog:
Spoilerv2.1:

+Added config file support. See 'mad-dl help conf' for more info.
+Added support for package information support. See 'mad-dl help info'.
+Added 'search' command. See 'mad-dl help search'.
+Added 'list' command. See 'mad-dl help list'.
+Added 'rmrepo' command. See 'mad-dl help rmrepo'.

v2.0:

+Initial release.

Repository changelog:
Spoilerv2.1:

+Added "info" tags. See the info for repository hosters for more information.
+Added "LOCATION" statement. See the info for repository hosters for more information.

v2.0:

+Initial release.

NOTE: If you encounter any errors, contact the repository administrator. The program expects PERFECT syntax in repository and package files.

For now, there is no way to "upload" packages to repositories, you will have to ask the repo admin to do that. An auto-packager will be relased when I get the time.

If any of this seems confusing, or you need help installing this to a server, just post a reply. Feedback would also be appreciated!
RunasSudo-AWOLindefinitely #2
Posted 13 January 2013 - 07:31 PM
Don't we already have cc-get?
Mads #3
Posted 14 January 2013 - 12:22 AM
If you took your time to read, you would clearly see that this is different from CC-Get.
zekesonxx #4
Posted 14 January 2013 - 09:15 AM
This is actually really good.

Can you, in pkg files, load files from external places? EX: "libs/luacode.lua http://externalsite.org/code/luacode.lua"
pielover88888 #5
Posted 14 January 2013 - 10:43 AM
Interesting, at first I thought this _was_ ccget, and I remembered that ccget had few features, then I noticed it's not ccget and..
well, anyway, this seems pretty cool. *tests it out*

EDIT: found bug in 2.1: mad-dl:434: attempt to index ? (a nil value)
that happened when I did mad-dl search, then chose to update the cache because it didn't exist.
Edited on 14 January 2013 - 09:45 AM
RunasSudo-AWOLindefinitely #6
Posted 14 January 2013 - 12:43 PM
I did completely read the post, I just think it might be a good idea to add a comparison of this and cc-get, because I can't be bothered getting on my computer and downloading the program just to find out what it does differently.
Mads #7
Posted 15 January 2013 - 02:55 AM
Interesting, at first I thought this _was_ ccget, and I remembered that ccget had few features, then I noticed it's not ccget and..
well, anyway, this seems pretty cool. *tests it out*

EDIT: found bug in 2.1: mad-dl:434: attempt to index ? (a nil value)
that happened when I did mad-dl search, then chose to update the cache because it didn't exist.

You have to call 'mad-dl recache' before downloading or doing anything. Or you can do 'mad-dl conf auto_recache 1', which will make it reload the cache automatically. I know you did this, but if you get that error, it was likely caused by an HTTP failure. Try recaching again. I am not getting that error.

EDIT: Just updated 2.1 to the EXACT same code as I have :D/>
Mads #8
Posted 15 January 2013 - 02:57 AM
This is actually really good.

Can you, in pkg files, load files from external places? EX: "libs/luacode.lua http://externalsite.org/code/luacode.lua"

No, you cannot. Might add that in 2.2, though. Also, there's a syntax error in your sig :{D
zekesonxx #9
Posted 15 January 2013 - 05:25 AM
Also, there's a syntax error in your sig :{D

I know.