Linux – rpmbuild spec file: how to have files only used during install


How do I specify in a .spec files that are only used during install of the rpm (such as .sql scripts that I feed into the database), but I specifically don't want to persist post-install? I can't omit such files from %files, as they won't get included in the package; yet, if I put them in %files section but delete them in %post, during uninstall I'll get warnings that these files are missing. I need to get rid of these warnings in a proper manner (i.e., other files that I don't regard as temporary still should be checked for whether they're missing during uninstall).

These packages are for internal company use and "just leave the temporary files and don't delete them in %post", or "just ignore the warnings" is not the answer I'm looking for, as it contravenes the specification I'm working to.

Best Answer

Use the config(missingok) option, it will deploy the file but it won't complain if the file doesn't exist during uninstall.


%attr(750, root, root) %config(missingok) /dir/file.sql
Related Topic