summaryrefslogtreecommitdiffstats
path: root/deployment/funcs_jnlp_relocate.sh
blob: 4177af53cc27d936880a991df51dfdf3ea1d826d (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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#! /bin/bash

function copy_relocate_jnlps_base() {

local version=$1
shift

local url=$1
shift

local wsdir=$1
shift 

if [ -z "$version" -o -z "$url" -o -z "$wsdir" ] ; then
    echo usage $0 version codebase-url webstartdir
    echo Examples
    echo    sh $0 v2.0-rc2 file:////usr/local/projects/JOGL/webstart ../../webstart
    echo    sh $0 v2.0-rc2 http://domain.org/jogl/webstart /srv/www/webstart-next
    exit 1
fi

if [ ! -e $wsdir ] ; then
    echo $wsdir does not exist
    exit 1
fi

local jnlpdir=$wsdir/jnlp-files

if [ ! -e $jnlpdir ] ; then
    echo $jnlpdir does not exist
    exit 1
fi

local uri_esc=`echo $url | sed 's/\//\\\\\//g'`
for j in $jnlpdir/*.jnlp $jnlpdir/*.html ; do
    local jb=`basename $j`
    echo "processing $j to $wsdir/$jb"

    sed \
        -e "s/JOGAMP_VERSION/$version/g" \
        -e "s/GLUEGEN_CODEBASE_TAG/$uri_esc/g" \
        -e "s/JOAL_CODEBASE_TAG/$uri_esc/g" \
        -e "s/JOGL_CODEBASE_TAG/$uri_esc/g" \
        -e "s/JOCL_CODEBASE_TAG/$uri_esc/g" \
        $j > $wsdir/$jb
done

}

function copy_relocate_jnlps_demos() {

local version=$1
shift

local url=$1
shift

local wsdir=$1
shift 

local demos_rel=$1
shift

if [ -z "$version" -o -z "$url" -o -z "$wsdir" -o -z "$demos_rel" ] ; then
    echo usage $0 version codebase-url webstartdir demos_rel
    echo Examples
    echo    sh $0 v2.0-rc2 file:////usr/local/projects/JOGL/webstart ../../webstart demos
    echo    sh $0 v2.0-rc2 http://domain.org/jogl/webstart /srv/www/webstart-next demos
    exit 1
fi

if [ ! -e $wsdir ] ; then
    echo $wsdir does not exist
    exit 1
fi

local demos=$wsdir/$demos_rel

if [ ! -e $demos ] ; then
    echo $demos does not exist
    exit 1
fi

local url_demos=$url/$demos_rel
local jnlpdir=$demos/jnlp-files

if [ ! -e $jnlpdir ] ; then
    echo $jnlpdir does not exist
    exit 1
fi

local uri_esc=`echo $url | sed 's/\//\\\\\//g'`
local uri_demos_esc=`echo $url_demos | sed 's/\//\\\\\//g'`
for j in $jnlpdir/*.jnlp $jnlpdir/*.html ; do
    local jb=`basename $j`
    echo "processing $j to $demos/$jb"

    sed \
        -e "s/JOGAMP_VERSION/$version/g" \
        -e "s/GLUEGEN_CODEBASE_TAG/$uri_esc/g" \
        -e "s/JOAL_CODEBASE_TAG/$uri_esc/g" \
        -e "s/JOGL_CODEBASE_TAG/$uri_esc/g" \
        -e "s/JOCL_CODEBASE_TAG/$uri_esc/g" \
        -e "s/DEMO_CODEBASE_TAG/$uri_demos_esc/g" \
        $j > $demos/$jb
done

}

function remove_security_tag_jnlps() {

local wsdir=$1
shift 

if [ -z "$wsdir" ] ; then
    echo usage $0 webstartdir
    exit 1
fi

if [ ! -e $wsdir ] ; then
    echo $wsdir does not exist
    exit 1
fi

cd $wsdir

for i in *.jnlp ; do
    sed -i -e 's/<security>//g' -e 's/<\/security>//g' -e 's/<all-permissions\/>//g' $i
done

}