0

I have a problem that is exactly the opposite of RPM won't erase its installed directories if they have been modified after the initial installation . That poster wanted to force the deletion of files not created by rpm in a directory that was created by rpm, going against the default rpm behavior.

My problem is the exact opposite. I posted it originally on Stack Overflow but I want to ask it a bit differently here. When installing/uninstalling rpms built in the traditional way, using rpmbuild and specfiles, I get the default behavior, which is what I want. My scenario is that an rpm creates a log directory somewhere, applications log to files in that directory, and on uninstallation, the presence of these files that were not created by rpm prevents deletion of them or of the directory that holds them.

But when I build the RPMs with the Nebula rpm plugin for Gradle something is different. The directory is just deleted regardless of whether any files have been added to it. Even more bizarrely, debug output of rpm tells me that it's NOT deleting the directory, even though actually it is:

# rpm -evv myapp
...
D: fini      040755  2 (7007, 500)      4096 /usr/local/myapp/logs 
D:    erase rmdir of /usr/local/myapp/logs failed: Directory not empty
...
# ls -al /usr/local/myapp/logs
ls: cannot access /usr/local/myapp/logs: No such file or directory

Since I am running the same rpm commands with rpms created by the Gradle plugin and with rpms created in the traditional way, and on the same machine with the same rpm configuration, SOMETHING must be different in the rpm files themselves. But I have no idea what that might be. Can anyone enlighten me on this?

2
  • It can be some scriptlet. Are there some? rpm -qp --scripts ./myapp.rpm
    – msuchy
    Mar 30, 2016 at 6:20
  • D'Oh, you're right! It's a self-inflicted wound. Make your comment an answer and I'll upvote you! Mar 30, 2016 at 13:40

1 Answer 1

2

It can be some scriptlet. Are there some?

rpm -qp --scripts ./myapp.rpm 
1
  • I forgot that I had built my plugin with a default %postun script that I copied from a spec file and looked reasonable to me at the time. It does an rm -rf. It made sense to me but I now realize that it's just a coverup for bad script writing and should at any event not be a default! Mar 30, 2016 at 13:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .