How to update DigitalOcean legacy GPG key storage
DigitalOcean Metric Agent installation script (https://repos.insights.digitalocean.com/install.sh) installs GPG key with deprecated
apt-key utility. This brings up an annoying warning every time apt updates the list of packages:
W: https://repos.insights.digitalocean.com/apt/do-agent/dists/main/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
In order to migrate the key into new storage format, run these commands:
$ sudo -s # apt-key export A4C6383F | gpg --dearmour -o /usr/share/keyrings/digitalocean-agent.gpg # sed -i "s/^deb/deb \[arch=amd64 signed-by=\/usr\/share\/keyrings\/digitalocean-agent.gpg\]/" /etc/apt/sources.list.d/digitalocean-agent.list # apt-key del A4C6383F # exit