From 8a556f59d314f1b3ce523f2123f86c7bdc1711f1 Mon Sep 17 00:00:00 2001 From: Mohammed Amar-Bensaber Date: Tue, 8 Oct 2024 22:56:46 +0200 Subject: test: initialize local apt repository for testing This with the combination of `podman run --rm -v "$PWD:/tmp/shione" -it debian:stable /bin/bash` allows me to quickly install packages to validate that the installation process is valid. Post-deployment failures/mis-configurations are another problem. --- init.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 init.sh (limited to 'init.sh') diff --git a/init.sh b/init.sh new file mode 100755 index 0000000..33cdc7e --- /dev/null +++ b/init.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +set -eux + +apt update +apt install -y apt-utils + +mkdir -p -- /var/shione/debian/pool/main +cp -- /tmp/shione/build/*.deb /var/shione/debian/pool/main + +# XXX: Stolen from `local-apt-repository` which did not work for me for some reason. +debs_dir_path=/var/shione/debian +deb_repo_path=/var/lib/local-apt-repository +mkdir -p -- "$deb_repo_path" + +# Relative paths work better than absolute +cd -- "$deb_repo_path" +apt-ftparchive packages ../../../"$debs_dir_path" >"$deb_repo_path"/Packages +apt-ftparchive sources ../../../"$debs_dir_path" >"$deb_repo_path"/Sources + +apt-ftparchive \ + -o "APT::FTPArchive::Release::Origin=local-apt-repository-shione" \ + -o "APT::FTPArchive::Release::Description=Local repository created by a minimal version of local-apt-repository" \ + release "$deb_repo_path" > "$deb_repo_path"/Release + +<<-EOF cat -- >/etc/apt/sources.list.d/local-apt-repository.list +# This enables the local repositories provided by local-apt-repository +# +# We do not use cryptographic signatures, as they are read from local system +# anyways. +deb [trusted=yes] file:///var/lib/local-apt-repository/ ./ +deb-src [trusted=yes] file:///var/lib/local-apt-repository/ ./ +EOF + +apt update + +apt install -y nftables-config -- cgit v1.2.3