Skip to content

Instantly share code, notes, and snippets.

@themactep
Created February 19, 2023 20:47
Show Gist options
  • Save themactep/596e6e2430d8641db249cdede666c92d to your computer and use it in GitHub Desktop.
Save themactep/596e6e2430d8641db249cdede666c92d to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Convert deprecated apt-key keys storage to GPG keys.
# Paul Philippov <paul@themactep.com>
#
keys=$(sudo apt-key list | grep -A1 ^pub | grep "^ " | sed "s/\s*//g" | sort | uniq)
for k in $keys; do
sudo apt-key export $k | \
sudo gpg --dearmour -o /usr/share/keyrings/$k.gpg --yes &&
sudo apt-key del $k
done
echo "Done"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment