Table of Contents

Debian

Notes

Installing Debian from a serial console

Keys from Keyserver

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv ....KEY....

So the new apt key stuff is a bit arcane. Try this instead to download and install a key from a keyserver. This is extremely quick and dirty, expect it to break under non-ideal situations and leave artifacts that make noise. Bare minimal checking.

TODO: Do some magic, set the names from the repo URL or something. Check to make sure we got something, etc

#!/bin/sh
#
#   Script: key-madness
#
# Last Modified: 2023-06-26 16:27:51
#

# Use this one or things don't seem to work
KEYRING_TYPE=gnupg-ring
#KEYRING_TYPE=gpupg-kbx

# For now lets put the stuff here
TARGET_FOLDER=/etc/apt/keyrings

myuid=`id -u`
if [ $myuid -ne 0 ]
then
    echo "Gotta be root"
    exit 0
fi

reponame="$1"
fingerprint="$2"

if [ "$fingerprint" = "" ]
then
    echo "No fingerprint"
    exit 255
fi

# Stick it here, remove any cruft
repopath=${TARGET_FOLDER}/${reponame}.gpg
rm -f $repopath ${repopath}~

# Fetch the key and write it to our folder
cmd="sudo gpg --no-default-keyring \
    --keyring ${KEYRING_TYPE}:${repopath} \
    --keyserver hkp://keyserver.ubuntu.com:80 \
    --recv-keys \"$fingerprint\"
"
echo "$cmd"
eval "$cmd"

# Clean out the backup gpg made
rm -f ${repopath}~
chmod +r $repopath

# Ugly, ugly, ugly mess IMNSHO
echo "Add [signed-by=$repopath] after deb/deb-src in your sources.list file]"

Misc