aboutsummaryrefslogtreecommitdiffstats
path: root/init.sh
diff options
context:
space:
mode:
authorMohammed Amar-Bensaber <renken@shione.net>2024-10-08 22:56:46 +0200
committerMohammed Amar-Bensaber <renken@shione.net>2024-10-08 22:56:46 +0200
commit8a556f59d314f1b3ce523f2123f86c7bdc1711f1 (patch)
tree365e556bf96f87885761add87dd6258b93c07188 /init.sh
parentcd8f0e853f5c05b382ae49207907f89b359712bf (diff)
downloadshione-debian/bookworm.tar.gz
shione-debian/bookworm.zip
test: initialize local apt repository for testingdebian/bookworm
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.
Diffstat (limited to 'init.sh')
-rwxr-xr-xinit.sh37
1 files changed, 37 insertions, 0 deletions
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