Changeset 97990
- Timestamp:
- Sep 21, 2012, 1:21:51 PM (12 years ago)
- Location:
- trunk/dports/sysutils/logrotate
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dports/sysutils/logrotate/Portfile
r97677 r97990 6 6 name logrotate 7 7 version 3.8.2 8 revision 18 revision 2 9 9 categories sysutils 10 10 platforms darwin … … 32 32 post-extract { 33 33 touch ${worksrcpath}/.depend 34 copy ${filespath}/logrotate.conf.example \ 35 ${worksrcpath}/ 36 copy ${filespath}/org.macports.logrotate.plist.example \ 37 ${worksrcpath}/ 34 38 } 35 39 36 40 post-patch { 37 reinplace "s|@ @PREFIX@@|${prefix}|g" \41 reinplace "s|@PREFIX@|${prefix}|g" \ 38 42 ${worksrcpath}/examples/logrotate-default 43 reinplace "s|@PREFIX@|${prefix}|g" \ 44 ${worksrcpath}/logrotate.conf.example 45 reinplace "s|@PREFIX@|${prefix}|g" \ 46 ${worksrcpath}/org.macports.logrotate.plist.example 39 47 } 40 48 … … 59 67 xinstall -d ${destroot}${prefix}/share/${name} 60 68 xinstall -m 644 -W ${worksrcpath} CHANGES COPYING \ 69 logrotate.conf.example org.macports.logrotate.plist.example \ 61 70 ${destroot}${prefix}/share/${name} 62 set fp [open ${destroot}${prefix}/share/${name}/logrotate.conf.example w]63 puts $fp \64 "# see \"man logrotate\" for details65 # rotate log files weekly66 weekly67 71 68 # keep 4 weeks worth of backlogs 69 rotate 4 72 # The startupitem.install keyword does not exist in MacPorts < 2.1. 73 if {![info exists startupitem.install]} { 70 74 71 # create new (empty) log files after rotating old ones 72 create 75 set startupitem.install yes 76 } 77 if {[variant_isset startupitem] 78 && ${startupitem.install} != "no"} { 73 79 74 # use date as a suffix of the rotated file75 dateext76 77 # uncomment this if you want your log files compressed78 #compress79 80 # Drop log rotation information into this directory81 include ${prefix}/etc/logrotate.d"82 close $fp83 84 set fp [open ${destroot}${prefix}/share/${name}/org.macports.logrotate.plist.example w]85 puts $fp \86 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>87 <!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">88 <plist version=\"1.0\">89 <dict>90 <key>Disabled</key>91 <true/>92 <key>Label</key>93 <string>com.pixilla.logrotate</string>94 <key>ProgramArguments</key>95 <array>96 <string>${prefix}/sbin/logrotate</string>97 <string>${prefix}/etc/logrotate.conf</string>98 </array>99 <key>StartCalendarInterval</key>100 <dict>101 <key>Hour</key>102 <integer>5</integer>103 <key>Minute</key>104 <integer>30</integer>105 </dict>106 </dict>107 </plist>"108 close $fp109 if {[variant_isset startupitem]} {110 80 xinstall -d ${destroot}${prefix}/etc/LaunchDaemons/org.macports.logrotate 111 81 xinstall -d ${destroot}/Library/LaunchDaemons … … 113 83 ${destroot}${prefix}/etc/LaunchDaemons/org.macports.logrotate/org.macports.logrotate.plist 114 84 ln -sf "${prefix}/etc/LaunchDaemons/org.macports.logrotate/org.macports.logrotate.plist" "${destroot}/Library/LaunchDaemons/org.macports.logrotate.plist" 85 } 86 } 87 88 post-activate { 89 90 if ![file exists ${prefix}/etc/logrotate.conf] { 91 92 copy ${prefix}/share/${name}/logrotate.conf.example ${prefix}/etc/logrotate.conf 115 93 } 116 94 } … … 142 120 variant_set gzip 143 121 } 122 default_variants-append \ 123 +startupitem 144 124 145 125 livecheck.url $homepage … … 156 136 \$ sudo cp ${prefix}/share/${name}/logrotate.conf.example ${prefix}/etc/logrotate.conf 157 137 158 * Logrotate scripts added to ${prefix}/etc/logrotate.d are read by default.159 160 \$ sudo ${prefix}/sbin/${name} ${prefix}/etc/logrotate.conf161 162 138 * With the startupitem variant (+startupitem) you can activate a scheduled log 163 139 rotation with this command. 164 140 165 \$ sudo port load Logrotate141 \$ sudo port load logrotate 166 142 167 143 * To create your own startup item with non-default intervals, build logrotate 168 144 without the startupitem variant (-startupitem), copy the example into place 169 and edit to your liking andload with launchctl when finished.145 and edit to your liking, then load with launchctl when finished. 170 146 171 147 \$ sudo cp ${prefix}/share/${name}/org.macports.logrotate.plist.example /Library/LaunchDaemons/org.macports.logrotate.plist
Note: See TracChangeset
for help on using the changeset viewer.