/usr/sbin/dwww-refresh-cache is in dwww 1.13.1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | #!/bin/sh
# vim:ts=8:et:fdm=marker
#
# dwww-refresh-cache -- refreshes dwww cache directory
#
# Part of the dwww package. Written by Robert Luberda.
set -e
. /usr/share/dwww/functions.sh && dwww_initialize || exit 1
export PATH=.:$PATH
echo -n "checking cache directory: $dwww_cache_dir..."
dwww_setup_cache_dir
echo done
# always remove temporary files, generated mostly by index++
echo -n "removing temporary files in cache dir..."
find "$dwww_cache_dir/" -maxdepth 1 \
-atime +2 \( -name '*.tmp.*' \
-o -name '[0-9]*.[0-9]*' \) \
-type f -print0 | xargs -0 rm -f
echo done
# remove temporary files, generated by dwww-build and dwww-build-menu
echo -n "removing temporary files in temp dir..."
find "$DWWW_TMPDIR/" -maxdepth 1 \
-ctime +1 \( -name 'dwww-build.*' \
-o -name 'dwww-build-menu.*' \) \
-type d -print0 | xargs -0 rm -rf
echo done
# remove accessed documents cache
if [ -n "$DWWW_KEEPDAYS" ] ; then
echo -n "removing stale cache entries..."
find "$dwww_cache_dir/" -maxdepth 3 \
-atime +"$DWWW_KEEPDAYS" -name '[^.]*' \
! -name 'dwww.swish++.index' \
! -name '*.dat' \
-type f -print0 | xargs -0 rm -f
echo done
su -s /bin/sh "$DWWW_CGIUSER" -c '/usr/sbin/dwww-cache --clean' < /dev/null || true
fi
pkglist="$dwww_cache_dir/pkglist.tmp.$$"
if [ -n "$DWWW_QUICKFIND_DB" ] || [ -n "$DWWW_DOCBASE2PKG_DB" ] ; then
echo -n "generating installed packages and programs list..."
LC_ALL=C dpkg-query --search '*bin/*' '/usr/games/*' '/usr/share/doc-base/*' > "$pkglist" 2>/dev/null || true
echo "done"
fi
if [ -n "$DWWW_QUICKFIND_DB" ] || [ -n "$DWWW_DOCBASE2PKG_DB" ] ; then
echo -n "generating source and virtual package list..."
LC_ALL=C dpkg-query --show --showformat='${status}, ${package}, ${source}, ${provides}\n' |
perl -ne '
chomp();
my ($status, $package, $source, @provides) = split(/, /);
next unless $status =~ /(^install)|(installed$)/;
next unless $package;
$source =~ s/ \(.*\).*// if $source;
print "$package: PKG-$package\n" unless $source;
print "$source: PKG-$package\n" if $source;
grep { print "$package: VRT-$_\n" } @provides if @provides;
' >> "$pkglist"
echo "done"
fi
if [ -n "$DWWW_DOCBASE2PKG_DB" ] ; then
echo -n "creating doc-base files to packages mapping file..."
grep '/usr/share/doc-base/' "$pkglist" | perl -ne '
chomp();
my ($pkg, $file) = split(/\s*:\s*/, $_, 2);
open (F, "<", $file) or next;
$_ = <F>;
chomp();
close (F);
s/^Document\s*:\s*(\S+).*/$1/;
next unless -f "/var/lib/doc-base/documents/$_";
print "$_\01$pkg\n";
' > "$DWWW_DOCBASE2PKG_DB.tmp.$$"
mv -f "$DWWW_DOCBASE2PKG_DB.tmp.$$" "$DWWW_DOCBASE2PKG_DB"
chmod 644 "$DWWW_DOCBASE2PKG_DB"
echo done
fi
if [ -n "$DWWW_QUICKFIND_DB" ] ; then
echo -n "creating installed packages & programs cache..."
dwww-quickfind --build "$DWWW_QUICKFIND_DB.tmp.$$" < "$pkglist"
mv -f "$DWWW_QUICKFIND_DB.tmp.$$" "$DWWW_QUICKFIND_DB"
chmod 644 "$DWWW_QUICKFIND_DB"
echo done
fi
if [ -e "$pkglist" ] ; then
rm -f "$pkglist"
fi
|