Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tooling: Add utility scripts to help using this repository #25

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 build use the proper version of [reprepro](https://salsa.debian.org/brlink/reprepro), that we are using under the hood.

```
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the mention to zstd is we don't seem to be using it at all.

(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 the references to the
versions in the repository
* `./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.
* This is the command to run to do this inside the 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 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

VERSION=$(cat ~dz/dangerzone/share/version.txt)
PACKAGE=dangerzone_${VERSION}-1_amd64.deb

cp ~dz/dangerzone/deb_dist/${PACKAGE} 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/*/*${VERSION}*.deb
8 changes: 8 additions & 0 deletions tools/reset-repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/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
git checkout repo/public/fpf-apt-tools-archive-keyring.gpg