Use lua for pre scriptlets to reduce dependencies

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2034336
This commit is contained in:
František Zatloukal 2021-12-21 01:58:12 +01:00
parent a470fda9c1
commit 00f6a084f9

View File

@ -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 <lua>
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 <fzatlouk@redhat.com> - 1.3.0-4
- Use lua for pre scriptlets to reduce dependencies
* Fri Dec 10 2021 Pavel Březina <pbrezina@redhat.com> - 1.3.0-3
- Update conflicting versions of glibc and pam