Skip to content

Commit

Permalink
tooling: Add utility scripts to help using this repository
Browse files Browse the repository at this point in the history
Also update the README to be closer to the current usage.
  • Loading branch information
almet committed Dec 3, 2024
1 parent b0d50ca commit c2cef42
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 17 deletions.
45 changes: 28 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,37 @@ Currently, this includes [Dangerzone](https://dangerzone.rocks/).
## Prerequisites

- [git-lfs](https://git-lfs.github.com/) to store large files.
- [reprepro](https://salsa.debian.org/brlink/reprepro) to update the local
Debian repo:
* To install from source, try
[this repo](https://github.com/ionos-cloud/reprepro).
* Alternatively, build a container image using the `Dockerfile` in this repo:
- Docker, to use the required version of [reprepro](https://salsa.debian.org/brlink/reprepro), across OSes.

```
docker build -t apt-tools-prod-builder .
```
## Installation

First, set up a machine with the GPG key used for signing Release files.

- `zstd`, for newer Ubuntu distributions and future Debian distributions
(this has not been thoroughly tested yet).
Then, build a container image using the `Dockerfile` in this repo:

```
docker build -t apt-tools-prod-builder .
```

## Usage

- Set up a machine with the GPG key used for signing Release files.
When you want to release some files on the apt repository, you will need to add
them in the `dangerzone/*` folders, and then rebuild the debian repository from
scratch.

- Commit new package files to each suite in `dangerzone`. You may want to
prune older versions as new ones are released, to keep the repo
manageable.
manageable. You can use the scripts located in `./tools` for this:

* `./tools/remove-version X.Y.Z` will remove all Dangerzone packages from the
repository that match a specific version.
* `./tools/add-version` will get the debian file from the main dangerzone
repository, put it in the proper folder and create symlinks.
* `./tools/reset-repo` will reset the repository, it can be useful before
publishing it.

- Run `./tools/publish`, to populate the Debian database.
* You can run this part in a Docker container:
- Then, you can run `./tools/publish`, to populate the Debian database.
* Here is how you can do this inside a container:

```
docker run --rm -v .:/home/user/apt-tools-prod apt-tools-prod-builder ./tools/publish
Expand All @@ -41,7 +49,10 @@ Currently, this includes [Dangerzone](https://dangerzone.rocks/).
When PRs are merged, `packages.freedom.press` will pull new files and
serve the contents of `repo/public`.
## Adding a new distribution
## Adding and removing a distribution
You need to do the following things when adding and/or removing a distribution:
- Add a new folder inside `dangerzone`, named after the distribution version
- Update the `repo/conf/distributions` file and add your distrbution version.
- Update the `dangerzone/*` folders accordingly. They are named after the distribution version
- Update the `repo/conf/distributions` file and add/remove your distribution version.
- Update the `.github/workflows/ci.yaml` file, with the updated distribution list.
19 changes: 19 additions & 0 deletions tools/add-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# Script to add a version from the dangerzone repository, by
# copying the debian file to the bookworm folder and creating
# symlinks for it.

set -e
set -x
set -o pipefail

PACKAGE_SRC=$1
PACKAGE=$(basename $PACKAGE_SRC)

cp $PACKAGE_SRC dangerzone/bookworm/$PACKAGE

for dir in dangerzone/* ; do
if [ "$dir" != "dangerzone/bookworm" ]; then
ln -sf "../bookworm/$PACKAGE" "$dir/."
fi
done
13 changes: 13 additions & 0 deletions tools/remove-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
# Script to remove all the packages for a specific version
set -e
set -o pipefail

if [ $# -ne 1 ]; then
echo "Usage: $0 VERSION"
echo "Example: $0 0.7.1"
exit 1
fi

VERSION=$1
rm dangerzone/*/dangerzone_${VERSION}*.deb
7 changes: 7 additions & 0 deletions tools/reset-repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
# Script to reset the repository, without removing the gpg key.
set -e
set -x
set -o pipefail

rm -rf repo/db repo/public/dists repo/public/pool

0 comments on commit c2cef42

Please sign in to comment.