File: api.sh.in

package info (click to toggle)
oar 2.5.4-2
  • links: PTS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 11,064 kB
  • sloc: perl: 28,891; ruby: 5,813; sh: 5,208; ml: 3,408; sql: 3,255; cpp: 2,277; ansic: 702; makefile: 389; php: 99; exp: 23
file content (66 lines) | stat: -rw-r--r-- 2,742 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
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                  0750 ${OAROWNER} ${WWWUSER}
    set_rights ${CGIDIR}/oarapi/oarapi.cgi       6755 ${OARDO_DEFAULTUSER} ${OARDO_DEFAULTGROUP}
    set_rights ${CGIDIR}/oarapi/oarapi-debug.cgi 6755 ${OARDO_DEFAULTUSER} ${OARDO_DEFAULTGROUP}
}