Skip to content

Commit

Permalink
pkgdata: apt-key is deprecated, use gpg
Browse files Browse the repository at this point in the history
apt-key is deprecated and will be removed in debian 12. Use gpg instead.

There are 2 basic ways of doing this:-
	curl
	| gpg --dearmor
	| tee

or
	gpg --recv-keys --keyring temp-keyring
	gpg export --keyring temp-keyring --output target-file
	rm -f temp-keyring

Signed-off-by: Mark Grant <[email protected]>
  • Loading branch information
m-grant-prg committed Feb 12, 2022
1 parent 2a7d557 commit 70cc63d
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 13 deletions.
9 changes: 8 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
# further package version information. #
# 22/11/2021 MG 1.1.6 Tighten SPDX tag. #
# Add AC_COPYRIGHT macro. #
# 10/02/2022 MG 1.1.7 apt-key is deprecated so use gpg - add #
# a program check. #
# #
#########################################################################

Expand All @@ -99,7 +101,7 @@ AC_COPYRIGHT([Copyright (C) 2014-2022 Mark Grant
This script is free to copy or distribute under the terms set out
in the package license. See COPYING for details.])

AC_REVISION([$Revision: 1.1.6 $])
AC_REVISION([$Revision: 1.1.7 $])

AC_PREREQ([2.69])

Expand Down Expand Up @@ -242,6 +244,11 @@ if test "x$GETOPT" = "xno" ; then
AC_MSG_WARN(getopt not found - needed at run time)
fi

AC_CHECK_PROG([GPG], [gpg], [yes], [no])
if test "x$GPG" = "xno" ; then
AC_MSG_WARN(gpg not found - needed at run time)
fi

AC_CHECK_PROG(PRINTF, printf, yes, no)
if test "x$PRINTF" = "xno" ; then
AC_MSG_WARN(printf not found - needed at run time)
Expand Down
9 changes: 6 additions & 3 deletions src/data/pkgdata/trusted.sh.d/add-hermes.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#########################################################################
# #
# Script ID: add-hermes.sh #
# Author: Copyright (C) 2020, 2021 Mark Grant #
# Author: Copyright (C) 2020-2022 Mark Grant #
# #
# Released under the GPLv3 only. #
# SPDX-License-Identifier: GPL-3.0-only #
Expand Down Expand Up @@ -62,6 +62,7 @@
# work in Ubuntu containers. #
# 25/04/2021 MG 1.0.3 Prefer curl to wget. #
# 22/11/2021 MG 1.0.4 Tighten SPDX tag. #
# 10/02/2022 MG 1.0.5 apt-key is deprecated, use gpg. #
# #
#########################################################################

Expand All @@ -72,7 +73,7 @@ set -e
##################
# Init variables #
##################
readonly version=1.0.4 # Script version
readonly version=1.0.5 # Script version
readonly outputprefix="$(basename $0): "
readonly packageversion=@pkgversion@ # Package version

Expand Down Expand Up @@ -201,5 +202,7 @@ proc_CL()
proc_CL "$@"

# Hermes
curl -fsSL"$verbose" http://hermes.mgent.home/aptrepos/hermes.gpg | sudo apt-key --keyring @sysconfdir@/apt/trusted.gpg.d/hermes-keyring.gpg add -
curl -fsSL"$verbose" http://hermes.mgent.home/aptrepos/hermes.gpg \
| gpg --dearmor \
| sudo tee @sysconfdir@/apt/trusted.gpg.d/hermes-keyring.gpg > /dev/null

16 changes: 12 additions & 4 deletions src/data/pkgdata/trusted.sh.d/add-mgrant-utils-ppa.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#########################################################################
# #
# Script ID: add-mgrant-utils-ppa.sh #
# Author: Copyright (C) 2020, 2021 Mark Grant #
# Author: Copyright (C) 2020-2022 Mark Grant #
# #
# Released under the GPLv3 only. #
# SPDX-License-Identifier: GPL-3.0-only #
Expand Down Expand Up @@ -59,6 +59,7 @@
# #
# 22/05/2020 MG 1.0.1 Created. #
# 22/11/2021 MG 1.0.2 Tighten SPDX tag. #
# 10/02/2022 MG 1.0.3 apt-key is deprecated, use gpg. #
# #
#########################################################################

Expand All @@ -69,7 +70,7 @@ set -e
##################
# Init variables #
##################
readonly version=1.0.2 # Script version
readonly version=1.0.3 # Script version
readonly outputprefix="$(basename $0): "
readonly packageversion=@pkgversion@ # Package version

Expand Down Expand Up @@ -196,6 +197,13 @@ proc_CL()
proc_CL "$@"

# Launchpad
sudo apt-key --keyring @sysconfdir@/apt/trusted.gpg.d/mgrant-utils-ppa-keyring.gpg adv --keyserver keyserver.ubuntu.com --recv-keys d1946372ba01d17602a2ccd372ddd80b3669565c
sudo apt-key --keyring @sysconfdir@/apt/trusted.gpg.d/mgrant-utils-ppa-keyring.gpg adv --keyserver keyserver.ubuntu.com --recv-keys 8294A6371AB32B66
sudo gpg --no-default-keyring \
--keyring @sysconfdir@/apt/trusted.gpg.d/tmp-keyring.gpg \
--keyserver keyserver.ubuntu.com \
--recv-keys d1946372ba01d17602a2ccd372ddd80b3669565c \
9F3747C4E4E55A576907F7038294A6371AB32B66
sudo gpg --export --no-default-keyring \
--keyring @sysconfdir@/apt/trusted.gpg.d/tmp-keyring.gpg \
--output @sysconfdir@/apt/trusted.gpg.d/mgrant-utils-ppa-keyring.gpg
rm -f @sysconfdir@/apt/trusted.gpg.d/tmp-keyring.gpg

10 changes: 7 additions & 3 deletions src/data/pkgdata/trusted.sh.d/add-raspberrypi.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#########################################################################
# #
# Script ID: add-raspberrypi.sh #
# Author: Copyright (C) 2020, 2021 Mark Grant #
# Author: Copyright (C) 2020-2022 Mark Grant #
# #
# Released under the GPLv3 only. #
# SPDX-License-Identifier: GPL-3.0-only #
Expand Down Expand Up @@ -60,6 +60,7 @@
# 22/05/2020 MG 1.0.1 Created. #
# 25/04/2021 MG 1.0.2 Prefer curl to wget. #
# 22/11/2021 MG 1.0.3 Tighten SPDX tag. #
# 11/02/2022 MG 1.0.4 apt-key is deprecated, use gpg. #
# #
#########################################################################

Expand All @@ -70,7 +71,7 @@ set -e
##################
# Init variables #
##################
readonly version=1.0.3 # Script version
readonly version=1.0.4 # Script version
readonly outputprefix="$(basename $0): "
readonly packageversion=@pkgversion@ # Package version

Expand Down Expand Up @@ -199,5 +200,8 @@ proc_CL()
proc_CL "$@"

# rapberrypi.org/debian
curl -fsSL"$verbose" https://archive.raspberrypi.org/debian/raspberrypi.gpg.key | sudo apt-key --keyring @sysconfdir@/apt/trusted.gpg.d/raspberrypi-keyring.gpg add -
curl -fsSL"$verbose" https://archive.raspberrypi.org/debian/raspberrypi.gpg.key \
| gpg --dearmor \
| sudo tee @sysconfdir@/apt/trusted.gpg.d/raspberrypi-keyring.gpg \
> /dev/null

6 changes: 4 additions & 2 deletions src/man/8/apt-key-scripts.sh.8.man.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ not need to be marked as executable. The keyring should be placed in
.br
For example the script could read:-
.RS
curl -fsSLO http://hermes.mgent.home/aptrepos/hermes.gpg | sudo apt-key --keyring @sysconfdir@/apt/trusted.gpg.d/hermes-keyring.gpg add -
curl -fsSL"$verbose" http://hermes.mgent.home/aptrepos/hermes.gpg \
| gpg --dearmor \
| sudo tee @sysconfdir@/apt/trusted.gpg.d/hermes-keyring.gpg > /dev/null
.RE

2 ... Install the script by
Expand Down Expand Up @@ -58,7 +60,7 @@ Example scripts can be found in @pkgdatadir@/trusted.sh.d
AUTHOR
Written by Mark Grant.
COPYRIGHT
Copyright (C) 2020, 2021 Mark Grant.
Copyright (C) 2020-2022 Mark Grant.
.br
License GPLv3: GNU GPL version 3 only
.br
Expand Down

0 comments on commit 70cc63d

Please sign in to comment.