Creating .deb Packages

From Leo's Notes
Last edited on 1 September 2019, at 06:20.

Simple Binary Package[edit | edit source]

Required Files and Directories[edit | edit source]

At the minimum, you should have:

 ./my-package/
 ./my-package/DEBIAN
 ./my-package/DEBIAN/prerm
 ./my-package/DEBIAN/postinst
 ./my-package/DEBIAN/control
 ./my-package/usr/some/other/file

What's critical is the control file. The prerm/postinst scripts are optional. The rest are the files that are part of your package.

The control File[edit | edit source]

Package: cpsc-gpxe
Section: cpsc
Priority: extra
Maintainer: Leo Leung <lleung@ucalgary.ca>
Version: 0.1.1
Homepage: http://pages.cpsc.ucalgary.ca/~leo/support
Architecture: all
Depends: bash, coreutils, grub2-common, cpsc-initd
Description: Enables the gPXE grub option

Building the .dep Package[edit | edit source]

Once you have all your files

#!/bin/sh
BaseDirectory="/mnt/package_build/debbuild"
OutputDirectory="/mnt/repository/extras"

if [ -z $1 ] ; then
        echo "Usage: sh build <package directory>"
        exit
fi

cd $BaseDirectory
dpkg-deb --build $1
dpkg-sig --sign builder $1.deb

cd $OutputDirectory
sh add_deb.sh $BaseDirectory/$1.deb

rm $BaseDirectory/$1.deb


Building From Source[edit | edit source]

See http://wikipyw.appspot.com/How_To_Create_A_DEB_Package