From 00f6a084f99e2a9ee9ceaaad3d4896e4bfc591dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= Date: Tue, 21 Dec 2021 01:58:12 +0100 Subject: [PATCH] Use lua for pre scriptlets to reduce dependencies Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2034336 --- authselect.spec | 55 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/authselect.spec b/authselect.spec index 52bfdd4..067c3c4 100644 --- a/authselect.spec +++ b/authselect.spec @@ -3,7 +3,7 @@ Name: authselect Version: 1.3.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Configures authentication and identity sources from supported profiles URL: https://github.com/authselect/authselect @@ -275,28 +275,42 @@ if [ $1 == 0 ] ; then %{_bindir}/authselect uninstall fi -%pre libs %if %{enforce_authselect} -# Check if this is a new installation. -%__rm -f %{forcefile} -if [ $1 -eq 1 ] ; then - touch %{forcefile} -fi +%pre libs -p +force_file = rpm.expand("%{forcefile}") +authselect = rpm.expand("%{_bindir}/authselect") +os.remove(force_file) -# Check if we are upgrading from older version then authselect-1.3.0 -# The version command is not available on earlier versions -if [ $1 -gt 1 ] ; then - %{_bindir}/authselect check &> /dev/null - if [ $? -ne 0 ]; then - %{_bindir}/authselect version &> /dev/null - if [ $? -ne 0 ]; then - touch %{forcefile} - fi - fi -fi +-- Check if this is a new installation. +if tonumber(arg[2]) == 1 +then + f = rpm.open(force_file, "w") + f:write("") + f:close() +end + +-- Check if we are upgrading from older version then authselect-1.3.0 +-- The version command is not available on earlier versions +if tonumber(arg[2]) > 1 +then + comm = os.execute(authselect .. " check &> /dev/null") + if comm ~= true + then + comm = os.execute(authselect .. " version &> /dev/null") + if comm ~= true + then + f = rpm.open(force_file, "w") + f:write("") + f:close() + end + end +end + +%else +%pre libs +exit 0 %endif -exit 0 %posttrans libs # Copy nsswitch.conf to user-nsswitch.conf if it was not yet created @@ -333,6 +347,9 @@ fi exit 0 %changelog +* Tue Dec 21 2021 Frantisek Zatloukal - 1.3.0-4 +- Use lua for pre scriptlets to reduce dependencies + * Fri Dec 10 2021 Pavel Březina - 1.3.0-3 - Update conflicting versions of glibc and pam