Difference between revisions of "Create Packages"

From hummy.tv Wiki
Jump to: navigation, search
Line 1: Line 1:
 
The modified firmware includes a lightweight package management system called opkg ([http://code.google.com/p/opkg/ home page]) which is similar to the Debian package management system (dpkg).
 
The modified firmware includes a lightweight package management system called opkg ([http://code.google.com/p/opkg/ home page]) which is similar to the Debian package management system (dpkg).
 +
 +
== Package Repositories ==
 +
 +
The custom firmware is configured to use the package repository at [http://hummypkg.org.uk/packages.html hummypkg.org.uk] by default.
 +
 +
== Package Format ==
 +
 +
A package is a UNIX Archive (<tt>ar</tt>) file which itself contains three files:
 +
 +
;debian-binary : A file which just contains the string <tt>"2.0"</tt>, a clue to the packaging system's roots.
 +
;data.tar.gz : The files which make up the package.
 +
;control.tar.gz : Package meta-information.
 +
 +
== Creating a Package ==
 +
 +
The <tt>pkgtools</tt> package includes utilities for working with packages and can be used to create packages directly on the Humax itself.
 +
 +
First create a directory to hold your new package and create a directory within it called CONTROL, which will be used for the package meta-information:
 +
 +
humax# cd /mod/tmp
 +
humax# mkdir my-first-package
 +
humax# mkdir my-first-package/CONTROL
 +
 +
{{Note|Package names should not contain underscore (_) characters as these are used as delimiters in package file names. It is safest to stick to alpha-numeric characters and use - as a delimiter where appropriate, e.g. <tt>webif-iphone</tt>}}
 +
 +
Place the files which make up your package directly into the new package directory. In this example, we'll create a package which just installs a script called <tt>hello</tt>.
 +
 +
humax# cd /mod/tmp/my-first-package
 +
humax# mkdir bin
 +
humax# cat > bin/hello
 +
#!/bin/sh
 +
 +
echo "Hello!"
 +
^D
 +
humax# chmod 755 bin/hello
 +
 +
{{Note|Files should be included relative to <tt>/mod</tt> so in this example the <tt>bin/hello</tt> file will be installed as <tt>/mod/bin/hello</tt>}}
 +
 +
Create file package control file as <tt>CONTROL/control</tt>. Here's an example:
 +
 +
<pre>
 +
Package: jim-sqlite3
 +
Priority: optional
 +
Section: misc
 +
Version: 0.71
 +
Architecture: mipsel
 +
Maintainer: af123@hummypkg.org.uk
 +
Depends: jim(>=0.71-1),sqlite3
 +
Description: Jim SQLite3 plugin.
 +
A plugin for the jim interpreter (a lightweight TCL interpreter) which
 +
provides access to SQLite3 databases (such as those used on the Humax).
 +
</pre>
 +
 +
The Debian project maintains [http://www.debian.org/doc/debian-policy/ch-controlfields.html documentation on the format of the control file] which also applies to opkg packages, although some fields are not required.
 +
 +
; Package : The package name.
 +
; Priority : Always set to optional for Humax packages.
 +
; Section : One of <tt>misc</tt>, <tt>net</tt>, <tt>devel</tt>, etc. [http://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections full list]
 +
; Version : The package version number of the format ''upstream_version[-opkg_version]'' [http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version more information]
 +
; Architecture : Always mipsel for the HD/HDR.
 +
; Maintainer : An email address or hummy.tv/wiki username.
 +
; Depends : A list of dependencies for this package, optionally with version constraints [http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps see Debian documentation]
 +
; Description : A description of the package. Continuation lines must be prefixed by whitespace.

Revision as of 11:21, 19 August 2011

The modified firmware includes a lightweight package management system called opkg (home page) which is similar to the Debian package management system (dpkg).

Package Repositories

The custom firmware is configured to use the package repository at hummypkg.org.uk by default.

Package Format

A package is a UNIX Archive (ar) file which itself contains three files:

debian-binary 
A file which just contains the string "2.0", a clue to the packaging system's roots.
data.tar.gz 
The files which make up the package.
control.tar.gz 
Package meta-information.

Creating a Package

The pkgtools package includes utilities for working with packages and can be used to create packages directly on the Humax itself.

First create a directory to hold your new package and create a directory within it called CONTROL, which will be used for the package meta-information:

humax# cd /mod/tmp
humax# mkdir my-first-package
humax# mkdir my-first-package/CONTROL

Note Note: Package names should not contain underscore (_) characters as these are used as delimiters in package file names. It is safest to stick to alpha-numeric characters and use - as a delimiter where appropriate, e.g. webif-iphone

Place the files which make up your package directly into the new package directory. In this example, we'll create a package which just installs a script called hello.

humax# cd /mod/tmp/my-first-package
humax# mkdir bin
humax# cat > bin/hello
#!/bin/sh

echo "Hello!"
^D
humax# chmod 755 bin/hello

Note Note: Files should be included relative to /mod so in this example the bin/hello file will be installed as /mod/bin/hello

Create file package control file as CONTROL/control. Here's an example:

Package: jim-sqlite3
Priority: optional
Section: misc
Version: 0.71
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: jim(>=0.71-1),sqlite3
Description: Jim SQLite3 plugin.
 A plugin for the jim interpreter (a lightweight TCL interpreter) which
 provides access to SQLite3 databases (such as those used on the Humax).

The Debian project maintains documentation on the format of the control file which also applies to opkg packages, although some fields are not required.

Package 
The package name.
Priority 
Always set to optional for Humax packages.
Section 
One of misc, net, devel, etc. full list
Version 
The package version number of the format upstream_version[-opkg_version] more information
Architecture 
Always mipsel for the HD/HDR.
Maintainer 
An email address or hummy.tv/wiki username.
Depends 
A list of dependencies for this package, optionally with version constraints see Debian documentation
Description 
A description of the package. Continuation lines must be prefixed by whitespace.