Display ??:??:?? when a time estimate gets too big.
[rsync.git] / maybe-make-man
1 #!/bin/sh
2
3 if [ $# != 1 ]; then
4     echo "Usage: $0 NAME.NUM.md" 1>&2
5     exit 1
6 fi
7
8 inname="$1"
9 srcdir=`dirname "$0"`
10 flagfile="$srcdir/.md2man-works"
11
12 if [ ! -f "$flagfile" ]; then
13     # We test our smallest manpage just to see if the python setup works.
14     if "$srcdir/md-convert" --test "$srcdir/rsync-ssl.1.md" >/dev/null 2>&1; then
15         touch $flagfile
16     else
17         outname=`echo "$inname" | sed 's/\.md$//'`
18         if [ -f "$outname" ]; then
19             exit 0
20         elif [ -f "$srcdir/$outname" ]; then
21             echo "Copying $srcdir/$outname"
22             cp -p "$srcdir/$outname" .
23             exit 0
24         else
25             echo "ERROR: $outname cannot be created."
26             if [ -f "$HOME/build_farm/build_test.fns" ]; then
27                 exit 0 # No exit errorno to avoid a build failure in the samba build farm
28             else
29                 exit 1
30             fi
31         fi
32     fi
33 fi
34
35 "$srcdir/md-convert" "$srcdir/$inname"