Packaging Drone CLI for Debian

There’s currently binary releases of Drone CLI for Linux, but none that can work with the system’s default package manager, the most popular being APT, the one for Debian distributions.

I’m seeing that there were some propositions for packaging Drone as a Snap package, but I was interested in showing a way for creating a Debian package as well.

The method would use a tool I’ve been working on, which would utilize the PKGBUILD format used by Arch Linux.

The format to create the package would look something along the lines of this:

# Maintainer: Foo Bar <[email protected]>

pkgname=drone-cli
pkgver=1.3.0
pkgrel=1
pkgdesc="Command Line Tools for Drone CI"
arch=('x86_64')
license=('Apache-2.0')
url="https://github.com/drone/drone-cli"

source_x86_64=("${url}/releases/download/v${pkgver}/drone_linux_amd64.tar.gz")
sha256sums_x86_64=("d6953aa963c2c0b25911fb3d659b78b75060cd2acce53b0e9e16336a30c83706")

package() {
    install -Dm 555 "${srcdir}/drone" "${pkgdir}/usr/bin/drone"
}

The only thing that would need to be changed when Drone CLI itself updates is the pkgver variable, as well as the hash sums under sha256sums.

If you were to want to implement extra architectures, that could also be done with extra entries in the arch variable, and then adding corresponding entries for source and sha256sums.

The created .deb file could also be used as the base for a Snap package, and would only require adding it to the Snap’s configuration file.