Description of problem: I think there should be mechanism how to query current values of macros (e.g. install time macro values, not build time values). The only solution known to me is to write the whole scriptlet in LUA which is too restrictive. This could be used for e.g. for detection of the state of the _excludedocs macro from %post during the install time. Version-Release number of selected component (if applicable): rpm-4.12.0.1-13.fc22.x86_64 How reproducible: Always Steps to Reproduce: 1. Try to get the value of %_excludedocs macro from bash from %post Actual results: It doesn't seem to be possible (rpm --eval doesn't work if rpm --excludedocs was used). Expected results: The mechanism how to query the macro, e.g. %post if [ `_expand_macro("_excludedocs")` = 1 ]; then : fi Additional info: There was postfix bug 1227824 complaining that postfix installs documentation symlinks in --excludedocs mode. The symlinks are created by 'alternatives' which is called from %post scriptlet. The %post scriptlet is quite complex and written in bash. There is no reliable way known to me how to check that the RPM installs in --excludedocs mode (e.g. that the macro _excludedocs is set to 1) other than usage of LUA for the whole %post scriptlet. Also just adding some bash alias variable for _excludedocs (e.g. $RPM_EXCLUDEDOCS) would resolve this problem, but I think that more generic approach to this problem would be better.
Well, there is a way how to achieve what you want. You can use option "-e" (expand macros) for your postscript: %post -e if [ "%%_excludedocs" = 1 ]; then ... fi Notice that double "%" is used to disable expansion during build. Sorry that firstly I told you there is no way how to do this. I didn't know there is something like this in rpm until I found it in rpm code when I was trying to implement it.
Interesting, thanks for info. It shouldn't be hard to fix bug 1227824 now. It seems it's documented, I found: http://www.rpm.org/wiki/PackagerDocs/ScriptletExpansion