File: man2html.cron.weekly

package info (click to toggle)
man2html 1.6g-11
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,720 kB
  • sloc: ansic: 9,673; sh: 2,309; perl: 335; makefile: 328; awk: 305; lisp: 171; cs: 170; xml: 119
file content (49 lines) | stat: -rw-r--r-- 1,352 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
# vim: ts=4:et:sw=4

set -e


CACHEDIR=/var/cache/man2html

[ -d "$CACHEDIR" ] && which index++ >/dev/null || exit 0

MANPATH=/usr/bin/manpath
MANPATH_CONFIG=/etc/manpath.config

# Get global man directories to index. See manpath(5) for more information.
if [ -x "$MANPATH" ] && [ -f "$MANPATH_CONFIG" ] ; then
     MANDIRS=$("$MANPATH" -C "$MANPATH_CONFIG" -g | tr : ' ')
else
     # Use some sensible defaults when manpath(1) is not available.
     MANDIRS="/usr/local/share/man /usr/share/man /opt/man"
fi



# Expand the man directories. Remove any non-existant directories. Use 
# device & inode numbers  to remove any symlinked directories from the list.
MANDIRS=$(find -L $MANDIRS -maxdepth 1 -type d -name 'man?' -printf "%D %i %p\n" 2>/dev/null | \
          sort -t' ' -k1,2 -u | \
          cut -d' ' -f 3)

### echo -e "Expanded MANDIRS are:\n$MANDIRS"

# Return when it expands to nothing.
[ -n "$MANDIRS" ] || exit 0


# See ionice(1)
[ -x /usr/bin/ionice ] &&  IONICE="/usr/bin/ionice -c3" || IONICE=

# Index the man pages
$IONICE index++ --config-file=/usr/share/man2html/swish++.conf \
                --index-file="$CACHEDIR"/man2html.swish++.index.tmp \
                $MANDIRS

mv -f "$CACHEDIR"/man2html.swish++.index.tmp \
      "$CACHEDIR"/man2html.swish++.index

chmod 644 "$CACHEDIR"/man2html.swish++.index

exit 0