Difference between revisions of "Create or Update a Debian package"

From Organic Design wiki
m (Adding to a package repository)
m
Line 1: Line 1:
 
{{procedure
 
{{procedure
|description = This procedure defines the steps required to package up a collection of official packages and other installation script into a Debian package which can then be installed as part of the [[Debian Post Install]] using ''apt-get''
+
|description = This procedure defines the steps required to package up a collection of official packages and other installation script into a Debian package which can then be installed as part of the [[Debian Post Install]] using ''apt-get''. See [[Packages]] for more information on our overall package repository plans.
 
|role = dev
 
|role = dev
 
}}__NOTOC__
 
}}__NOTOC__

Revision as of 11:27, 1 July 2008

Procedure.svg Create or Update a Debian package
Organic Design procedure

General procedure

Working directory structure

Here's an example directory structure for a package which replaces the apache default config file and sets up default php and html files in /var/www.

The control file in the DEBIAN sub-directory is the all the main configuration is done. The other three files in that sub-directory are scripts which execute on installation and removal of the package.

The rest of the directory structure outside the DEBIAN sub-directory define the directory structure which will be merged with the root of the filesystem when the package is installed.

Building into a package

To turn the directory structure into a proper .deb package file, use:

dpkg -b <package-directory>

The package will be created with the same name but with the .deb extension in the same directory as the package directory.

Adding to a package repository

All the .deb package files must be added to the main repository on the server which is in /var/www/packages/main. Ensure that this repository is included in your /etc/apt/sources.list:

deb http://packages.organicdesign.co.nz main/

Whenever any of the packages in the repository change, the Packages.gz index file must be updated which can be done as follows:

dpkg-scanpackages /var/www/packages/main /dev/null | gzip > /var/www/packages/main/Packages.gz

See also