2024-07-14 18:22:50 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Clean and reset the workspaces
|
|
|
|
echo "Setting up the workspace"
|
|
|
|
# Rsync active repo to local workspace
|
2024-07-19 15:08:25 -04:00
|
|
|
rsync --archive gitlab-runner@10.116.0.3:/srv/ $HOME/srv/
|
2024-07-14 18:22:50 -04:00
|
|
|
# Delete previous versions of packages
|
|
|
|
rm -rf $HOME/srv/apt/pool/stable/main/*.deb
|
2024-07-19 15:08:25 -04:00
|
|
|
rm -rf $HOME/srv/rpm/stable/x86_64/*
|
2024-07-14 18:22:50 -04:00
|
|
|
|
|
|
|
# Setup crypto
|
|
|
|
export GNUPGHOME="$(mktemp -d ~/pgpkeys-XXXXXX)"
|
2024-07-19 16:49:29 -04:00
|
|
|
cat veilid-packages-key.private | gpg --import
|
2024-07-14 18:22:50 -04:00
|
|
|
gpg --armor --export admin@veilid.org > $HOME/srv/gpg/veilid-packages-key.public
|
|
|
|
|
|
|
|
# Copy .deb files into the workspace and generate repo files
|
|
|
|
echo "Starting deb process"
|
|
|
|
cd $HOME
|
|
|
|
tar -xf amd64-debs.tar
|
|
|
|
tar -xf arm64-debs.tar
|
|
|
|
cp *.deb $HOME/srv/apt/pool/stable/main
|
|
|
|
cd $HOME/srv/apt
|
|
|
|
echo "Creating Packages file"
|
|
|
|
dpkg-scanpackages --arch amd64 pool/stable > dists/stable/main/binary-amd64/Packages
|
|
|
|
dpkg-scanpackages --arch arm64 pool/stable > dists/stable/main/binary-arm64/Packages
|
|
|
|
cat dists/stable/main/binary-amd64/Packages | gzip -9 > dists/stable/main/binary-amd64/Packages.gz
|
|
|
|
cat dists/stable/main/binary-arm64/Packages | gzip -9 > dists/stable/main/binary-arm64/Packages.gz
|
|
|
|
echo "Creating Release file"
|
|
|
|
cd $HOME/srv/apt/dists/stable
|
2024-08-02 13:52:16 -04:00
|
|
|
bash $HOME/generate-stable-release.sh > Release
|
2024-07-14 18:22:50 -04:00
|
|
|
echo "Signing Release file and creating InRelease"
|
|
|
|
cat $HOME/srv/apt/dists/stable/Release | gpg --default-key admin@veilid.org -abs > $HOME/srv/apt/dists/stable/Release.gpg
|
|
|
|
cat $HOME/srv/apt/dists/stable/Release | gpg --default-key admin@veilid.org -abs --clearsign > $HOME/srv/apt/dists/stable/InRelease
|
|
|
|
|
|
|
|
# Copy .rpm files into the workspace and generate repo files
|
|
|
|
echo "Starting rpm process"
|
|
|
|
cd $HOME
|
|
|
|
tar -xf amd64-rpms.tar
|
|
|
|
echo "Copying rpms to container workspace"
|
|
|
|
cp *x86_64.rpm $HOME/rpm-build-container/mount/repo/stable/x86_64
|
|
|
|
echo "Copying signing material to container workspace"
|
2024-07-19 16:49:29 -04:00
|
|
|
cp -R $GNUPGHOME/* $HOME/rpm-build-container/mount/keystore
|
2024-07-14 18:22:50 -04:00
|
|
|
echo "Executing container actions"
|
2024-07-19 15:08:25 -04:00
|
|
|
docker run --rm -d -it --name rpm-repo-builder --mount type=bind,source=$HOME/rpm-build-container/mount,target=/mount rpm-repo-builder-img:v12
|
2024-07-14 18:22:50 -04:00
|
|
|
sleep 2
|
2024-07-19 15:08:25 -04:00
|
|
|
cp -R $HOME/rpm-build-container/mount/repo/stable/x86_64/* $HOME/srv/rpm/stable/x86_64/
|
2024-07-14 18:22:50 -04:00
|
|
|
cd $HOME/srv/rpm/stable/x86_64
|
|
|
|
echo "Signing the rpm repository"
|
|
|
|
gpg --default-key admin@veilid.org --detach-sign --armor $HOME/srv/rpm/stable/x86_64/repodata/repomd.xml
|
|
|
|
|
2024-07-19 15:08:25 -04:00
|
|
|
# Generate .repo file for stable x86_64 releases
|
2024-07-14 18:22:50 -04:00
|
|
|
echo "[veilid-stable-x86_64-rpm-repo]
|
|
|
|
name=Veilid Stable x86_64 RPM Repo
|
|
|
|
baseurl=https://packages.veilid.net/rpm/stable/x86_64
|
|
|
|
enabled=1
|
|
|
|
gpgcheck=1
|
2024-07-19 15:08:25 -04:00
|
|
|
gpgkey=https://packages.veilid.net/gpg/veilid-packages-key.public" > $HOME/srv/rpm/stable/x86_64/veilid-stable-x86_64-rpm.repo
|
|
|
|
|
|
|
|
# Generate .repo file for stable arm64 releases -- to be added
|
|
|
|
# echo "[veilid-stable-arm64-rpm-repo]
|
|
|
|
# name=Veilid Stable x86_64 RPM Repo
|
|
|
|
# baseurl=https://packages.veilid.net/rpm/stable/arm64
|
|
|
|
# enabled=1
|
|
|
|
# gpgcheck=1
|
|
|
|
# gpgkey=https://packages.veilid.net/gpg/veilid-packages-key.public" > $HOME/srv/rpm/stable/x86_64/veilid-stable-arm64-rpm.repo
|
2024-07-14 18:22:50 -04:00
|
|
|
|
|
|
|
# Tar the repo data and transfer to the repo server
|
|
|
|
echo "Moving the repo scaffold to the repo server"
|
|
|
|
cd $HOME
|
2024-07-19 15:40:31 -04:00
|
|
|
rsync --archive --delete $HOME/srv/* gitlab-runner@10.116.0.3:/srv
|
2024-07-14 18:22:50 -04:00
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
echo "Cleaning up the workspace"
|
|
|
|
rm -rf $GNUPGHOME
|
2024-07-19 15:08:25 -04:00
|
|
|
rm $HOME/*.tar
|
2024-07-14 18:22:50 -04:00
|
|
|
rm $HOME/*.deb
|
|
|
|
rm $HOME/*.rpm
|
2024-07-19 15:08:25 -04:00
|
|
|
rm -rf $HOME/rpm-build-container/mount/keystore/*
|
|
|
|
rm -rf $HOME/rpm-build-container/mount/repo/nightly/x86_64/*
|
|
|
|
echo "Stable packages distribution process complete"
|