Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 16576 - logwatch ebuild will remove logwatch.pl entry in root crontab when logwatch package get updated
Summary: logwatch ebuild will remove logwatch.pl entry in root crontab when logwatch p...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Jared H. Hudson (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-28 14:04 UTC by Alessandro Pisani
Modified: 2003-04-11 02:10 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alessandro Pisani 2003-02-28 14:04:18 UTC
logwatch ebuild will remove logwatch.pl entry in root crontab when logwatch
package get updated. this happen due to lack to controls in the ebuild files.
The following code (replacement for pkg_postinst() and pkg_postrm() ) fixes this
behaviour: please apply to all the existing logwatch ebuilds in the portage tree
(4.2.1 and 4.3.1 currently)

pkg_postinst() {
	einfo "creating a symlink for configuration directory..."
	ln -snf ${ROOT}usr/share/logwatch/conf ${ROOT}etc/logwatch

	einfo "adding executable to path..."
	ln -sf ${ROOT}usr/share/logwatch/scripts/logwatch.pl ${ROOT}usr/bin/logwatch

        # this will avoid duplicate entries in the crontab
	if [ "`grep logwatch.pl ${ROOT}var/spool/cron/crontabs/root`" == "" ]; then
		einfo "adding to cron..."
		echo "0 0 * * * ${ROOT}usr/share/logwatch/scripts/logwatch.pl 2>&1 >
/dev/null" >> ${ROOT}var/spool/cron/crontabs/root
	fi
	}

pkg_postrm() {
    # this fixes a bug when logwatch package gets updated
    if [ "`ls -d ${ROOT}var/db/pkg/sys-apps/logwatch* | wc -l | tail -c 2`" -lt
2 ]; then
	    sed "/^0.*\/usr\/share\/logwatch\/scripts\/logwatch.*null$/d"
${ROOT}var/spool/cron/crontabs/root > ${ROOT}var/spool/cron/crontabs/root.new
	    mv --force ${ROOT}var/spool/cron/crontabs/root.new
${ROOT}var/spool/cron/crontabs/root
	fi
}

a fixed 4.3.2 ebuild is also being uploaded for bug #16016

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 Jared H. Hudson (RETIRED) gentoo-dev 2003-04-11 02:10:37 UTC
Fixed.