[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: override logrotate.timer from another package?



Hi Tim,

On 2023-07-04 19:35:35, Tim Woodall wrote:
On Tue, 4 Jul 2023, Harald Dunkel wrote:

I'm not exactly clear what you're doing but I guess you're creating a
package that provides the config file?


Yes, together with other things (other config files, package depen-
dencies, etc).


Others would probably say use ansible (or something like that) but
it works for me.


to the package install file, but at upgrade time it complained
that nobody ran systemctl daemon-reload. Ain't this the job of
the DEBHELPER macro in the postinst script?

Once your package is installed, what does the postinst script look like?

It looks like this

	#!/bin/bash -e
	:
	# some bash function definitions
	:
	case "$1" in
	    configure)
	        set_distro
	        set_debconf_defaults
	        adjust_ssh_config
	        adjust_sshd_config
	        adjust_login_defs
	        cleanup_logrotate
	        cleanup_old_garbage
	        systemctl daemon-reload || echo ignored
	    ;;

	    abort-upgrade|abort-remove|abort-deconfigure)
	    ;;

	    triggered)
	        cleanup_logrotate
	    ;;

	    *)
	        echo "postinst called with unknown argument \`$1'" >&2
	        exit 1
	    ;;
	esac

	#DEBHELPER#

	exit 0

I had expected the systemctl daemon-reload is added by
DEBHELPER, but it isn't.


Should this file be installed in /lib/systemd/system/logrotate.timer.d
instead, using dh_installsystemd ?


Assuming you are creating a package and you want to share it with
possible local edits in /etc then this would be the way to go. If, like
me, you're using a package in place of manually editing then /etc is
more likely the right place.


Thank you very much for your detailed reply. I will try to override
logrotate.timer in /lib, as you suggested.


Regards

Harri


Reply to: