dc70cb
%global project copy_jdk_configs
dc70cb
%global file %{project}.lua
dc70cb
%global fixFile %{project}_fixFiles.sh
dc70cb
%global rpm_state_dir %{_localstatedir}/lib/rpm-state
dc70cb
dc70cb
Name:    copy-jdk-configs
dc70cb
dc70cb
# hash relevant to version tag
e4e3d1
%global  htag ed45a7dce13fab490529d4d13a064d379c8f66e7
a897ee
Version: 3.3
e4e3d1
Release: 10%{?dist}
dc70cb
Summary: JDKs configuration files copier
dc70cb
dc70cb
License:  BSD
dc70cb
URL:      https://pagure.io/%{project}
dc70cb
Source0:  %{URL}/blob/%{htag}/f/%{file}
dc70cb
Source1:  %{URL}/blob/%{htag}/f/LICENSE
dc70cb
Source2:  %{URL}/blob/%{htag}/f/%{fixFile}
dc70cb
dc70cb
# we need to duplicate msot of the percents in that script so they survive rpm expansion (even in that sed they have to be duplicated)
dc70cb
%global pretrans_install %(cat %{SOURCE0} | sed s/%%/%%%%/g | sed s/\\^%%%%/^%%/g) 
dc70cb
dc70cb
BuildArch: noarch
dc70cb
dc70cb
Requires: lua
dc70cb
#Requires: lua-posix
dc70cb
dc70cb
%description
dc70cb
Utility script to transfer JDKs configuration files between updates or for
dc70cb
archiving. With script to fix incorrectly created rpmnew files
dc70cb
dc70cb
%prep
dc70cb
cp -a %{SOURCE1} .
dc70cb
dc70cb
dc70cb
%build
dc70cb
#blob
dc70cb
dc70cb
%pretrans -p <lua>
dc70cb
function createPretransScript()
dc70cb
-- the sript must be available during pretrans, so multiply it to tmp
dc70cb
  os.execute("mkdir -p %{rpm_state_dir}")
dc70cb
  temp_path="%{rpm_state_dir}/%{file}"
dc70cb
-- print("generating " .. temp_path)
dc70cb
  file = io.open(temp_path, "w")
dc70cb
  file:write([[%{pretrans_install}]])
dc70cb
  file:close()
dc70cb
end
dc70cb
dc70cb
-- in netinst, the above call may fail. pcall should save instalation (as there is nothing to copy anyway)
dc70cb
-- https://bugzilla.redhat.com/show_bug.cgi?id=1295701
dc70cb
-- todo, decide whether to check for {rpm_state_dir} and skip on not-existing, or keep creating
dc70cb
if pcall(createPretransScript) then
dc70cb
-- ok
dc70cb
else
dc70cb
--  print("Error running %{name} pretrans.")
dc70cb
end
dc70cb
dc70cb
%install
dc70cb
mkdir -p $RPM_BUILD_ROOT/%{_libexecdir}
dc70cb
cp -a %{SOURCE0} $RPM_BUILD_ROOT/%{_libexecdir}/%{file}
dc70cb
chmod 644 $RPM_BUILD_ROOT/%{_libexecdir}/%{file}
dc70cb
cp -a %{SOURCE2} $RPM_BUILD_ROOT/%{_libexecdir}/%{fixFile}
dc70cb
dc70cb
%posttrans
dc70cb
# remove file created in pretrans
dc70cb
# echo "removing %{rpm_state_dir}/%{file}" || :
dc70cb
rm "%{rpm_state_dir}/%{file}" 2> /dev/null || :
dc70cb
dc70cb
%files 
dc70cb
%{_libexecdir}/%{file}
dc70cb
%{_libexecdir}/%{fixFile}
dc70cb
%license LICENSE
dc70cb
dc70cb
%changelog
e4e3d1
* Mon Apr 30 2018 Jiri Vanek <jvanek@redhat.com> - 3.3-10
e4e3d1
- added javaws.policy and blacklist
e4e3d1
- Resolves: rhbz#1573163
e4e3d1
e4e3d1
* Wed Apr 25 2018 Jiri Vanek <jvanek@redhat.com> - 3.3-3
e4e3d1
- fixes issue when java.security for openjdk7 was erased
e4e3d1
- Resolves: rhbz#1573163 
e4e3d1
a897ee
* Fri Nov 03 2017 Jiri Vanek <jvanek@redhat.com> - 3.3-2
a897ee
- added another subdirs for policies files
a897ee
- Resolves: rhbz#1503647
a897ee
- Resolves: rhbz#1503668
a897ee
a897ee
* Fri Nov 03 2017 Jiri Vanek <jvanek@redhat.com> - 3.3-1
a897ee
- updated to 3.3
a897ee
- Resolves: rhbz#1503647
a897ee
- Resolves: rhbz#1503668
dc70cb
dc70cb
* Mon Jun 19 2017 Jiri Vanek <jvanek@redhat.com> - 2.2-3
dc70cb
- updated to latest head
dc70cb
- Resolves: rhbz#1427463
dc70cb
dc70cb
* Tue Jun 13 2017 Jiri Vanek <jvanek@redhat.com> - 2.2-1
dc70cb
- added "jre/lib/security/blacklisted.certs" to cared files
dc70cb
- moved to newest release 2.1
dc70cb
- moved to new upstream at pagure.io
dc70cb
- added new script of copy_jdk_configs_fixFiles.sh 
dc70cb
- copy_jdk_configs.lua  aligned to it
dc70cb
- Resolves: rhbz#1427463
dc70cb
e4e3d1
* Thu Dec 01 2016 Jiri Vanek <jvanek@redhat.com> - 1.3-1
dc70cb
- updated to upstream 1.3 (adding jre/lib/security/cacerts file)
dc70cb
- Resolves: rhbz#1399719
dc70cb
dc70cb
* Tue Aug 09 2016 Jiri Vanek <jvanek@redhat.com> - 1.2-1
dc70cb
- updated to 1,3 which fixing nss minor issue
dc70cb
- Resolves: rhbz#1296430
dc70cb
dc70cb
* Tue Jul 12 2016 Jiri Vanek <jvanek@redhat.com> - 1.1-5
dc70cb
- posttrans silenced, the error is appearing only in state, when there is nothing to copy
dc70cb
- Resolves: rhbz#1296430
dc70cb
dc70cb
* Tue Apr 12 2016 Jiri Vanek <jvanek@redhat.com> - 1.1-3
dc70cb
- commented requires on lua posix to stop blocking composes.
dc70cb
- changed it to 644 to dont mislead by executable flags
dc70cb
- Resolves: rhbz#1296430
dc70cb
dc70cb
* Tue Apr 12 2016 Jiri Vanek <jvanek@redhat.com> - 1.1-3
dc70cb
- inital commit to rhel
dc70cb
- Resolves: rhbz#1296430
dc70cb
dc70cb
* Fri Jan 08 2016 Jiri Vanek <jvanek@redhat.com> - 1.1-3
dc70cb
- pretrasn lua call now done in pcall (protected call)
dc70cb
- also posttrans now always return 0
dc70cb
dc70cb
* Wed Dec 16 2015 Jiri Vanek <jvanek@redhat.com> - 1.1-2
dc70cb
- package now "installs" also during pretrans, so pretrasn scripts can use it
dc70cb
- pretrasn "install" is removed in postrans
dc70cb
dc70cb
* Wed Nov 25 2015 Jiri Vanek <jvanek@redhat.com> - 1.1-1
dc70cb
- initial package