From a0dfb63892577f1cf42b08dc03fde582e1cfefb6 Mon Sep 17 00:00:00 2001
From: Marc Remy <mremy01@gmx.net>
Date: Mon, 16 Oct 2023 13:04:58 +0200
Subject: [PATCH] Use the recommended way to manage repository key.

As described in the Debian wiki:
https://wiki.debian.org/DebianRepository/UseThirdParty
---
 templates/pages/download/linux/debian.html | 4 ++--
 templates/pages/download/linux/ubuntu.html | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/templates/pages/download/linux/debian.html b/templates/pages/download/linux/debian.html
index a866e0b6..b2fd1adf 100644
--- a/templates/pages/download/linux/debian.html
+++ b/templates/pages/download/linux/debian.html
@@ -46,10 +46,10 @@ To use the apt repository, follow these steps:
 
 <div class="pg-script-container">
     <pre id="script-box" class="code"># Create the file repository configuration:
-sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
+sudo sh -c 'echo "deb [signed-by=/etc/apt/trusted.gpg.d/ACCC4CF8.gpg] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
 
 # Import the repository signing key:
-wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
+wget --quiet -O -  https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo sh -c "gpg -o /etc/apt/trusted.gpg.d/ACCC4CF8.gpg --dearmor"
 
 # Update the package lists:
 sudo apt-get update
diff --git a/templates/pages/download/linux/ubuntu.html b/templates/pages/download/linux/ubuntu.html
index 6721b717..c81714b2 100644
--- a/templates/pages/download/linux/ubuntu.html
+++ b/templates/pages/download/linux/ubuntu.html
@@ -47,10 +47,10 @@ To use the apt repository, follow these steps:
 
 <div class="pg-script-container">
     <pre id="script-box" class="code"># Create the file repository configuration:
-sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
+sudo sh -c 'echo "deb [signed-by=/etc/apt/trusted.gpg.d/ACCC4CF8.gpg] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
 
 # Import the repository signing key:
-wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
+wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo sh -c "gpg -o /etc/apt/trusted.gpg.d/ACCC4CF8.gpg --dearmor"
 
 # Update the package lists:
 sudo apt-get update
-- 
2.39.2

