Tips on how to handle tmpfile changes

Paul Howarth paul at city-fan.org
Wed Dec 7 15:59:13 UTC 2011


On 12/07/2011 03:37 PM, Michael Cronenworth wrote:
> The vnstat service has traditionally run as the root user. This was
> fixed in Fedora 16 and higher to run as the vnstat user, but the same
> fix was just introduced[1] into Fedora 15. There is a problem with this
> fix in that it requires "systemd-tmpfiles" to be run to create the new
> /run/vnstat directory required to store the pid file. This new directory
> also required the /etc/vnstat.conf file to be changed as the PidFile
> variable tells vnstat where to create the pid file. The end result is
> that after a package update the service will fail to start unless they
> manually create the /run/vnstat directory and update their config file.
> Not a very nice requirement IMO.
>
> 1. Is it appropriate for the RPM to call systemd-tmpfiles or is there a
> better way to create the new tmpfile directory?

Simplest way is just to include the directory in the RPM in the same way 
as you would if it was anywhere else in the filesystem. That caters for 
operation immediately after installation, and the tmpfiles script can 
re-create it on reboot.

> 2. The /etc/vnstat.conf variable change will break all upgrades, but
> could something like sed be run in a postinstall script to update the
> variable?

Is it actually necessary to do this? The default pidfile location 
appears to be /var/run/vnstat.pid and since on F15 /var/run is a symlink 
to ../run, the pid file should end up in the right place by default, 
should it not?

Paul.


More information about the devel mailing list