From bba65dd4264e204af1b6b40198c9a9e35f735a71 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Mon, 20 Apr 2026 10:28:14 +0200 Subject: [PATCH] Update profile scripts to be safer Resolves: RHEL-166369 --- gnupg2.csh | 3 +++ gnupg2.sh | 3 +++ gnupg2.spec | 5 +++-- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 gnupg2.csh create mode 100644 gnupg2.sh diff --git a/gnupg2.csh b/gnupg2.csh new file mode 100644 index 0000000..b72ba94 --- /dev/null +++ b/gnupg2.csh @@ -0,0 +1,3 @@ +if ( $?prompt ) then + setenv GPG_TTY `tty` +endif diff --git a/gnupg2.sh b/gnupg2.sh new file mode 100644 index 0000000..485ab8b --- /dev/null +++ b/gnupg2.sh @@ -0,0 +1,3 @@ +if [[ $- == *i* ]]; then + export GPG_TTY=$(tty) +fi diff --git a/gnupg2.spec b/gnupg2.spec index 1fb8f89..75ba543 100644 --- a/gnupg2.spec +++ b/gnupg2.spec @@ -9,6 +9,8 @@ License: CC0-1.0 AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-2.1-or-later Source0: https://gnupg.org/ftp/gcrypt/%{?pre:alpha/}gnupg/gnupg-%{version}%{?pre}.tar.bz2 Source1: https://gnupg.org/ftp/gcrypt/%{?pre:alpha/}gnupg/gnupg-%{version}%{?pre}.tar.bz2.sig Source2: https://gnupg.org/signature_key.asc +Source3: gnupg2.sh +Source4: gnupg2.csh # needed for compatibility with system FIPS mode Patch3: gnupg-2.1.10-secmem.patch # non-upstreamable patch adding file-is-digest option needed for Copr @@ -167,8 +169,7 @@ mkdir -p $HOME/.gnupg mkdir -p %{buildroot}%{_sysconfdir}/gnupg touch %{buildroot}%{_sysconfdir}/gnupg/gpgconf.conf mkdir -p %{buildroot}%{_sysconfdir}/profile.d -echo "export GPG_TTY=\$(tty)" > %{buildroot}%{_sysconfdir}/profile.d/gnupg2.sh -echo "setenv GPG_TTY \`tty\`" > %{buildroot}%{_sysconfdir}/profile.d/gnupg2.csh +install -p %{SOURCE3} %{SOURCE4} %{buildroot}%{_sysconfdir}/profile.d # more docs install -m644 -p AUTHORS NEWS THANKS TODO \