Commit ee131435 authored by Vitaly Lipatov's avatar Vitaly Lipatov

add epm repo importgpg - import gpg key to package manager

parent 3d7e1e39
...@@ -74,6 +74,10 @@ epm_repo() ...@@ -74,6 +74,10 @@ epm_repo()
load_helper epm-repo-addkey load_helper epm-repo-addkey
epm_addkey "$@" epm_addkey "$@"
;; ;;
importgpg) # HELPCMD: import gpg key (by URL or file)
load_helper epm-repo-addkey
epm_importgpg "$@"
;;
clean) # HELPCMD: remove temp. repos (tasks and CD-ROMs) clean) # HELPCMD: remove temp. repos (tasks and CD-ROMs)
load_helper epm-repofix load_helper epm-repofix
epm_repoclean "$@" epm_repoclean "$@"
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2023 Etersoft # Copyright (C) 2023, 2025 Etersoft
# Copyright (C) 2023 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2023, 2025 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -31,6 +31,22 @@ __epm_get_file_from_url() ...@@ -31,6 +31,22 @@ __epm_get_file_from_url()
echo "$tmpfile" echo "$tmpfile"
} }
__epm_altgpg()
{
sudocmd gpg --no-default-keyring --keyring /usr/lib/alt-gpgkeys/pubring.gpg "$@"
}
__epm_importgpg_altlinux()
{
local res
local url="$1"
local tmpfile=$(__epm_get_file_from_url "$url") || fatal
# just always try import
__epm_altgpg --import $tmpfile
res=$?
rm $tmpfile
return $res
}
__epm_addkey_altlinux() __epm_addkey_altlinux()
{ {
local name local name
...@@ -171,6 +187,28 @@ __epm_addkey_deb() ...@@ -171,6 +187,28 @@ __epm_addkey_deb()
sudocmd apt-key adv --keyserver "$url" --recv "$fingerprint" sudocmd apt-key adv --keyserver "$url" --recv "$fingerprint"
} }
epm_importgpg()
{
if [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ -z "$1" ] ; then
message "Usage: $ epm repo importgpg <url>"
return
fi
# initialize here
remove_on_exit
case $BASEDISTRNAME in
"alt")
__epm_importgpg_altlinux "$@"
return
;;
esac
}
epm_addkey() epm_addkey()
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment