Skip to content

Commit a36bd06

Browse files
authored
Merge pull request #222 from kbrock/chmod_exists
fix chmod cleanup
2 parents 66ec130 + 401f3f8 commit a36bd06

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

rpm_spec/subpackages/manageiq-core

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,19 @@ do
3535
done
3636

3737
%post core
38-
# These files are not owned by the rpm.
39-
# For upgrades, ensure they have the correct group privs
38+
# These directories contain files not owned by this rpm.
39+
# For upgrades, ensure the files have the correct group privs
4040
# so root and manageiq users can read them.
41-
%{__chown} -f manageiq.manageiq %{app_root}/certs/v2_key %{app_root}/log/*.log
42-
%{__chown} -f manageiq.manageiq %{app_root}/tmp/pids/*.pid %{app_root}/config/*.yml
41+
[ -e %{app_root}/certs/v2_key ] && %{__chown} manageiq.manageiq %{app_root}/certs/v2_key
42+
[ -e %{app_root}/certs/v2_key ] && %{__chmod} o-rw %{app_root}/certs/v2_key
43+
44+
%{__chown} -R manageiq.manageiq %{app_root}/log
45+
%{__chmod} -R o-rw %{app_root}/log
46+
47+
%{__chown} -R manageiq.manageiq %{app_root}/tmp/pids
48+
%{__chmod} -R o-rw %{app_root}/tmp/pids
49+
4350
%{__chown} -R manageiq.manageiq %{app_root}/data
44-
%{__chmod} -f o-rw %{app_root}/certs/v2_key
45-
%{__chmod} -f o-rw %{app_root}/config/*.yml %{app_root}/tmp/pids/*.pid
46-
%{__chmod} -f o-rw %{app_root}/log/*.log
4751

4852
%files core
4953
%defattr(-,root,root,-)

0 commit comments

Comments
 (0)