File: api.sh.in

package info (click to toggle)
oar 2.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,700 kB
  • sloc: perl: 34,517; sh: 6,041; ruby: 5,840; sql: 3,390; cpp: 2,277; makefile: 402; php: 365; ansic: 335; python: 275; exp: 23
file content (66 lines) | stat: -rw-r--r-- 2,720 bytes parent folder | download | duplicates (7)
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

api_setup() {
    mkdir -p ${OARCONFDIR}/apache2 || true
    # Check for an old configuration file
    if [ -f ${OARCONFDIR}/apache-api.conf ]; then
        mv ${OARCONFDIR}/apache-api.conf ${OARCONFDIR}/apache2/oar-restful-api.conf
    fi
    install_conffile \
        ${SHAREDIR}/apache2.conf \
        ${OARCONFDIR}/apache2/oar-restful-api.conf \
        0600 ${WWWUSER}

    install_conffile \
        ${SHAREDIR}/api_html_header.pl \
        ${OARCONFDIR}/api_html_header.pl \
        0600 ${OAROWNER}

    install_conffile \
        ${SHAREDIR}/api_html_postform.pl \
        ${OARCONFDIR}/api_html_postform.pl \
        0644 ${OAROWNER}

    install_conffile \
        ${SHAREDIR}/api_html_postform_resources.pl \
        ${OARCONFDIR}/api_html_postform_resources.pl \
        0644 ${OAROWNER}

    install_conffile \
        ${SHAREDIR}/api_html_postform_rule.pl \
        ${OARCONFDIR}/api_html_postform_rule.pl \
        0644 ${OAROWNER}

    install_conffile \
        ${SHAREDIR}/stress_factor.sh \
        ${OARCONFDIR}/stress_factor.sh \
        0700 ${OAROWNER}

    # Install the apache2 configuration file
    #
    # Starting with Debian8, Apache configs are managed using a2enconf/a2disconf/a2query -c, 
    # and stored in the conf-{available,enabled} directories
    if a2query -c > /dev/null 2>&1; then 
        if [ -L  ${APACHECONFDIR}/conf-available/oar-api.conf ]; then
            rm ${APACHECONFDIR}/conf-available/oar-api.conf
        elif [ -f ${APACHECONFDIR}/conf-available/oar-api.conf ]; then
            mv ${APACHECONFDIR}/conf-available/oar-api.conf ${APACHECONFDIR}/conf-available/oar-restful-api.conf
        fi
        if [ ! -e ${APACHECONFDIR}/conf-available/oar-restful-api.conf ]; then
            ln -s ${OARCONFDIR}/apache2/oar-restful-api.conf ${APACHECONFDIR}/conf-available/oar-restful-api.conf
        fi
    # UnTil Debian7, Centos6, Apache configs are stored in the conf.d directory
    elif [ -d ${APACHECONFDIR}/conf.d ]; then
        if [ -L  ${APACHECONFDIR}/conf.d/oar-api.conf ]; then
            rm ${APACHECONFDIR}/conf.d/oar-api.conf
        elif [ -f ${APACHECONFDIR}/conf.d/oar-api.conf ]; then
            mv ${APACHECONFDIR}/conf.d/oar-api.conf ${APACHECONFDIR}/conf.d/oar-restful-api.conf
        fi
        if [ ! -e ${APACHECONFDIR}/conf.d/oar-restful-api.conf ]; then
            ln -s ${OARCONFDIR}/apache2/oar-restful-api.conf ${APACHECONFDIR}/conf.d/oar-restful-api.conf
        fi 
    fi
    
    set_rights ${CGIDIR}/oarapi                  0755 ${OAROWNER} ${OAROWNERGROUP}
    set_rights ${CGIDIR}/oarapi/oarapi.cgi       0755 ${OAROWNER} ${OAROWNERGROUP}
    set_rights ${CGIDIR}/oarapi/oarapi-debug.cgi 0755 ${OAROWNER} ${OAROWNERGROUP}
}