Opened 2 years ago
Closed 2 years ago
#66348 closed defect (fixed)
logrotate: doesn't install default startitem
Reported by: | catap (Kirill A. Korinsky) | Owned by: | ctreleaven (Craig Treleaven) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | Cc: | ||
Port: | logrotate |
Description
By default a logrotate says that I should simple run sudo port load logrotate
to enable daily log rotation.
Anyway, running this command filed as:
Error: Failed to load logrotate: Launchd plist /Library/LaunchDaemons/org.macports.logrotate.plist was not found
because it hasn't created any startupitem by default.
Change History (10)
comment:1 Changed 2 years ago by jmroot (Joshua Root)
comment:2 Changed 2 years ago by ctreleaven (Craig Treleaven)
@catap - Thanks for reporting this problem. The port has been broken for new installs since Feb 2019 and no one bothered to file a ticket! I should be able to fix this fairly quickly.
@jmroot - I was not aware of startupitem.custom_file and I usually pay attention to stuff related to daemons. I don't see this keyword mentioned in 'man portfile'. Where can I learn more about it?
comment:4 Changed 2 years ago by ctreleaven (Craig Treleaven)
comment:5 Changed 2 years ago by jmroot (Joshua Root)
Also documented in the Guide: https://guide.macports.org/chunked/reference.startupitems.html#reference.startupitems.attributes
comment:6 Changed 2 years ago by jmroot (Joshua Root)
Looks like some of the buildbot workers (and so presumably some users also) have an existing unregistered /Library/LaunchDaemons/org.macports.logrotate.plist
which will need to be cleaned up in pre-activate. Also, the notes still refer to the startupitem
variant.
comment:7 Changed 2 years ago by ctreleaven (Craig Treleaven)
Rats. I inherited that approach when I took over this port. It always seemed odd to handle the launchd plist so differently from logrotate.conf. In both cases, the objective was to preserve any customizations the user may have made. Since the plist has been broken for nearly 3 years, I'll assume that nobody feels a need to run it more or less frequently than daily.
comment:8 Changed 2 years ago by ctreleaven (Craig Treleaven)
comment:9 Changed 2 years ago by ctreleaven (Craig Treleaven)
Replying to catap:
By default a logrotate says that I should simple run
sudo port load logrotate
to enable daily log rotation.Anyway, running this command filed as:
Error: Failed to load logrotate: Launchd plist /Library/LaunchDaemons/org.macports.logrotate.plist was not foundbecause it hasn't created any startupitem by default.
Could you please confirm if logrotate is now working for you?
comment:10 Changed 2 years ago by ctreleaven (Craig Treleaven)
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
It's checking
if {[variant_isset startupitem]
but there is no such variant in the port. The code for installing the startupitem could be greatly simplified with the newstartupitem.custom_file
option in MacPorts 2.8. Something like this (untested):sysutils/logrotate/Portfile
org.macports.logrotate.plist.example\if {[variant_isset startupitem]&& ${startupitem.install} != "no"&& [getuid] == 0} {xinstall -d ${destroot}${prefix}/etc/LaunchDaemons/org.macports.logrotatexinstall -d ${destroot}/Library/LaunchDaemonsxinstall -m 644 ${destroot}${prefix}/share/${name}/org.macports.logrotate.plist.example \${destroot}${prefix}/etc/LaunchDaemons/org.macports.logrotate/org.macports.logrotate.plistln -sf "${prefix}/etc/LaunchDaemons/org.macports.logrotate/org.macports.logrotate.plist" "${destroot}/Library/LaunchDaemons/org.macports.logrotate.plist"}