%global pretrans_install %(cat %{SOURCE0} | sed s/%%/%%%%/g | sed s/\\^%%%%/^%%/g) Name: copy-jdk-configs Version: 4.1 Release: 1 Summary: JDKs Configuration File License: BSD URL: https://github.com/rh-openjdk/copy_jdk_configs Source0: %{URL}/raw/copy_jdk_configs-%{version}/copy_jdk_configs.lua Source1: %{URL}/raw/copy_jdk_configs-%{version}/LICENSE Source2: %{URL}/raw/copy_jdk_configs-%{version}/copy_jdk_configs_fixFiles.sh Patch0: Ongoing-fixes-on-rhbz#2100617.patch BuildArch: noarch Requires: lua lua-posix Requires: findutils OrderWithRequires: findutils %description Utility script for transferring JDK configuration files when updating or archiving. Repair rpmnew file created by error by using scrip %prep cp -a %{SOURCE1} . cp -a %{SOURCE2} . %patch0 -p0 %build %pretrans -p function createPretransScript() os.execute("mkdir -p %{_localstatedir}/lib/rpm-state") temp_path="%{_localstatedir}/lib/rpm-state/copy_jdk_configs.lua" file = io.open(temp_path, "w") file:write([[%{pretrans_install}]]) file:close() end if pcall(createPretransScript) then -- ok else -- print("Error running %{name} pretrans.") end %install install -D %{SOURCE0} $RPM_BUILD_ROOT/%{_libexecdir}/copy_jdk_configs.lua install -D %{_builddir}/copy_jdk_configs_fixFiles.sh $RPM_BUILD_ROOT/%{_libexecdir}/copy_jdk_configs_fixFiles.sh %posttrans rm "%{rpm_state_dir}/copy_jdk_configs.lua" 2> /dev/null || : %files %{_libexecdir}/* %license LICENSE %changelog * Wed Oct 25 2023 xu_ping<707078654@qq.com> - 4.1-1 - update to 4.1 * Mon Jan 06 2020 xu_ping - 4.0-1 - Upgrade 4.0 to fix Packaging scriptlets assume global 'arg' in Lua environment * Thu Nov 28 2019 gulining - 3.7-3 - Pakcage init