aboutsummaryrefslogtreecommitdiff
path: root/base/logrotate/logrotate.build
blob: b2c944098141a91dba7ad2aef1b99b1725f18a69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
#
# Maintainer: Deposite Pirate <ofni.sknuplatem@etaripd>

source /usr/src/ports/Build/build.sh

NAME=logrotate
VERSION=3.8.3
BUILD=3

# Description

cat > ${PKG}/install/slack-desc <<EOF
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

$(padd)|-----handy-ruler------------------------------------------------------|
${NAME}: logrotate (system log rotation tool)
${NAME}:
${NAME}: The logrotate utility is designed to simplify the administration
${NAME}: of log files on a system which generates a lot of log files.
${NAME}: Logrotate allows for the automatic rotation compression, removal
${NAME}: and mailing of log files. Logrotate can be set to handle a log
${NAME}: file daily, weekly, monthly or when the log file gets to a certain
${NAME}: size. Normally, logrotate runs as a daily cron job.
${NAME}:
${NAME}:
${NAME}:
EOF

cat >> ${PKG}/install/doinst.sh <<EOF
#!/bin/sh

config() {
  NEW="\$1"
  OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
  # If there's no config file by that name, mv it over:
  if [ ! -r \$OLD ]; then
    mv \$NEW \$OLD
  elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then
    # toss the redundant copy
    rm \$NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
}

config etc/logrotate.conf.new
EOF

# Sources

SRCNAME[0]=${NAME}
SRCVERS[0]=${VERSION}
SRCPACK[0]=http://fedorahosted.org/releases/l/o/logrotate/${SRCNAME[0]}-${SRCVERS[0]}.tar.gz
SRCCOPY[0]="GPL2"

build0()
{
make ${JOBS} RPM_OPT_FLAGS="${FLAGS}"
make install PREFIX="${PKG}" MANDIR="${SYS_DIR[man]}"
changelog CHANGES
install.dir ${PKG}${SYS_DIR[etc]}/{logrotate.d,cron.daily}
install.dir ${PKG}${SYS_DIR[var]}/lib/logrotate
install.cfg logrotate.conf ${PKG}${SYS_DIR[etc]}/logrotate.conf.new
install.bin logrotate.cron ${PKG}${SYS_DIR[etc]}/cron.daily/logrotate
}