Description of Problem: When having /usr/share mounted ro, installation of scrollkeeper fails: | $ rpm -U /usr/src/redhat/RPMS/i386/scrollkeeper-0.3.4-2.i386.rpm | rm: cannot unlink `/usr/share/scrollkeeper/Templates/C/scrollkeeper_cl.xml': Read-only file system | rm: cannot remove directory `/usr/share/scrollkeeper/Templates/C': Read-only file system | ... | error: execution of %pre scriptlet from scrollkeeper-0.3.4-2 failed, exit status 1 | error: install: %pre scriptlet failed (2), skipping scrollkeeper-0.3.4-2 Version-Release number of selected component (if applicable): scrollkeeper-0.3.4-2
Not quite sure what you are working towards here, but of course the scriptlet failed. You have the filesystem mounted RO and the scriptlet is attempting to remove a directory on /usr/share. Even is the scriptlet didn't fail, the install of the package is going to fail, as there are a ton of files that it is going to try to write to the /usr/share/ filesystem.
No; the installation itself works and only the scriptlet fails. rpm knows a %_netsharedpath variable which handles cases where parts of the filesystem are mounted RO (e.g. because they are shared by NFS). Then files located there will never be touched by rpm. Please see bug #51193 for a related discussion.
I'm not sure how to fix this without ignoring legitimate errors - any suggestions? i.e. I don't really want to just say "rm foo || true" because it will potentially mask real problems.
You could check if /usr/share/scrollkeeper is writable by you: | test -w /usr/share/scrollkeeper && { | rm -rf ... } Alternativily to the 'test -w ...' you can use the __isDirectoryShared macro defined in bug #51193. But this may be too much bloat for a simple 'rm -rf'; I can not imagine a problem which would not be detected in a later stage of rpm. Therefore, keep it small and simple, and make | rm -rf /usr/share/scrollkeeper 2>/dev/null || true
Should be fixed in 0.3.4-3