Tuesday, October 25, 2011

Portion Package Enhancement

Package Enhancement

I created portion to enhance the standard packaging process. The end goal is to create a packaging and deployment process that is easy to orchestrate with CfEngine. portion allows me to package software in a consistent way while continuing to leverage the standard Ubuntu repositories.

Core Packages

The core packages for portion are bbsh2 and bbpython2. These contain bash and python scripts that are used to bootstrap all other packages. They are special packages--all other packages are built using the facilities included in these two packages.

The apt repository is available at

deb http://fimero.bitbucket.org/ubuntu fimero main

We also run with badgerports configured on 10.04 LTS.

bbsh2

The source code for bbsh2 is available here. The primary functions used for portion are in libportion.sh.

bbpython2

The source code for bbpython2 is available here.

To create a package, first install bbpython2 with

$ sudo apt-get install bbpython2

This will also install bbsh2 via its dependency. Next, create a folder for your package. Be sure to put it under source control. In this tutorial, we'll package a demo script and call it bbdemo

$ mkdir bbdemo

Creating A Package

A Portion package requires the following

  • manifest file
  • payload.txt file
  • postinstall.sh
  • preremove.sh

manifest File

Use the manifest file from bbdemo as a template.


payload File

You must generate a payload.txt file that specifies all of the files that are included with your package.

$ bb-mkepmlist.sh {package} {version} {folder}

This script searches the {folder} and create a payload.txt file.

postinstall.sh Template


preremove.sh Template


Assembling Package

The functions to assemble the package are in libportion.sh.

$ source libportion.sh
$ epm_make_package

This creates a .deb package in the target folder.



No comments: