Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 2618

Raspberry Pi OS • Re: Warning from apt-key: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see te DEPRECATION

$
0
0

Code:

#!/bin/bash# Get the desired key and store it in the KEY variableKEY=$(apt-key list 2>/dev/null | grep -A4 "trusted.gpg$" | grep -oP '([A-F0-9]{4} ){1}[A-F0-9]{4}$' | tr -d '\n' | tr -d ' ')# Check if the key was foundif [ -z "$KEY" ]; then  echo "Key not found!"  exit 1fiecho "Key found: $KEY"# Export the key and convert it to .gpg formatsudo apt-key export $KEY 2>/dev/null | sudo gpg --dearmor -o /tmp/raspi.gpg# Delete the old keysudo apt-key del $KEY 2>/dev/nullecho "Key $KEY deleted successfully!"# Move the .gpg file to /etc/apt/trusted.gpg.d/sudo mv /tmp/raspi.gpg /etc/apt/trusted.gpg.d/echo "Converted key moved to /etc/apt/trusted.gpg.d/raspi.gpg"

Statistics: Posted by ChatGpiT — Fri Jan 17, 2025 12:06 pm



Viewing all articles
Browse latest Browse all 2618

Trending Articles