Handle signed-by option in __apt_source

Allow users to specify a GPG key fingerprint or keyring file to be
included as the 'signed-by' option.
This commit is contained in:
fancsali 2022-07-01 14:27:33 +01:00
parent 77d9a757ec
commit 1a3c8f2d63
4 changed files with 22 additions and 6 deletions

View file

@ -2,13 +2,14 @@
set -u set -u
entry="$uri $distribution $component" entry="$uri $distribution $component"
cat << DONE cat << DONE
# Created by cdist ${__type##*/} # Created by cdist ${__type##*/}
# Do not change. Changes will be overwritten. # Do not change. Changes will be overwritten.
# #
# $name # $name
deb ${forcedarch} $entry deb ${options} $entry
DONE DONE
if [ -f "$__object/parameter/include-src" ]; then if [ -f "$__object/parameter/include-src" ]; then
echo "deb-src $entry" echo "deb-src $entry"

View file

@ -23,6 +23,9 @@ OPTIONAL PARAMETERS
arch arch
set this if you need to force and specific arch (ubuntu specific) set this if you need to force and specific arch (ubuntu specific)
signed-by
provide a GPG key fingerprint or keyring path for signature checks
state state
'present' or 'absent', defaults to 'present' 'present' or 'absent', defaults to 'present'
@ -56,6 +59,11 @@ EXAMPLES
--uri http://archive.canonical.com/ \ --uri http://archive.canonical.com/ \
--component partner --state present --component partner --state present
__apt_source goaccess \
--uri http://deb.goaccess.io/ \
--component main \
--signed-by C03B48887D5E56B046715D3297BD1A0133449C3D
AUTHORS AUTHORS
------- -------

View file

@ -31,9 +31,15 @@ fi
component="$(cat "$__object/parameter/component")" component="$(cat "$__object/parameter/component")"
if [ -f "$__object/parameter/arch" ]; then if [ -f "$__object/parameter/arch" ]; then
forcedarch="[arch=$(cat "$__object/parameter/arch")]" options="arch=$(cat "$__object/parameter/arch")"
else fi
forcedarch=""
if [ -f "$__object/parameter/signed-by" ]; then
options="$options signed-by=$(cat "$__object/parameter/signed-by")"
fi
if [ "$options" != "" ]; then
options="[$options]"
fi fi
# export variables for use in template # export variables for use in template
@ -41,7 +47,7 @@ export name
export uri export uri
export distribution export distribution
export component export component
export forcedarch export options
# generate file from template # generate file from template
mkdir "$__object/files" mkdir "$__object/files"

View file

@ -1,4 +1,5 @@
state state
distribution distribution
component component
arch arch
signed-by