If there is one thing that the YoloCloud is made out of, is Yoloed things.

In the very beginning, one of the needs I had was distributing a Debian package to my Debian hosts containing a couple of custom monitoring checks as well as a backported version of Strongswan together with the required libs.

Aptly and Reprepro do a good job at managing repositories, but were way overkill for my simple need of distributing a few packages.

I slapped together a quick and dirty solution based off of some random scripts that I found on the Internet.

You need to create a GPG key to sign the Release file in the repository.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#!/bin/bash

set -e

KEYNAME=<gpg key ID>
REPODIR=/opt/repo/debian
cd $REPODIR/public

echo 'Building releases'
apt-ftparchive --arch amd64 packages pool/monitoring-main-amd64 > dists/monitoring/main/binary-amd64/Packages
gzip -k -f dists/monitoring/main/binary-amd64/Packages
apt-ftparchive -c /opt/repo/debian/monitoring_release.conf release dists/monitoring > dists/monitoring/Release
rm -fr dists/monitoring/Release.gpg; gpg --default-key ${KEYNAME} -abs -o dists/monitoring/Release.gpg dists/monitoring/Release 2>/dev/null
rm -fr dists/monitoring/InRelease; gpg --default-key ${KEYNAME} --clearsign -o dists/monitoring/InRelease dists/monitoring/Release 2>/dev/null
echo 'Done'

The script is pretty self-explanatory. Put your packages into pool/<repo_name> and the script takes care of the rest.

The conf file only has some APT metadata related to the repository:

APT::FTPArchive::Release::Codename "monitoring";
APT::FTPArchive::Release::Components "main";
APT::FTPArchive::Release::Label "AS209114 Monitoring Repository";
APT::FTPArchive::Release::Architectures "amd64";

This should get you started with a barebones repository.