Creating .deb Packages

From Leo's Notes
Revision as of 15:46, 21 May 2013 by Leo (talk | contribs) (Created page with " == Required Files and Directories == At the minimum, you should have: <syntaxhighlight lang="text" line start="1" enclose="div"> ./my-package/ ./my-package/DEBIAN ./my-pa...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
This page was last edited on 21 May 2013, at 15:46.


Required Files and Directories

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

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

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