DTC-Xen Installation

DTC-Xen / Dom0 Howtos

DTC-Xen / DomU Howtos


DTC Howtos




Devel docs

Wiki - i18n

Wiki - Meta

Writing an automatic package installer for DTC

These instructions assume you have already installed the installer package at: apt-get install dtc-package-installer or git clone

Many requested me to write about it. Here is a quick howto. We will take the phpBB package as example, as this one was rather easy to create, and it shouldn't be too hard to understand. The same rules should apply to any other packages.

  • 1. Create a folder in DTCPATH/shared/package-installer/

Nothing special, but think that all folders should be lowercase (just to make it cleaner) and WITH NO SPACE please.

  • 2. Go in your new folder, and create the package archive

What you should do is unpack the orriginal archive, and maybe rename it to something better. I suggest that you just use the package name itself. Right after, you should do a chown nobody:nogroup so the archive installs correctly (otherwise it wont have the correct rights). After, do a "du -sb" inside your unpacked archive folder and write it on the side for later, and then you can repack it with tar.gz or tar.bz2 extension for example.

  • 3. Edit the dtc-pkg-info.php file

What I suggest you to do is to just do a simple copy of the same file from another package. (/usr/share/dtc/shared/package-installer/) Change all the fields values: name, version, short_desc, long_desc, and all the fields that are boolean (yes/no type). If let's say you have set "need_database" to yes, then the package installer will request the user for what database name to use, with what username and what password. You wont have to write the interface to do it, DTC will ask it for you.

Set the "unpack_type" to the correct value (tar.gz if your package archive has this extension), set the size you have found with the du -sb command, set the archive file name, and the name of the folder you have packed in "resulting_dir". You can set "renamedir_to" with either the same name, or any other name you want the panel to rename your unpacked folder.

  • 4. Writting the dtc-pkg-install.php script

After uncompressing the archive in the user's vhost subdirectory, the installer will call that script. This is the place where you should write all the post-install things.

The best way for you to understand how to write it, is to have a look to the install script of phpBB that has enough options. On top, you will see all the parameters sent to the script. You should use $_REQUEST["xxx"] with xxx being the parameter on the URL. The begining of the script gets the information about the path, then rename the folder of the package to the one that the user wanted. Some script don't even like to have a different folder than the one they are used to, and that's why it's like that.

Right after, you see that the script is building a structure called $data. That structure is to be passed to the function HTTP_Post() that is internal to the panel. This function goal is to call any URL by posting all the parameters. The other parameter is the referer, and we don't really care, that's why you see $url twice in it.

That HTTP_Post() call is used to send all what would have been sent by somebody that would use the phpBB installer. In fact, all the informations, we have them already, so it's easy to just send it to phpBB directly so the user don't have to enter them twice. If you look in the installer for osCommerce, it just send the user to the URL of the osCommerce installer, simply because I was too lazy to do something that would be automated for all options. You can do like that as well, it might be better if the project you are writting installer for is changing it's installer often.

  • 5. Sort out your patch...

Here's a quick summary of the commands to do the patch file.

   git commit -a
   git pull master
   git rebase
   git log
   git-format-patch [ID-OF-PREVIOUS-COMMIT]

git rebase might fail, don't worry about it, it's just to put your patch at the top of the list but if it's already at the top then there's no issue.

This will give you a big file so don't email it to the dev list. Just put it on some http space then email a link to the dev list.

  • 6. To be continued...

I know really know if you need more information about all these. If you do, just tell me what you think is missing, and I'll write about it.

Editing this page means accepting its license.

Page last modified on August 06, 2010, at 10:10 AM EST