File: publish-to-web

package info (click to toggle)
dpm-postgres 1.7.4.7-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 13,788 kB
  • ctags: 10,782
  • sloc: ansic: 146,136; sh: 13,362; perl: 11,142; python: 5,529; cpp: 5,113; sql: 1,790; makefile: 955; fortran: 113
file content (82 lines) | stat: -rwxr-xr-x 2,048 bytes parent folder | download | duplicates (8)
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
#!/bin/bash

PUBDIR='/afs/cern.ch/project/gd/www/documentation/LFC_DPM'
URL='http://grid-deployment.web.cern.ch/grid-deployment/documentation/LFC_DPM'

TOPSRC=$(cd $(dirname $0)/..; echo $PWD)
FILTER=$TOPSRC/scripts/filter-manpage-nroff.sh

function publish_man_pages {
    local component=$1

    NEWDIR=$PUBDIR/$component.new
    trap "rm -rf $NEWDIR" QUIT
    
    if [ ! -d "$NEWDIR" ]; then
        mkdir -p $NEWDIR
    fi
    
    cp $TOPSRC/CHANGES $NEWDIR/
    
    if [ ! -d "$NEWDIR/man3" ]; then
        mkdir -p $NEWDIR/man3
    fi
    if [ ! -d "$NEWDIR/man1" ]; then
        mkdir -p $NEWDIR/man1
    fi
    
    INDEX=$NEWDIR/index.html
    
    echo "<html><head><title>$component man pages</title></head><body><ul>" >$INDEX
    
    for man in $TOPSRC/${component}man.tmp/*.man; do
        name=${man##*/}
        name=${name%.man}
        if [[ "$name" =~ '_' ]]; then
            html="man3/$name.3.html"
        else 
            html="man1/$name.1.html"
        fi
        man2html -r -M man2html $man >$NEWDIR/$html
        echo "<li><A href=\"$html\">$name</A></li>" >>$INDEX
    done
    
    echo '</ul></body></html>' >>$INDEX
    
    # committing the changes
    trap "" QUIT
    rm -rf $PUBDIR/$component
    mv $NEWDIR $PUBDIR/$component
    
    echo "See the result at: $URL/$component"
}

function publish_dpm {
    mkdir -p $TOPSRC/dpmman.tmp
    cd ns
    for man in *.man; do
        name=${man%.man}
        nname=$(echo $name | sed -e 's/Cns_/dpns_/; s/^nsdaemon/dpnsdaemon/; s/^ns/dpns-/;')
        $FILTER $nname $name $TOPSRC/dpmman.tmp man
    done
    cd ..
    cp dpm/*.man dpmman.tmp/
    publish_man_pages dpm
    rm -rf $TOPSRC/dpmman.tmp
}

function publish_lfc {
    mkdir -p $TOPSRC/lfcman.tmp
    cd ns
    for man in *.man; do
        name=${man%.man}
        nname=$(echo $name | sed -e 's/Cns_/lfc_/; s/^nsdaemon/lfcdaemon/; s/^ns/lfc-/;')
        $FILTER $nname $name $TOPSRC/lfcman.tmp man
    done
    cd ..
    publish_man_pages lfc
    rm -rf $TOPSRC/lfcman.tmp
}

publish_dpm
publish_lfc