File: maybe-make-man

package info (click to toggle)
rsync 3.2.3-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 4,612 kB
  • sloc: ansic: 42,277; sh: 5,922; perl: 930; python: 825; asm: 665; makefile: 349; cpp: 289; awk: 191
file content (40 lines) | stat: -rwxr-xr-x 934 bytes parent folder | download | duplicates (2)
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
#!/bin/sh

if [ x"$2" = x ]; then
    echo "Usage: $0 SRC_DIR NAME.NUM.md" 1>&2
    exit 1
fi

srcdir="$1"
inname="$2"
flagfile="$srcdir/.md2man-works"

if [ ! -d "$srcdir" ]; then
    echo "The specified SRC_DIR is not a directory: $srcdir" 1>&2
    exit 1
fi

if [ ! -f "$flagfile" ]; then
    # We test our smallest manpage just to see if the python setup works.
    if "$srcdir/md2man" --test "$srcdir/rsync-ssl.1.md" >/dev/null 2>&1; then
	touch $flagfile
    else
	outname=`echo "$inname" | sed 's/\.md$//'`
	if [ -f "$outname" ]; then
	    exit 0
	elif [ -f "$srcdir/$outname" ]; then
	    echo "Copying $srcdir/$outname"
	    cp -p "$srcdir/$outname" .
	    exit 0
	else
	    echo "ERROR: $outname cannot be created."
	    if [ -f "$HOME/build_farm/build_test.fns" ]; then
		exit 0 # No exit errorno to avoid a build failure in the samba build farm
	    else
		exit 1
	    fi
	fi
    fi
fi

"$srcdir/md2man" "$srcdir/$inname"