Difference between revisions of "Create or Update a Debian package"
(GPG keys) |
(→Modifying dependencies in a .deb file) |
||
Line 76: | Line 76: | ||
apt-key add repo.key | apt-key add repo.key | ||
</pre>}} | </pre>}} | ||
+ | |||
+ | == Modifying dependencies in a .deb file == | ||
+ | # dpkg-deb -x foo.deb tmpdir | ||
+ | # dpkg-deb --control foo.deb tmpdir/DEBIAN | ||
+ | # nano tmpdir/DEBIAN/control | ||
+ | # dpkg -b tmpdir hacked.deb | ||
== See also == | == See also == |
Revision as of 16:24, 25 October 2014
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 where 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.
Our packages at Organic Design are in /var/www/domains/packages and the source directory structures for them are in the sources subdirectory.
Building or updating a package
Next the source needs to be built into a .deb file, if this is being done for an existing package which is being updated, then don't forget to ensure that the version number in the control file is larger.
To turn the directory structure into a proper .deb package file, use:
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:
Whenever any of the packages in the repository change, the Packages.gz index file must be updated which can be done as follows.
Creating a GPG Key
- Don't choose a password for signing, or automated package processing will not work.
Export the public key for import into apt:
Using the line that states "pub" look for the hex numbers after the / (eg. pub 1024D/5F6DEDCD 2008-07-10)
We'll use my temporary key hex for this example, be sure to change it.
Whenever you connect a new system to this apt repository you will need to place a copy of the key into your working directory and issue the following command:
Modifying dependencies in a .deb file
- dpkg-deb -x foo.deb tmpdir
- dpkg-deb --control foo.deb tmpdir/DEBIAN
- nano tmpdir/DEBIAN/control
- dpkg -b tmpdir hacked.deb
See also
- Packages - we plan to manage our IT infrastructure using APT
- organicdesign-server
- organicdesign-workstation
- LinuxDevices instructions
- TLDP HOWTO
- Google:creating Debian packages
- Format of sources.list file