I’m really struggling to add cloudflares repository and install cloudflared during iso build.
Below is the instructions to add their repository. I’m really struggling with the cloudflare-main.gpg file. Where should i place it? and what is the path for it when im going to refer to it with --custom-apt-entry
EDIT: Forgot to mention that i’m building in docker
Thanks in advance
Debian Buster
# Add cloudflare gpg key
sudo mkdir -p --mode=0755 /usr/share/keyrings
curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-main.gpg >/dev/null
# Add this repo to your apt repositories
echo 'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared buster main' | sudo tee /etc/apt/sources.list.d/cloudflared.list
# install cloudflared
sudo apt-get update && sudo apt-get install cloudflared
I just tried your suggestion. I do however have an issue with the build. It can’t find the cloudflared package. I’m wondering if the repository is saved in the right location during the build?
Warning: apt-key output should not be parsed (stdout is not a terminal)
deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared buster main
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package cloudflared
E: config/hooks/live/89-cloudflare.chroot failed (exit non-zero). You should check for errors.
P: Begin unmounting filesystems...
P: Saving caches...
Reading package lists...
Building dependency tree...
Reading state information...
Almost. I have made a few modifications. Pipes are removed and replaced by redirects and i have added a bit of code to make sure the added repository matches the version of Debian used by VyOS.
Here’s the code I ended up with. I have tested it against builds of Equuleus and Sagitta 89-cloudflared.chroot
#!/bin/sh
#
# Purpose: Add Cloudflares repository and install cloudflared during VyOS build
#
# Debian Version
DEBIAN_VERSION=$(lsb_release -cs)
# GPG Key
CF_GPG_KEY="/usr/share/keyrings/cloudflare-main.gpg"
# Fetch signing key from Cloudflare.
curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg -o "${CF_GPG_KEY}"
# Check if cloudflare-main.gpg has been downloaded
if [ ! -f "${CF_GPG_KEY}" ]; then
echo "ERROR: ${CF_GPG_KEY} is missing!"
exit
fi
# Import the fetched signing key from Cloudflare.
apt-key add "${CF_GPG_KEY}"
# Add Cloudflare repository.
echo "deb [arch=amd64 signed-by=${CF_GPG_KEY}] https://pkg.cloudflare.com/cloudflared ${DEBIAN_VERSION} main" > /etc/apt/sources.list.d/cloudflared.list
# Install Cloudflared
apt-get update
apt-get -y install cloudflared