Description of problem: Although the longterm goal of rpm is/was(??) to classify certain actions which are currently done by %scriptlets, such a classification will never cover all possible cases. Because it is easy for such scriptlets to conflict with %_netsharedpath settings and the related test is not trivial, a standardized test is highly needed. For samples of broken scriptlets see the blocks-list of bug #51193. My preferred solution would be a check like: | %post | <black_magic> /usr || exit 0 # check whether /usr is not in %_netsharedpath | touch /usr/something For '<black_magic>' you have the choice between - a perl/awk/python/... script. Disadvantages are additional dependencies on perl/gawk/python (which might be superfluously on minimal systems), and the redundancy to write the same script into every %post - a %macro executing the script; this removes the redundancy in the scripts but the superfluous dependencies remain. With recent rpm, such a macro can be provided in /etc/rpm/macros.netsharedpath from an additional package. - a native C implementation of such a test; this can do simple pattern matching or use the related librpm function (I do not know if such a function exists). When linked against dietlibc, the pattern-matching thing will have nearly no dependency. - a %macro executing the C program above. This avoids hardcoded paths in the scriptlet. I prefer this method. Giving the actual value of %_netsharedpath to <black_magic> is a problem: the direct execution of "rpm --eval '%{_netsharedpath}'" is error-prone (how often have I to quote the '%'?) and incorrect as it does not honor flags of current rpm invocation which might influence %_netsharedpath (e.g. '--define _netsharedpath ...' or '--rcfile %...'). Therefore, rpm would have to set an environment-variable like 'RPM_NETSHAREDPATH' before script-execution. Other interprocess communication mechanisms like pipes or shared-memory are not applicable (pipes must be open in scriptlet, but closed in started programs) or too complicated (how will the shared-memory be identified?).
My current rpm roadmap plan is to turn all scriptlets into parameterized embedded lua triggers fired by patterns against file(1) class tags currently in header metadata and avoid (abandon if up to me) scriptlets in *.rpm packages entirely. At that point, side-effects of the parameterized triggers on RO mounts can be reasonably dealt with, as there's a whole new batch of package monkeys coming on line without any clear and definite packaging policy or methodology. I'm too old for the sh*t ... Sound like a plan? rpm-devel.duke.edu for progress reports if so ...
UPSTREAM, because that's where the fix will be attempted.