From 5ab2a1f2e5bfb1802ef99a24b60139ef5f09435d Mon Sep 17 00:00:00 2001 From: Jiri Date: Fri, 8 Jan 2016 11:57:55 +0100 Subject: [PATCH] pretrasn lua call now done in pcall (protected call) --- copy-jdk-configs.spec | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/copy-jdk-configs.spec b/copy-jdk-configs.spec index c9adeb5..5e5af8a 100644 --- a/copy-jdk-configs.spec +++ b/copy-jdk-configs.spec @@ -5,7 +5,7 @@ Name: copy-jdk-configs Version: 1.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: JDKs configuration files copier License: BSD @@ -33,14 +33,24 @@ cp -a %{SOURCE1} . #blob %pretrans -p +function createPretransScript() -- the sript must be available during pretrans, so multiply it to tmp -os.execute("mkdir -p " .. "%{rpm_state_dir}") -temp_path="%{rpm_state_dir}" .. "/" .. "%{file}" + os.execute("mkdir -p %{rpm_state_dir}") + temp_path="%{rpm_state_dir}/%{file}" -- print("generating " .. temp_path) -file = io.open(temp_path, "w") -file:write([[%{pretrans_install}]]) -file:close() + file = io.open(temp_path, "w") + file:write([[%{pretrans_install}]]) + file:close() +end +-- in netinst, the above call may fail. pcall should save instalation (as there is nothing to copy anyway) +-- https://bugzilla.redhat.com/show_bug.cgi?id=1295701 +-- todo, decide whether to check for {rpm_state_dir} and skip on not-existing, or keep creating +if pcall(createPretransScript) then +-- ok +else +-- print("Error running %{name} pretrans.") +end %install mkdir -p $RPM_BUILD_ROOT/%{_libexecdir} @@ -48,14 +58,18 @@ cp -a %{SOURCE0} $RPM_BUILD_ROOT/%{_libexecdir}/%{file} %posttrans # remove file created in pretrans -# echo "removing %{rpm_state_dir}/%{file}" -rm "%{rpm_state_dir}/%{file}" +# echo "removing %{rpm_state_dir}/%{file}" || : +rm "%{rpm_state_dir}/%{file}" || : %files %{_libexecdir}/%{file} %license LICENSE %changelog +* Fri Jan 08 2016 Jiri Vanek - 1.1-3 +- pretrasn lua call now done in pcall (protected call) +- also posttrans now always return 0 + * Wed Dec 16 2015 Jiri Vanek - 1.1-2 - package now "installs" also during pretrans, so pretrasn scripts can use it - pretrasn "install" is removed in postrans