Getting it on Debian
This part is kind of weird. We want to getpacman
on Debian. There isn't an apt
package, so what now? Well, we can build a .deb
file that installs pacman
so we can use PKGBUILDs. Basically, we use a package management system to install a package management system.There's gotta be a "Yo Dawg" in there somewhere.
Get it pacman arch and be sure to get its dependency libdownload.
A look at some PKGBUILDs
Let's take a look some PKGBUILDs that we use at Kickball Labs.The first is a simple PKGBUILD for ltrace, a program like strace but for library calls. It just downloads the source, passes in some custom options to configure, builds the binary, and then installs to the package directory.
pkgname=ltrace
pkgver=0.5.1
pkgrel=1
pkgdesc="ltrace is a debugging program which runs a specified command until it exits"
url="http://packages.debian.org/unstable/utils/ltrace"
arch=('x86_64')
source=(http://ftp.debian.org/debian/pool/main/l/ltrace/${pkgname}_${pkgver}.orig.tar.gz)
pkgver=0.5.1
pkgrel=1
pkgdesc="ltrace is a debugging program which runs a specified command until it exits"
url="http://packages.debian.org/unstable/utils/ltrace"
arch=('x86_64')
source=(http://ftp.debian.org/debian/pool/main/l/ltrace/${pkgname}_${pkgver}.orig.tar.gz)
build()
{
cd $startdir/src/$pkgname-$pkgver
./configure --prefix=/custom --sysconfdir=/custom/etc{
cd $startdir/src/$pkgname-$pkgver
make || return 1
make DESTDIR=$startdir/pkg install
Conclusion
Package management is painful. If you have any plans on building a service that scales to multiple machines, you had better have a good solution for creating and distributing packages.pacman
is good for this because:- It's easy to learn and use, encouraging you to make everything (from libraries to configuration files and more) a PKGBUILD.
- The simple plain text file format works great with your source control system of choice.
- Applied a patch you didn't like? Just roll the PKGBUILD file back with your package manager.
- Create a
PKGBUILD
repository by just putting the tarballs generated from yourPKGBUILD
files in a directory and pointing a web server at it. This is great for bringing up new hardware in a datacenter - just installpacman
, point it at your repository, and install your base package which sets up the all yourpasswd
,host
, or other config files.