1 |
Summary: Utility for removing files based on when they were last accessed |
2 |
Name: tmpwatch |
3 |
Version: 2.11 |
4 |
Release: %mkrel 7 |
5 |
Group: File tools |
6 |
License: GPLv2 |
7 |
URL: https://fedorahosted.org/tmpwatch/ |
8 |
Source0: https://fedorahosted.org/releases/t/m/tmpwatch/%{name}-%{version}.tar.bz2 |
9 |
Requires: psmisc |
10 |
# configure is looking for /sbin/fuser |
11 |
BuildRequires: psmisc |
12 |
|
13 |
%description |
14 |
The tmpwatch utility recursively searches through specified directories and |
15 |
removes files which have not been accessed in a specified period of time. |
16 |
Tmpwatch is normally used to clean up directories which are used for |
17 |
temporarily holding files (for example, /tmp). Tmpwatch ignores symlinks, |
18 |
won't switch filesystems and only removes empty directories and regular files. |
19 |
|
20 |
%prep |
21 |
%setup -q |
22 |
|
23 |
%build |
24 |
%configure2_5x |
25 |
%make |
26 |
|
27 |
%install |
28 |
%makeinstall ROOT=%{buildroot} MANDIR=%{_mandir} SBINDIR=%{_sbindir} |
29 |
|
30 |
install -d %{buildroot}%{_sysconfdir}/cron.daily |
31 |
install -d %{buildroot}%{_sysconfdir}/sysconfig |
32 |
|
33 |
cat > tmpwatch.cron << EOF |
34 |
#!/bin/sh |
35 |
|
36 |
[ -f %{_sysconfdir}/sysconfig/tmpwatch ] && . %{_sysconfdir}/sysconfig/tmpwatch |
37 |
|
38 |
%{_sbindir}/tmpwatch \$TMPWATCH_OPTIONS \$TMPWATCH_EXCLUDES 10d /tmp |
39 |
|
40 |
%{_sbindir}/tmpwatch \$TMPWATCH_OPTIONS \$TMPWATCH_EXCLUDES 30d /var/tmp |
41 |
|
42 |
[ -f %{_sysconfdir}/sysconfig/i18n ] && . %{_sysconfdir}/sysconfig/i18n |
43 |
|
44 |
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?,\$LANG/cat?}; do |
45 |
if [ -d "\$d" ]; then |
46 |
%{_sbindir}/tmpwatch \$TMPWATCH_OPTIONS -f 30d "\$d" |
47 |
fi |
48 |
done |
49 |
EOF |
50 |
|
51 |
cat > tmpwatch.sysconfig << EOF |
52 |
TMPWATCH_OPTIONS="-umc" |
53 |
# (oe) define files/directories/sockets tmpwatch should ignore (#18488) |
54 |
TMPWATCH_EXCLUDES="-x /tmp/.ICE-unix -x /tmp/.X11-unix -x /tmp/.font-unix -x /tmp/.Test-unix -x /tmp/.XIM-unix" |
55 |
EOF |
56 |
|
57 |
install -m0755 tmpwatch.cron %{buildroot}%{_sysconfdir}/cron.daily/tmpwatch |
58 |
install -m0644 tmpwatch.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/tmpwatch |
59 |
|
60 |
cat > README.urpmi << EOF |
61 |
The %{_sysconfdir}/cron.daily/tmpwatch script has been changed to use the %{_sysconfdir}/sysconfig/tmpwatch |
62 |
file to exclude certain files/directories/sockets from being processed. It should be safe to make your changes |
63 |
there instead. Per default these are not touched by tmpwatch: |
64 |
|
65 |
/tmp/.ICE-unix /tmp/.X11-unix /tmp/.font-unix /tmp/.Test-unix /tmp/.XIM-unix |
66 |
EOF |
67 |
|
68 |
%files |
69 |
%doc README.urpmi ChangeLog NEWS README |
70 |
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/tmpwatch |
71 |
%attr(0755,root,root) %{_sysconfdir}/cron.daily/tmpwatch |
72 |
%{_sbindir}/tmpwatch |
73 |
%{_mandir}/man8/tmpwatch.8* |
74 |
|