package management

Installing applications

Article contributed by humdinger on Sun, 2013-10-13 07:33

With the recent incorporation of package management (get a nightly image to check it out) some things have changed with regard to installing applications. Mind you, it's all still in a bit of flux with bugs being found and fixed and features being refined (this article has been written for hrev46218). Also, keep in mind that I'm not that familiar with the workings of the package management myself. I'd appreciate corrections, additions and tips!

Once repositories and packages are up and HaikuDepot is more feature complete, things will get easier. But until then, this is how I understand things: There are basically three scenarios:

1. A proper new .hpkg package

Either installed automatically via HaikuDepot, e.g. WonderBrush, or downloaded off some site. When using HaikuDepot, you're all set. If downloaded somewhere else, just move the .hpkg file into ~/config/packages/ and (in case of an application) it'll appear in ~/config/apps/.

2. An "old", self-contained archive

Those come traditionally from sites like BeBits or Haikuware in form of a zipped up folder. As before, you can unzip that anywhere in /boot/home/ (besides ~/config/ which is read-only) and launch the app just like you did before package management.

3. An "old" archive that has files to spread around

This is the case where you used to unzip the archive anywhere and had to invoke an install script or copy some files to special locations. Think of screen savers, translators or similar things. Since the file system hierarchy has changed a bit and some folders became read-only, those apps don't work any more out-of-the-box. You have two choices to get them working:

3.1 The non-packaged folder

Under ~/config/non-packaged/ you can recreate the needed file hierarchy. Let's take for example the very convenient tool TextBank, that provides a history and templates of the clipboard. After unzipping it to ~/config/non-packaged/apps/ you can launch TextBank, but it doesn't yet do anything. The input_server add-ons TextBankAssistantPasteSender and TextBankAssistantSpy aren't yet in the right place in the filesystem and therefore aren't picked up by the system.

TextBank offers to install these files in its preferences, but since the changed hierarchy due to package management, that doesn't work anymore. You'll have to do that manually by creating the needed folders and copying the corresponding file:

~/config/non-packaged/add-ons/input_server/devices/TextBankAssistantPasteSender
~/config/non-packaged/add-ons/input_server/filters/TextBankAssistantSpy

The next time you boot up (or restart the input_server from Terminal with "/system/servers/input_server -q") it should work.

3.2 Making it into a proper .hpkg package

The non-packaged folder route is a bit unwieldy if you're updating your system from scratch often. Here is how you create a .hpkg of TextBank:

You create some folder "SomeFolder" and within it the subfolders "apps", "add-ons/input_server/filters/" and "add-ons/input_server/devices/".

Then unzip the TextBank archive under "apps" and move "TextBankAssistantPasteSender" and "TextBankAssistantSpy" in their corresponding folders you just created.

Now, the hardest part, you have to create the text file ".PackageInfo" in the top folder "SomeFolder". The exact syntax of that file is described in the PM wiki. Also, .hpkg files opened in Expander (check "Show contents") can be educational. It'll look something like this:

name			textbank
version			5.3.2-1
architecture		x86_gcc2
 
summary			"A tool to provide clipboard history and more"
description		"Useful text provision tool (Clipboard history/template/time & date...)"
 
packager		"Humdinger <humdlinger@gmail.com>"
vendor			"SHINTA"
 
copyrights		"SHINTA"
licenses		"MIT"
 
provides {
			textbank = 5.3.2-1
}

Note, the license is actually Creative Commons, but that doesn't exist yet under /system/data/licenses/. You could create your own of course, but that would lead us astray for this educational example. Hope SHINTA doesn't mind... :)

Finally, let's create the actual .hpkg file. Open a Terminal at "SomeFolder" and type:

package create -b textbank.hpkg

That creates an empty package with just the .PackageInfo. Continue with:

package add textbank.hpkg apps add-ons

And there we are. Put into ~/config/packages to install and TextBank will appear under ~/config/apps/



[Edit 14.10.2013: corrected path, thanks Giovanni.]

Syndicate content