summarylogtreecommitdiffstats
path: root/main.install
blob: bc5e1a6159d98447afbfa622a66a565543118ca4 (plain)
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
post_install() {
    serverDir=/etc/connective-http
    classPathFolders=( "libs/" )
    mainType=org.asf.connective.standalone.main.ConnectiveStandalone
    credtoolLibs=()
    credtoolTarget=""
    jvmArguments="-Djava.net.preferIPv4Stack=true"

    if [ -f "/etc/connective-http/config.props" ]; then
        source "/etc/connective-http/config.props"
    fi

    mkdir "$serverDir/modules" -p
    chown connective:connective "$serverDir/modules" -R
    cp "/usr/lib/jazzcode/JazzCode.jar" "$serverDir/modules/JazzCode.jar" -f
    chown connective "$serverDir/modules/JazzCode.jar"
       
    if [ -f "$serverDir"/server.ccfg ] && cq org.asf.connective.standalone.main.ConnectiveConfiguration --source-jar /usr/lib/connective-http/ConnectiveStandalone.jar --source-jar /usr/lib/connective-http/libs/RatsMemory.jar "$serverDir"/server.ccfg .context.root &>/dev/null; then
        jcsupportcode='
# JazzCode Support Block (Auto-generated, avoid manual removal)
extension "class:org.asf.jazzcode.internal.extensions.JazzCodeFileExtension"
virtualfile "class:org.asf.jazzcode.internal.virtualfiles.JazzCodeJCILHandler"'
    
        rootcontextblock="$(cq org.asf.connective.standalone.main.ConnectiveConfiguration --source-jar /usr/lib/connective-http/ConnectiveStandalone.jar --source-jar /usr/lib/connective-http/libs/RatsMemory.jar "$serverDir"/server.ccfg .context.root --viewmode | sed "0,/^..*/s||&\n${jcsupportcode//$'\n'/\\n}|" ; echo .)"
        rootcontextblock=${rootcontextblock:0:-2}
        
        cq org.asf.connective.standalone.main.ConnectiveConfiguration --source-jar /usr/lib/connective-http/ConnectiveStandalone.jar --source-jar /usr/lib/connective-http/libs/RatsMemory.jar "$serverDir"/server.ccfg .context.root &>/dev/null && cq org.asf.connective.standalone.main.ConnectiveConfiguration --source-jar /usr/lib/connective-http/ConnectiveStandalone.jar --source-jar /usr/lib/connective-http/libs/RatsMemory.jar "$serverDir"/server.ccfg . -s .context.root "$rootcontextblock" --ccfg-output --output "$serverDir"/server.ccfg
    fi
}

post_remove() {
    serverDir=/etc/connective-http
    classPathFolders=( "libs/" )
    mainType=org.asf.connective.standalone.main.ConnectiveStandalone
    credtoolLibs=()
    credtoolTarget=""
    jvmArguments="-Djava.net.preferIPv4Stack=true"

    if [ -f "/etc/connective-http/config.props" ]; then
        source "/etc/connective-http/config.props"
    fi

    rm -f "$serverDir/modules/JazzCode.jar"
    
    if [ -f "$serverDir"/server.ccfg ] && cq org.asf.connective.standalone.main.ConnectiveConfiguration --source-jar /usr/lib/connective-http/ConnectiveStandalone.jar --source-jar /usr/lib/connective-http/libs/RatsMemory.jar "$serverDir"/server.ccfg .context.root &>/dev/null; then
        jcsupportcode='
# JazzCode Support Block (Auto-generated, avoid manual removal)
extension "class:org.asf.jazzcode.internal.extensions.JazzCodeFileExtension"
virtualfile "class:org.asf.jazzcode.internal.virtualfiles.JazzCodeJCILHandler"'
    
        rootcontextblock="$(cq org.asf.connective.standalone.main.ConnectiveConfiguration --source-jar /usr/lib/connective-http/ConnectiveStandalone.jar --source-jar /usr/lib/connective-http/libs/RatsMemory.jar "$serverDir"/server.ccfg .context.root --viewmode ; echo .)"
        rootcontextblock="${rootcontextblock//$jcsupportcode$'\n'/}"
        rootcontextblock=${rootcontextblock:0:-1}
        
        cq org.asf.connective.standalone.main.ConnectiveConfiguration --source-jar /usr/lib/connective-http/ConnectiveStandalone.jar --source-jar /usr/lib/connective-http/libs/RatsMemory.jar "$serverDir"/server.ccfg .context.root &>/dev/null && cq org.asf.connective.standalone.main.ConnectiveConfiguration --source-jar /usr/lib/connective-http/ConnectiveStandalone.jar --source-jar /usr/lib/connective-http/libs/RatsMemory.jar "$serverDir"/server.ccfg . -s .context.root "$rootcontextblock" --ccfg-output --output "$serverDir"/server.ccfg
    fi
}