46c95d0
%global project copy_jdk_configs
46c95d0
%global file %{project}.lua
e26b095
%global fixFile %{project}_fixFiles.sh
0cf022a
%global rpm_state_dir %{_localstatedir}/lib/rpm-state
46c95d0
46c95d0
Name:    copy-jdk-configs
46c95d0
e26b095
# hash relevant to version tag
f9da618
%global  htag 1d18ce8b5dec47a0468136ab6cdadfb93defe2c4
f9da618
Version: 3.7
f9da618
Release: 1%{?dist}
46c95d0
Summary: JDKs configuration files copier
46c95d0
46c95d0
License:  BSD
e26b095
URL:      https://pagure.io/%{project}
e26b095
Source0:  %{URL}/blob/%{htag}/f/%{file}
e26b095
Source1:  %{URL}/blob/%{htag}/f/LICENSE
e26b095
Source2:  %{URL}/blob/%{htag}/f/%{fixFile}
0cf022a
0cf022a
# 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)
0cf022a
%global pretrans_install %(cat %{SOURCE0} | sed s/%%/%%%%/g | sed s/\\^%%%%/^%%/g) 
0cf022a
46c95d0
BuildArch: noarch
46c95d0
46c95d0
Requires: lua
46c95d0
Requires: lua-posix
46c95d0
46c95d0
%description
46c95d0
Utility script to transfer JDKs configuration files between updates or for
e26b095
archiving. With script to fix incorrectly created rpmnew files
46c95d0
46c95d0
%prep
46c95d0
cp -a %{SOURCE1} .
46c95d0
46c95d0
46c95d0
%build
46c95d0
#blob
46c95d0
0cf022a
%pretrans -p <lua>
5ab2a1f
function createPretransScript()
0cf022a
-- the sript must be available during pretrans, so multiply it to tmp
5ab2a1f
  os.execute("mkdir -p %{rpm_state_dir}")
5ab2a1f
  temp_path="%{rpm_state_dir}/%{file}"
0cf022a
-- print("generating " .. temp_path)
5ab2a1f
  file = io.open(temp_path, "w")
5ab2a1f
  file:write([[%{pretrans_install}]])
5ab2a1f
  file:close()
5ab2a1f
end
5ab2a1f
5ab2a1f
-- in netinst, the above call may fail. pcall should save instalation (as there is nothing to copy anyway)
5ab2a1f
-- https://bugzilla.redhat.com/show_bug.cgi?id=1295701
5ab2a1f
-- todo, decide whether to check for {rpm_state_dir} and skip on not-existing, or keep creating
5ab2a1f
if pcall(createPretransScript) then
5ab2a1f
-- ok
5ab2a1f
else
5ab2a1f
--  print("Error running %{name} pretrans.")
5ab2a1f
end
0cf022a
46c95d0
%install
46c95d0
mkdir -p $RPM_BUILD_ROOT/%{_libexecdir}
46c95d0
cp -a %{SOURCE0} $RPM_BUILD_ROOT/%{_libexecdir}/%{file}
e26b095
cp -a %{SOURCE2} $RPM_BUILD_ROOT/%{_libexecdir}/%{fixFile}
46c95d0
0cf022a
%posttrans
0cf022a
# remove file created in pretrans
5ab2a1f
# echo "removing %{rpm_state_dir}/%{file}" || :
759e70e
rm "%{rpm_state_dir}/%{file}" 2> /dev/null || :
0cf022a
46c95d0
%files 
46c95d0
%{_libexecdir}/%{file}
e26b095
%{_libexecdir}/%{fixFile}
46c95d0
%license LICENSE
46c95d0
46c95d0
%changelog
f9da618
* Wed May 02 2018 Jiri Vanek <jvanek@redhat.com> - 3.7-1
f9da618
- udpated to latst relase
f9da618
- configurable blacklist
f9da618
- listed all java keystores
f9da618
f9da618
* Wed May 02 2018 Jiri Vanek <jvanek@redhat.com> - 3.3-12
f9da618
- blackidrs put on single line
f9da618
f9da618
* Wed May 02 2018 Jiri Vanek <jvanek@redhat.com> - 3.3-11
f9da618
- added more files to balcklist based on oralce and ibm jdks
f9da618
db56a69
* Mon Apr 30 2018 Jiri Vanek <jvanek@redhat.com> - 3.3-10
db56a69
- added javaws.policy and blacklist
db56a69
c2db104
* Tue Apr 03 2018 Jiri Vanek <jvanek@redhat.com> - 3.3-5
1e04626
- fixed rhbz#1541838
1e04626
170afc3
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.3-3
170afc3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
170afc3
9171b07
* Wed Oct 18 2017 Jiri Vanek <jvanek@redhat.com> - 3.3-2
9171b07
- added another subdirs for policies files
9171b07
61d4217
* Wed Oct 18 2017 Jiri Vanek <jvanek@redhat.com> - 3.3-1
61d4217
- handled new paths for policies files
61d4217
a586a85
* Thu Oct 05 2017 Jiri Vanek <jvanek@redhat.com> - 3.1-1
a586a85
- moved to newest release 3.1 whcih conf and lib/security as directories
a586a85
7a1a9df
* Thu Oct 05 2017 Jiri Vanek <jvanek@redhat.com> - 3.0-1
7a1a9df
- moved to newest release 3.0 whcih support linked configs
7a1a9df
d226711
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.3-2
d226711
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
d226711
4f55cb2
* Wed Feb 22 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.3
4f55cb2
- updated to latest head
4f55cb2
8fc14cc
* Wed Feb 22 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.2
8fc14cc
- added "jre/lib/security/blacklisted.certs" to cared files
8fc14cc
b7f0c4b
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.1-2
b7f0c4b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
b7f0c4b
e95b93e
* Fri Feb 03 2017 Jiri Vanek <jvanek@redhat.com> - 2.1-1
e95b93e
- moved to newest release 2.1
e95b93e
e26b095
* Fri Jan 20 2017 Jiri Vanek <jvanek@redhat.com> - 2.0-1
e26b095
- moved to new upstream at pagure.io
e26b095
- moved to newest release 2.0
e26b095
- added new script of copy_jdk_configs_fixFiles.sh 
e26b095
- copy_jdk_configs.lua  aligned to it
e26b095
ca4cf11
* Tue Aug 09 2016 Jiri Vanek <jvanek@redhat.com> - 1.2-1
ca4cf11
- updated to 1,3 which fixing nss minor issue
ca4cf11
759e70e
* Tue Jul 12 2016 Jiri Vanek <jvanek@redhat.com> - 1.1-5
759e70e
- posttrans silenced, the error is appearing only in state, when there is nothing to copy
759e70e
fe7f929
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-4
fe7f929
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
fe7f929
5ab2a1f
* Fri Jan 08 2016 Jiri Vanek <jvanek@redhat.com> - 1.1-3
5ab2a1f
- pretrasn lua call now done in pcall (protected call)
5ab2a1f
- also posttrans now always return 0
5ab2a1f
0cf022a
* Wed Dec 16 2015 Jiri Vanek <jvanek@redhat.com> - 1.1-2
0cf022a
- package now "installs" also during pretrans, so pretrasn scripts can use it
0cf022a
- pretrasn "install" is removed in postrans
0cf022a
46c95d0
* Wed Nov 25 2015 Jiri Vanek <jvanek@redhat.com> - 1.1-1
46c95d0
- initial package