Create a binary Debian package

Alex Chen alex_chen at claris.com
Mon Jan 25 07:21:01 UTC 2021


Hi,
   I am trying to create a Debian package, i.e. a .deb file, that can install  software in Ubuntu. I put a the following files under the build directory:

build_dir/DEBIAN/control - Package configuration
build_dir/DEBIAN/md5sums - MD5 checksums of every files to be installed.
build_dir/DEBIAN/preinst postinst  prerm postrm - Pre/Post installation and pre/post uninstallation scripts.

This what I have in the 'control' file
=====
Package: test-package
Version: 1.0.0
Architecture: amd64
Pre-Depends: coreutils, libicu60, libfontconfig1, firewalld, unzip, zip, curl, lapache2, apache2-bin
======

I thought packages listed in Pre-Depends field of a control file are supposed to be installed by the system before it process the package itself, according to this document: https://www.debian.org/doc/debian-policy/ch-relationships.html#binary-dependencies-depends-recommends-suggests-enhances-pre-depends <https://www.debian.org/doc/debian-policy/ch-relationships.html#binary-dependencies-depends-recommends-suggests-enhances-pre-depends>

I was able create the package with 'dpkg-deb --build build_dir' command successfully, however I got the following dependency errors when I tried to install the package in an Ubuntu server

===========
$ sudo dpkg -i test-package_1.0.0_amd64.deb 
[sudo] password for tester
dpkg: regarding test-package_1.0.0_amd64.deb containing test-package, pre-dependency problem:
 test-package pre-depends on libfontconfig1
  libfontconfig1 is not installed.

dpkg: error processing archive test-package_1.0.0_amd64.deb (--install):
 pre-dependency problem - not installing test-package
Errors were encountered while processing:
 test-package_1.0.0_amd64.deb
=============


I got the following errors if I changed Pre-Depends to Depends in 'control'
===============
$ sudo dpkg -i test-package_1.0.0_amd64.deb 
Selecting previously unselected package test-package.
(Reading database ... 102747 files and directories currently installed.)
Preparing to unpack test-package_1.0.0_amd64.deb ...
Unpacking test-package (1.0.0) ...
dpkg: dependency problems prevent configuration of test-package
 test-package depends on libfontconfig1; however:
  Package libfontconfig1 is not installed.
 test-package depends on firewalld; however:
  Package firewalld is not installed.
 test-package depends on apache2; however:
  Package apache2 is not installed.
 test-package depends on apache2-bin; however:
  Package apache2-bin is not installed.
 
dpkg: error processing package test-package (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 test-package
==============

Isn't the 'Pre-Depends' field in the 'control' file equivalent to the 'Requires' directive in a RPM specification file?

How can I get the 'dpkg' command to install the prerequisites before it unpack and install my package?

Any help is appreciated.

Alex






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-devel-discuss/attachments/20210124/97fe15cf/attachment.html>


More information about the Ubuntu-devel-discuss mailing list