1 |
Summary: Utility for removing files based on when they were last accessed |
2 |
Name: tmpwatch |
3 |
Version: 2.10.3 |
4 |
Release: %mkrel 1 |
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 |
rm -rf %{buildroot} |
29 |
|
30 |
%makeinstall ROOT=%{buildroot} MANDIR=%{_mandir} SBINDIR=%{_sbindir} |
31 |
|
32 |
install -d %{buildroot}%{_sysconfdir}/cron.daily |
33 |
install -d %{buildroot}%{_sysconfdir}/sysconfig |
34 |
|
35 |
cat > tmpwatch.cron << EOF |
36 |
#!/bin/sh |
37 |
|
38 |
[ -f %{_sysconfdir}/sysconfig/tmpwatch ] && . %{_sysconfdir}/sysconfig/tmpwatch |
39 |
|
40 |
%{_sbindir}/tmpwatch \$TMPWATCH_OPTIONS \$TMPWATCH_EXCLUDES 10d /tmp |
41 |
|
42 |
%{_sbindir}/tmpwatch \$TMPWATCH_OPTIONS \$TMPWATCH_EXCLUDES 30d /var/tmp |
43 |
|
44 |
[ -f %{_sysconfdir}/sysconfig/i18n ] && . %{_sysconfdir}/sysconfig/i18n |
45 |
|
46 |
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?,\$LANG/cat?}; do |
47 |
if [ -d "\$d" ]; then |
48 |
%{_sbindir}/tmpwatch \$TMPWATCH_OPTIONS -f 30d "\$d" |
49 |
fi |
50 |
done |
51 |
EOF |
52 |
|
53 |
cat > tmpwatch.sysconfig << EOF |
54 |
#TMPWATCH_OPTIONS="-umc" |
55 |
# (oe) define files/directories/sockets tmpwatch should ignore (#18488) |
56 |
TMPWATCH_EXCLUDES="-x /tmp/.ICE-unix -x /tmp/.X*-unix -x /tmp/.font-unix -x /tmp/.Test-unix" |
57 |
EOF |
58 |
|
59 |
install -m0755 tmpwatch.cron %{buildroot}%{_sysconfdir}/cron.daily/tmpwatch |
60 |
install -m0644 tmpwatch.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/tmpwatch |
61 |
|
62 |
cat > README.urpmi << EOF |
63 |
The %{_sysconfdir}/cron.daily/tmpwatch script has been changed to use the %{_sysconfdir}/sysconfig/tmpwatch |
64 |
file to exclude certain files/directories/sockets from being processed. It should be safe to make your changes |
65 |
there instead. Per default these are not touched by tmpwatch: |
66 |
|
67 |
/tmp/.ICE-unix /tmp/.X*-unix /tmp/.font-unix /tmp/.Test-unix |
68 |
EOF |
69 |
|
70 |
%files |
71 |
%doc README.urpmi ChangeLog NEWS README |
72 |
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/tmpwatch |
73 |
%attr(0755,root,root) %{_sysconfdir}/cron.daily/tmpwatch |
74 |
%{_sbindir}/tmpwatch |
75 |
%{_mandir}/man8/tmpwatch.8* |
76 |
|