Statistics
| Branch: | Tag: | Revision:

one / install.sh @ 70050aa6

History | View | Annotate | Download (38.6 KB)

1
#!/bin/bash
2

    
3
# -------------------------------------------------------------------------- #
4
# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org)             #
5
#                                                                            #
6
# Licensed under the Apache License, Version 2.0 (the "License"); you may    #
7
# not use this file except in compliance with the License. You may obtain    #
8
# a copy of the License at                                                   #
9
#                                                                            #
10
# http://www.apache.org/licenses/LICENSE-2.0                                 #
11
#                                                                            #
12
# Unless required by applicable law or agreed to in writing, software        #
13
# distributed under the License is distributed on an "AS IS" BASIS,          #
14
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
15
# See the License for the specific language governing permissions and        #
16
# limitations under the License.                                             #
17
#--------------------------------------------------------------------------- #
18

    
19
#-------------------------------------------------------------------------------
20
# Install program for OpenNebula. It will install it relative to
21
# $ONE_LOCATION if defined with the -d option, otherwise it'll be installed
22
# under /. In this case you may specified the oneadmin user/group, so you do
23
# not need run the OpenNebula daemon with root priviledges
24
#-------------------------------------------------------------------------------
25

    
26
#-------------------------------------------------------------------------------
27
# COMMAND LINE PARSING
28
#-------------------------------------------------------------------------------
29
usage() {
30
 echo
31
 echo "Usage: install.sh [-u install_user] [-g install_group] [-k keep conf]"
32
 echo "                  [-d ONE_LOCATION] [-c occi|ec2] [-r] [-h]"
33
 echo
34
 echo "-u: user that will run opennebula, defaults to user executing install.sh"
35
 echo "-g: group of the user that will run opennebula, defaults to user"
36
 echo "    executing install.sh"
37
 echo "-k: keep configuration files of existing OpenNebula installation, useful"
38
 echo "    when upgrading. This flag should not be set when installing"
39
 echo "    OpenNebula for the first time"
40
 echo "-d: target installation directory, if not defined it'd be root. Must be"
41
 echo "    an absolute path."
42
 echo "-c: install client utilities: OpenNebula cli, occi and ec2 client files"
43
 echo "-s: install OpenNebula Sunstone"
44
 echo "-r: remove Opennebula, only useful if -d was not specified, otherwise"
45
 echo "    rm -rf \$ONE_LOCATION would do the job"
46
 echo "-l: creates symlinks instead of copying files, useful for development"
47
 echo "-h: prints this help"
48
}
49
#-------------------------------------------------------------------------------
50

    
51
TEMP_OPT=`getopt -o hkrlcsu:g:d: -n 'install.sh' -- "$@"`
52

    
53
if [ $? != 0 ] ; then
54
    usage
55
    exit 1
56
fi
57

    
58
eval set -- "$TEMP_OPT"
59

    
60
INSTALL_ETC="yes"
61
UNINSTALL="no"
62
LINK="no"
63
CLIENT="no"
64
SUNSTONE="no"
65
ONEADMIN_USER=`id -u`
66
ONEADMIN_GROUP=`id -g`
67
SRC_DIR=$PWD
68

    
69
while true ; do
70
    case "$1" in
71
        -h) usage; exit 0;;
72
        -k) INSTALL_ETC="no"   ; shift ;;
73
        -r) UNINSTALL="yes"   ; shift ;;
74
        -l) LINK="yes" ; shift ;;
75
        -c) CLIENT="yes"; INSTALL_ETC="no" ; shift ;;
76
        -s) SUNSTONE="yes"; INSTALL_ETC="no" ; shift ;;
77
        -u) ONEADMIN_USER="$2" ; shift 2;;
78
        -g) ONEADMIN_GROUP="$2"; shift 2;;
79
        -d) ROOT="$2" ; shift 2 ;;
80
        --) shift ; break ;;
81
        *)  usage; exit 1 ;;
82
    esac
83
done
84

    
85
#-------------------------------------------------------------------------------
86
# Definition of locations
87
#-------------------------------------------------------------------------------
88

    
89
if [ -z "$ROOT" ] ; then
90
    BIN_LOCATION="/usr/bin"
91
    LIB_LOCATION="/usr/lib/one"
92
    ETC_LOCATION="/etc/one"
93
    LOG_LOCATION="/var/log/one"
94
    VAR_LOCATION="/var/lib/one"
95
    SUNSTONE_LOCATION="$LIB_LOCATION/sunstone"
96
    IMAGES_LOCATION="$VAR_LOCATION/images"
97
    RUN_LOCATION="/var/run/one"
98
    LOCK_LOCATION="/var/lock/one"
99
    INCLUDE_LOCATION="/usr/include"
100
    SHARE_LOCATION="/usr/share/one"
101
    MAN_LOCATION="/usr/share/man/man8"
102

    
103
    if [ "$CLIENT" = "yes" ]; then
104
        MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION"
105

    
106
        DELETE_DIRS=""
107

    
108
        CHOWN_DIRS=""
109
    elif [ "$SUNSTONE" = "yes" ]; then
110
        MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $VAR_LOCATION $SUNSTONE_LOCATION"
111

    
112
        DELETE_DIRS="$MAKE_DIRS"
113

    
114
        CHOWN_DIRS=""
115
    else
116
        MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $ETC_LOCATION $VAR_LOCATION \
117
                   $INCLUDE_LOCATION $SHARE_LOCATION \
118
                   $LOG_LOCATION $RUN_LOCATION $LOCK_LOCATION \
119
                   $IMAGES_LOCATION $MAN_LOCATION"
120

    
121
        DELETE_DIRS="$LIB_LOCATION $ETC_LOCATION $LOG_LOCATION $VAR_LOCATION \
122
                     $RUN_LOCATION $SHARE_DIRS"
123

    
124
        CHOWN_DIRS="$LOG_LOCATION $VAR_LOCATION $RUN_LOCATION $LOCK_LOCATION"
125
    fi
126

    
127
else
128
    BIN_LOCATION="$ROOT/bin"
129
    LIB_LOCATION="$ROOT/lib"
130
    ETC_LOCATION="$ROOT/etc"
131
    VAR_LOCATION="$ROOT/var"
132
    SUNSTONE_LOCATION="$LIB_LOCATION/sunstone"
133
    IMAGES_LOCATION="$VAR_LOCATION/images"
134
    INCLUDE_LOCATION="$ROOT/include"
135
    SHARE_LOCATION="$ROOT/share"
136
    MAN_LOCATION="$ROOT/share/man/man8"
137

    
138
    if [ "$CLIENT" = "yes" ]; then
139
        MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION"
140

    
141
        DELETE_DIRS="$MAKE_DIRS"
142
    elif [ "$SUNSTONE" = "yes" ]; then
143
        MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $VAR_LOCATION $SUNSTONE_LOCATION"
144

    
145
        DELETE_DIRS="$MAKE_DIRS"
146
    else
147
        MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $ETC_LOCATION $VAR_LOCATION \
148
                   $INCLUDE_LOCATION $SHARE_LOCATION $IMAGES_LOCATION \
149
                   $MAN_LOCATION"
150

    
151
        DELETE_DIRS="$MAKE_DIRS"
152

    
153
        CHOWN_DIRS="$ROOT"
154
    fi
155

    
156
    CHOWN_DIRS="$ROOT"
157
fi
158

    
159
SHARE_DIRS="$SHARE_LOCATION/examples \
160
            $SHARE_LOCATION/examples/tm \
161
            $SHARE_LOCATION/hooks"
162

    
163
ETC_DIRS="$ETC_LOCATION/im_kvm \
164
          $ETC_LOCATION/im_xen \
165
          $ETC_LOCATION/im_ec2 \
166
          $ETC_LOCATION/vmm_ec2 \
167
          $ETC_LOCATION/vmm_ssh \
168
          $ETC_LOCATION/vmm_sh \
169
          $ETC_LOCATION/tm_nfs \
170
          $ETC_LOCATION/tm_ssh \
171
          $ETC_LOCATION/tm_dummy \
172
          $ETC_LOCATION/tm_lvm \
173
          $ETC_LOCATION/hm \
174
          $ETC_LOCATION/auth \
175
          $ETC_LOCATION/ec2query_templates \
176
          $ETC_LOCATION/occi_templates"
177

    
178
LIB_DIRS="$LIB_LOCATION/ruby \
179
          $LIB_LOCATION/ruby/OpenNebula \
180
          $LIB_LOCATION/ruby/cloud/ \
181
          $LIB_LOCATION/ruby/cloud/econe \
182
          $LIB_LOCATION/ruby/cloud/econe/views \
183
          $LIB_LOCATION/ruby/cloud/occi \
184
          $LIB_LOCATION/onedb \
185
          $LIB_LOCATION/tm_commands \
186
          $LIB_LOCATION/tm_commands/nfs \
187
          $LIB_LOCATION/tm_commands/ssh \
188
          $LIB_LOCATION/tm_commands/dummy \
189
          $LIB_LOCATION/tm_commands/lvm \
190
          $LIB_LOCATION/mads \
191
          $LIB_LOCATION/sh"
192

    
193
VAR_DIRS="$VAR_LOCATION/remotes \
194
          $VAR_LOCATION/remotes/im \
195
          $VAR_LOCATION/remotes/im/kvm.d \
196
          $VAR_LOCATION/remotes/im/xen.d \
197
          $VAR_LOCATION/remotes/im/ganglia.d \
198
          $VAR_LOCATION/remotes/vmm/xen \
199
          $VAR_LOCATION/remotes/vmm/kvm \
200
          $VAR_LOCATION/remotes/image \
201
          $VAR_LOCATION/remotes/image/fs"
202

    
203
SUNSTONE_DIRS="$SUNSTONE_LOCATION/models \
204
               $SUNSTONE_LOCATION/models/OpenNebulaJSON \
205
               $SUNSTONE_LOCATION/public \
206
               $SUNSTONE_LOCATION/public/js \
207
               $SUNSTONE_LOCATION/public/js/plugins \
208
               $SUNSTONE_LOCATION/public/css \
209
               $SUNSTONE_LOCATION/public/vendor \
210
               $SUNSTONE_LOCATION/public/vendor/jQueryLayout \
211
               $SUNSTONE_LOCATION/public/vendor/dataTables \
212
               $SUNSTONE_LOCATION/public/vendor/jQueryUI \
213
               $SUNSTONE_LOCATION/public/vendor/jQuery \
214
               $SUNSTONE_LOCATION/public/vendor/jGrowl \
215
               $SUNSTONE_LOCATION/public/images \
216
               $SUNSTONE_LOCATION/templates"
217

    
218
LIB_ECO_CLIENT_DIRS="$LIB_LOCATION/ruby \
219
                 $LIB_LOCATION/ruby/OpenNebula \
220
                 $LIB_LOCATION/ruby/cloud/ \
221
                 $LIB_LOCATION/ruby/cloud/econe"
222

    
223
LIB_OCCI_CLIENT_DIRS="$LIB_LOCATION/ruby \
224
                 $LIB_LOCATION/ruby/OpenNebula \
225
                 $LIB_LOCATION/ruby/cloud/occi"
226

    
227
LIB_OCA_CLIENT_DIRS="$LIB_LOCATION/ruby \
228
                 $LIB_LOCATION/ruby/OpenNebula"
229

    
230
LIB_CLI_DIRS="$LIB_LOCATION/ruby \
231
              $LIB_LOCATION/ruby/OpenNebula"
232

    
233
if [ "$CLIENT" = "yes" ]; then
234
    MAKE_DIRS="$MAKE_DIRS $LIB_ECO_CLIENT_DIRS $LIB_OCCI_CLIENT_DIRS \
235
               $LIB_CLI_DIRS"
236
elif [ "$SUNSTONE" = "yes" ]; then
237
    MAKE_DIRS="$MAKE_DIRS $SUNSTONE_DIRS $LIB_OCA_CLIENT_DIRS"
238
else
239
    MAKE_DIRS="$MAKE_DIRS $SHARE_DIRS $ETC_DIRS $LIB_DIRS $VAR_DIRS $SUNSTONE_DIRS"
240
fi
241

    
242
#-------------------------------------------------------------------------------
243
#-------------------------------------------------------------------------------
244
# FILE DEFINITION, WHAT IS GOING TO BE INSTALLED AND WHERE
245
#-------------------------------------------------------------------------------
246
#-------------------------------------------------------------------------------
247
INSTALL_FILES=(
248
    BIN_FILES:$BIN_LOCATION
249
    INCLUDE_FILES:$INCLUDE_LOCATION
250
    LIB_FILES:$LIB_LOCATION
251
    RUBY_LIB_FILES:$LIB_LOCATION/ruby
252
    RUBY_OPENNEBULA_LIB_FILES:$LIB_LOCATION/ruby/OpenNebula
253
    MAD_RUBY_LIB_FILES:$LIB_LOCATION/ruby
254
    MAD_RUBY_LIB_FILES:$VAR_LOCATION/remotes
255
    MAD_SH_LIB_FILES:$LIB_LOCATION/sh
256
    MAD_SH_LIB_FILES:$VAR_LOCATION/remotes
257
    ONEDB_MIGRATOR_FILES:$LIB_LOCATION/onedb
258
    MADS_LIB_FILES:$LIB_LOCATION/mads
259
    IM_PROBES_FILES:$VAR_LOCATION/remotes/im
260
    IM_PROBES_KVM_FILES:$VAR_LOCATION/remotes/im/kvm.d
261
    IM_PROBES_XEN_FILES:$VAR_LOCATION/remotes/im/xen.d
262
    IM_PROBES_GANGLIA_FILES:$VAR_LOCATION/remotes/im/ganglia.d
263
    VMM_SSH_KVM_SCRIPTS:$VAR_LOCATION/remotes/vmm/kvm
264
    VMM_SSH_XEN_SCRIPTS:$VAR_LOCATION/remotes/vmm/xen
265
    VMM_SSH_XEN_KVM_POLL:$VAR_LOCATION/remotes/vmm/kvm/poll
266
    VMM_SSH_XEN_KVM_POLL:$VAR_LOCATION/remotes/vmm/xen/poll
267
    VMM_SSH_GANGLIA_POLL:$VAR_LOCATION/remotes/vmm/kvm/poll_local
268
    VMM_SSH_GANGLIA_POLL:$VAR_LOCATION/remotes/vmm/xen/poll_local
269
    NFS_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/nfs
270
    SSH_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/ssh
271
    DUMMY_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/dummy
272
    LVM_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/lvm
273
    IMAGE_DRIVER_FS_SCRIPTS:$VAR_LOCATION/remotes/image/fs
274
    EXAMPLE_SHARE_FILES:$SHARE_LOCATION/examples
275
    INSTALL_NOVNC_SHARE_FILE:$SHARE_LOCATION
276
    TM_EXAMPLE_SHARE_FILES:$SHARE_LOCATION/examples/tm
277
    HOOK_SHARE_FILES:$SHARE_LOCATION/hooks
278
    COMMON_CLOUD_LIB_FILES:$LIB_LOCATION/ruby/cloud
279
    ECO_LIB_FILES:$LIB_LOCATION/ruby/cloud/econe
280
    ECO_LIB_VIEW_FILES:$LIB_LOCATION/ruby/cloud/econe/views
281
    ECO_BIN_FILES:$BIN_LOCATION
282
    OCCI_LIB_FILES:$LIB_LOCATION/ruby/cloud/occi
283
    OCCI_BIN_FILES:$BIN_LOCATION
284
    MAN_FILES:$MAN_LOCATION
285
)
286

    
287
INSTALL_CLIENT_FILES=(
288
    COMMON_CLOUD_CLIENT_LIB_FILES:$LIB_LOCATION/ruby/cloud
289
    ECO_LIB_CLIENT_FILES:$LIB_LOCATION/ruby/cloud/econe
290
    ECO_BIN_CLIENT_FILES:$BIN_LOCATION
291
    COMMON_CLOUD_CLIENT_LIB_FILES:$LIB_LOCATION/ruby/cloud
292
    OCCI_LIB_CLIENT_FILES:$LIB_LOCATION/ruby/cloud/occi
293
    OCCI_BIN_CLIENT_FILES:$BIN_LOCATION
294
    CLI_BIN_FILES:$BIN_LOCATION
295
    CLI_LIB_FILES:$LIB_LOCATION/ruby
296
    RUBY_OPENNEBULA_LIB_FILES:$LIB_LOCATION/ruby/OpenNebula
297
)
298

    
299
INSTALL_SUNSTONE_RUBY_FILES=(
300
    SUNSTONE_RUBY_LIB_FILES:$LIB_LOCATION/ruby
301
    RUBY_OPENNEBULA_LIB_FILES:$LIB_LOCATION/ruby/OpenNebula
302
)
303

    
304
INSTALL_SUNSTONE_FILES=(
305
    SUNSTONE_FILES:$SUNSTONE_LOCATION
306
    SUNSTONE_BIN_FILES:$BIN_LOCATION
307
    SUNSTONE_MODELS_FILES:$SUNSTONE_LOCATION/models
308
    SUNSTONE_MODELS_JSON_FILES:$SUNSTONE_LOCATION/models/OpenNebulaJSON
309
    SUNSTONE_TEMPLATE_FILES:$SUNSTONE_LOCATION/templates
310
    SUNSTONE_PUBLIC_JS_FILES:$SUNSTONE_LOCATION/public/js
311
    SUNSTONE_PUBLIC_JS_PLUGINS_FILES:$SUNSTONE_LOCATION/public/js/plugins
312
    SUNSTONE_PUBLIC_CSS_FILES:$SUNSTONE_LOCATION/public/css
313
    SUNSTONE_PUBLIC_VENDOR_DATATABLES:$SUNSTONE_LOCATION/public/vendor/dataTables
314
    SUNSTONE_PUBLIC_VENDOR_JGROWL:$SUNSTONE_LOCATION/public/vendor/jGrowl
315
    SUNSTONE_PUBLIC_VENDOR_JQUERY:$SUNSTONE_LOCATION/public/vendor/jQuery
316
    SUNSTONE_PUBLIC_VENDOR_JQUERYUI:$SUNSTONE_LOCATION/public/vendor/jQueryUI
317
    SUNSTONE_PUBLIC_VENDOR_JQUERYLAYOUT:$SUNSTONE_LOCATION/public/vendor/jQueryLayout
318
    SUNSTONE_PUBLIC_IMAGES_FILES:$SUNSTONE_LOCATION/public/images
319
)
320

    
321
INSTALL_ETC_FILES=(
322
    ETC_FILES:$ETC_LOCATION
323
    VMM_EC2_ETC_FILES:$ETC_LOCATION/vmm_ec2
324
    VMM_SSH_ETC_FILES:$ETC_LOCATION/vmm_ssh
325
    VMM_SH_ETC_FILES:$ETC_LOCATION/vmm_sh
326
    IM_EC2_ETC_FILES:$ETC_LOCATION/im_ec2
327
    TM_NFS_ETC_FILES:$ETC_LOCATION/tm_nfs
328
    TM_SSH_ETC_FILES:$ETC_LOCATION/tm_ssh
329
    TM_DUMMY_ETC_FILES:$ETC_LOCATION/tm_dummy
330
    TM_LVM_ETC_FILES:$ETC_LOCATION/tm_lvm
331
    HM_ETC_FILES:$ETC_LOCATION/hm
332
    AUTH_ETC_FILES:$ETC_LOCATION/auth
333
    ECO_ETC_FILES:$ETC_LOCATION
334
    ECO_ETC_TEMPLATE_FILES:$ETC_LOCATION/ec2query_templates
335
    OCCI_ETC_FILES:$ETC_LOCATION
336
    OCCI_ETC_TEMPLATE_FILES:$ETC_LOCATION/occi_templates
337
    SUNSTONE_ETC_FILES:$ETC_LOCATION
338
)
339

    
340
#-------------------------------------------------------------------------------
341
# Binary files, to be installed under $BIN_LOCATION
342
#-------------------------------------------------------------------------------
343

    
344
BIN_FILES="src/nebula/oned \
345
           src/scheduler/src/sched/mm_sched \
346
           src/cli/onevm \
347
           src/cli/onehost \
348
           src/cli/onevnet \
349
           src/cli/oneuser \
350
           src/cli/oneimage \
351
           src/cli/onecluster \
352
           src/cli/onetemplate \
353
           src/cli/onedb \
354
           share/scripts/one \
355
           src/authm_mad/oneauth"
356

    
357
#-------------------------------------------------------------------------------
358
# C/C++ OpenNebula API Library & Development files
359
# Include files, to be installed under $INCLUDE_LOCATION
360
# Library files, to be installed under $LIB_LOCATION
361
#-------------------------------------------------------------------------------
362

    
363
INCLUDE_FILES=""
364
LIB_FILES=""
365

    
366
#-------------------------------------------------------------------------------
367
# Ruby library files, to be installed under $LIB_LOCATION/ruby
368
#-------------------------------------------------------------------------------
369

    
370
RUBY_LIB_FILES="src/mad/ruby/ActionManager.rb \
371
                src/mad/ruby/CommandManager.rb \
372
                src/mad/ruby/OpenNebulaDriver.rb \
373
                src/mad/ruby/VirtualMachineDriver.rb \
374
                src/mad/ruby/Ganglia.rb \
375
                src/cli/client_utilities.rb \
376
                src/cli/command_parse.rb \
377
                src/oca/ruby/OpenNebula.rb \
378
                src/tm_mad/TMScript.rb \
379
                src/authm_mad/one_usage.rb \
380
                src/authm_mad/quota.rb \
381
                src/authm_mad/simple_auth.rb \
382
                src/authm_mad/simple_permissions.rb \
383
                src/authm_mad/ssh_auth.rb"
384

    
385
RUBY_OPENNEBULA_LIB_FILES="src/oca/ruby/OpenNebula/Host.rb \
386
                           src/oca/ruby/OpenNebula/HostPool.rb \
387
                           src/oca/ruby/OpenNebula/Pool.rb \
388
                           src/oca/ruby/OpenNebula/User.rb \
389
                           src/oca/ruby/OpenNebula/UserPool.rb \
390
                           src/oca/ruby/OpenNebula/VirtualMachine.rb \
391
                           src/oca/ruby/OpenNebula/VirtualMachinePool.rb \
392
                           src/oca/ruby/OpenNebula/VirtualNetwork.rb \
393
                           src/oca/ruby/OpenNebula/VirtualNetworkPool.rb \
394
                           src/oca/ruby/OpenNebula/Image.rb \
395
                           src/oca/ruby/OpenNebula/ImagePool.rb \
396
                           src/oca/ruby/OpenNebula/Cluster.rb \
397
                           src/oca/ruby/OpenNebula/ClusterPool.rb \
398
                           src/oca/ruby/OpenNebula/Template.rb \
399
                           src/oca/ruby/OpenNebula/TemplatePool.rb \
400
                           src/oca/ruby/OpenNebula/XMLUtils.rb"
401

    
402

    
403
#-----------------------------------------------------------------------------
404
# MAD Script library files, to be installed under $LIB_LOCATION/<script lang>
405
# and remotes directory
406
#-----------------------------------------------------------------------------
407

    
408
MAD_SH_LIB_FILES="src/mad/sh/scripts_common.sh"
409
MAD_RUBY_LIB_FILES="src/mad/ruby/scripts_common.rb"
410

    
411
#-------------------------------------------------------------------------------
412
# Driver executable files, to be installed under $LIB_LOCATION/mads
413
#-------------------------------------------------------------------------------
414

    
415
MADS_LIB_FILES="src/mad/sh/madcommon.sh \
416
              src/tm_mad/tm_common.sh \
417
              src/vmm_mad/ssh/one_vmm_ssh.rb \
418
              src/vmm_mad/ssh/one_vmm_ssh \
419
              src/vmm_mad/sh/one_vmm_sh.rb \
420
              src/vmm_mad/sh/one_vmm_sh \
421
              src/vmm_mad/ec2/one_vmm_ec2.rb \
422
              src/vmm_mad/ec2/one_vmm_ec2 \
423
              src/vmm_mad/dummy/one_vmm_dummy.rb \
424
              src/vmm_mad/dummy/one_vmm_dummy \
425
              src/im_mad/im_ssh/one_im_ssh.rb \
426
              src/im_mad/im_ssh/one_im_ssh \
427
              src/im_mad/im_sh/one_im_sh.rb \
428
              src/im_mad/im_sh/one_im_sh \
429
              src/im_mad/ec2/one_im_ec2.rb \
430
              src/im_mad/ec2/one_im_ec2 \
431
              src/im_mad/dummy/one_im_dummy.rb \
432
              src/im_mad/dummy/one_im_dummy \
433
              src/tm_mad/one_tm \
434
              src/tm_mad/one_tm.rb \
435
              src/hm_mad/one_hm.rb \
436
              src/hm_mad/one_hm \
437
              src/authm_mad/one_auth_mad.rb \
438
              src/authm_mad/one_auth_mad \
439
              src/image_mad/one_image.rb \
440
              src/image_mad/one_image"
441

    
442
#-------------------------------------------------------------------------------
443
# VMM SH Driver KVM scripts, to be installed under $REMOTES_LOCATION/vmm/kvm
444
#-------------------------------------------------------------------------------
445

    
446
VMM_SSH_KVM_SCRIPTS="src/vmm_mad/remotes/kvm/cancel \
447
                    src/vmm_mad/remotes/kvm/deploy \
448
                    src/vmm_mad/remotes/kvm/kvmrc \
449
                    src/vmm_mad/remotes/kvm/migrate \
450
                    src/vmm_mad/remotes/kvm/restore \
451
                    src/vmm_mad/remotes/kvm/save \
452
                    src/vmm_mad/remotes/kvm/shutdown"
453

    
454
#-------------------------------------------------------------------------------
455
# VMM SH Driver Xen scripts, to be installed under $REMOTES_LOCATION/vmm/xen
456
#-------------------------------------------------------------------------------
457

    
458
VMM_SSH_XEN_SCRIPTS="src/vmm_mad/remotes/xen/cancel \
459
                    src/vmm_mad/remotes/xen/deploy \
460
                    src/vmm_mad/remotes/xen/xenrc \
461
                    src/vmm_mad/remotes/xen/migrate \
462
                    src/vmm_mad/remotes/xen/restore \
463
                    src/vmm_mad/remotes/xen/save \
464
                    src/vmm_mad/remotes/xen/shutdown"
465

    
466
#-----------------------------------------------------------------------------
467
# VMM SH Driver xen/kvm scripts, to be installed under $REMOTES_LOCATION/vmm/*
468
#-----------------------------------------------------------------------------
469

    
470
VMM_SSH_XEN_KVM_POLL="src/vmm_mad/remotes/poll_xen_kvm.rb"
471
VMM_SSH_GANGLIA_POLL="src/vmm_mad/remotes/poll_ganglia.rb"
472

    
473
#-------------------------------------------------------------------------------
474
# Information Manager Probes, to be installed under $LIB_LOCATION/remotes
475
#-------------------------------------------------------------------------------
476

    
477
IM_PROBES_FILES="src/im_mad/remotes/run_probes"
478

    
479
IM_PROBES_XEN_FILES="src/im_mad/remotes/xen.d/xen.rb \
480
                    src/im_mad/remotes/xen.d/architecture.sh \
481
                    src/im_mad/remotes/xen.d/cpu.sh \
482
                    src/im_mad/remotes/xen.d/name.sh"
483

    
484
IM_PROBES_KVM_FILES="src/im_mad/remotes/kvm.d/kvm.rb \
485
                    src/im_mad/remotes/kvm.d/architecture.sh \
486
                    src/im_mad/remotes/kvm.d/cpu.sh \
487
                    src/im_mad/remotes/kvm.d/name.sh"
488

    
489
IM_PROBES_GANGLIA_FILES="src/im_mad/remotes/ganglia.d/ganglia_probe"
490

    
491

    
492
#-------------------------------------------------------------------------------
493
# Transfer Manager commands, to be installed under $LIB_LOCATION/tm_commands
494
#   - NFS TM, $LIB_LOCATION/tm_commands/nfs
495
#   - SSH TM, $LIB_LOCATION/tm_commands/ssh
496
#   - dummy TM, $LIB_LOCATION/tm_commands/dummy
497
#   - LVM TM, $LIB_LOCATION/tm_commands/lvm
498
#-------------------------------------------------------------------------------
499

    
500
NFS_TM_COMMANDS_LIB_FILES="src/tm_mad/nfs/tm_clone.sh \
501
                           src/tm_mad/nfs/tm_delete.sh \
502
                           src/tm_mad/nfs/tm_ln.sh \
503
                           src/tm_mad/nfs/tm_mkswap.sh \
504
                           src/tm_mad/nfs/tm_mkimage.sh \
505
                           src/tm_mad/nfs/tm_mv.sh \
506
                           src/tm_mad/nfs/tm_context.sh"
507

    
508
SSH_TM_COMMANDS_LIB_FILES="src/tm_mad/ssh/tm_clone.sh \
509
                           src/tm_mad/ssh/tm_delete.sh \
510
                           src/tm_mad/ssh/tm_ln.sh \
511
                           src/tm_mad/ssh/tm_mkswap.sh \
512
                           src/tm_mad/ssh/tm_mkimage.sh \
513
                           src/tm_mad/ssh/tm_mv.sh \
514
                           src/tm_mad/ssh/tm_context.sh"
515

    
516
DUMMY_TM_COMMANDS_LIB_FILES="src/tm_mad/dummy/tm_dummy.sh"
517

    
518
LVM_TM_COMMANDS_LIB_FILES="src/tm_mad/lvm/tm_clone.sh \
519
                           src/tm_mad/lvm/tm_delete.sh \
520
                           src/tm_mad/lvm/tm_ln.sh \
521
                           src/tm_mad/lvm/tm_mkswap.sh \
522
                           src/tm_mad/lvm/tm_mkimage.sh \
523
                           src/tm_mad/lvm/tm_mv.sh \
524
                           src/tm_mad/lvm/tm_context.sh"
525

    
526
#-------------------------------------------------------------------------------
527
# Image Repository drivers, to be installed under $REMOTES_LOCTION/image
528
#   - FS based Image Repository, $REMOTES_LOCATION/image/fs
529
#-------------------------------------------------------------------------------
530
IMAGE_DRIVER_FS_SCRIPTS="src/image_mad/remotes/fs/cp \
531
                         src/image_mad/remotes/fs/mkfs \
532
                         src/image_mad/remotes/fs/mv \
533
                         src/image_mad/remotes/fs/fsrc \
534
                         src/image_mad/remotes/fs/rm"
535

    
536
#-------------------------------------------------------------------------------
537
# Migration scripts for onedb command, to be installed under $LIB_LOCATION
538
#-------------------------------------------------------------------------------
539
ONEDB_MIGRATOR_FILES="src/onedb/1.rb"
540

    
541
#-------------------------------------------------------------------------------
542
# Configuration files for OpenNebula, to be installed under $ETC_LOCATION
543
#-------------------------------------------------------------------------------
544

    
545
ETC_FILES="share/etc/oned.conf \
546
           share/etc/defaultrc"
547

    
548
#-------------------------------------------------------------------------------
549
# Virtualization drivers config. files, to be installed under $ETC_LOCATION
550
#   - ec2, $ETC_LOCATION/vmm_ec2
551
#   - sh, $ETC_LOCATION/vmm_sh
552
#   - ssh, $ETC_LOCATION/vmm_ssh
553
#-------------------------------------------------------------------------------
554

    
555
VMM_EC2_ETC_FILES="src/vmm_mad/ec2/vmm_ec2rc \
556
                   src/vmm_mad/ec2/vmm_ec2.conf"
557

    
558
VMM_SSH_ETC_FILES="src/vmm_mad/ssh/vmm_sshrc \
559
                  src/vmm_mad/ssh/vmm_ssh_kvm.conf \
560
                  src/vmm_mad/ssh/vmm_ssh_xen.conf"
561

    
562
VMM_SH_ETC_FILES="src/vmm_mad/sh/vmm_shrc"
563

    
564
#-------------------------------------------------------------------------------
565
# Information drivers config. files, to be installed under $ETC_LOCATION
566
#   - ec2, $ETC_LOCATION/im_ec2
567
#-------------------------------------------------------------------------------
568

    
569
IM_EC2_ETC_FILES="src/im_mad/ec2/im_ec2rc \
570
                  src/im_mad/ec2/im_ec2.conf"
571

    
572
#-------------------------------------------------------------------------------
573
# Storage drivers config. files, to be installed under $ETC_LOCATION
574
#   - nfs, $ETC_LOCATION/tm_nfs
575
#   - ssh, $ETC_LOCATION/tm_ssh
576
#   - dummy, $ETC_LOCATION/tm_dummy
577
#   - lvm, $ETC_LOCATION/tm_lvm
578
#-------------------------------------------------------------------------------
579

    
580
TM_NFS_ETC_FILES="src/tm_mad/nfs/tm_nfs.conf \
581
                  src/tm_mad/nfs/tm_nfsrc"
582

    
583
TM_SSH_ETC_FILES="src/tm_mad/ssh/tm_ssh.conf \
584
                  src/tm_mad/ssh/tm_sshrc"
585

    
586
TM_DUMMY_ETC_FILES="src/tm_mad/dummy/tm_dummy.conf \
587
                    src/tm_mad/dummy/tm_dummyrc"
588

    
589
TM_LVM_ETC_FILES="src/tm_mad/lvm/tm_lvm.conf \
590
                  src/tm_mad/lvm/tm_lvmrc"
591

    
592
#-------------------------------------------------------------------------------
593
# Hook Manager driver config. files, to be installed under $ETC_LOCATION/hm
594
#-------------------------------------------------------------------------------
595

    
596
HM_ETC_FILES="src/hm_mad/hmrc"
597

    
598
#-------------------------------------------------------------------------------
599
# Hook Manager driver config. files, to be installed under $ETC_LOCATION/hm
600
#-------------------------------------------------------------------------------
601

    
602
AUTH_ETC_FILES="src/authm_mad/auth_mad \
603
                src/authm_mad/auth.conf"
604

    
605
#-------------------------------------------------------------------------------
606
# Sample files, to be installed under $SHARE_LOCATION/examples
607
#-------------------------------------------------------------------------------
608

    
609
EXAMPLE_SHARE_FILES="share/examples/vm.template \
610
                     share/examples/private.net \
611
                     share/examples/public.net"
612

    
613
#-------------------------------------------------------------------------------
614
# TM Sample files, to be installed under $SHARE_LOCATION/examples/tm
615
#-------------------------------------------------------------------------------
616

    
617
TM_EXAMPLE_SHARE_FILES="share/examples/tm/tm_clone.sh \
618
                        share/examples/tm/tm_delete.sh \
619
                        share/examples/tm/tm_ln.sh \
620
                        share/examples/tm/tm_mkimage.sh \
621
                        share/examples/tm/tm_mkswap.sh \
622
                        share/examples/tm/tm_mv.sh"
623

    
624
#-------------------------------------------------------------------------------
625
# HOOK scripts, to be installed under $SHARE_LOCATION/hooks
626
#-------------------------------------------------------------------------------
627

    
628
HOOK_SHARE_FILES="share/hooks/ebtables-xen \
629
                  share/hooks/ebtables-kvm \
630
                  share/hooks/ebtables-flush \
631
                  share/hooks/host_error.rb \
632
                  share/hooks/image.rb"
633

    
634
INSTALL_NOVNC_SHARE_FILE="share/install_novnc.sh"
635

    
636
#-------------------------------------------------------------------------------
637
# Common Cloud Files
638
#-------------------------------------------------------------------------------
639

    
640
COMMON_CLOUD_LIB_FILES="src/cloud/common/CloudServer.rb \
641
                        src/cloud/common/CloudClient.rb \
642
                        src/cloud/common/Configuration.rb"
643

    
644
COMMON_CLOUD_CLIENT_LIB_FILES="src/cloud/common/CloudClient.rb"
645

    
646
#-------------------------------------------------------------------------------
647
# EC2 Query for OpenNebula
648
#-------------------------------------------------------------------------------
649

    
650
ECO_LIB_FILES="src/cloud/ec2/lib/EC2QueryClient.rb \
651
               src/cloud/ec2/lib/EC2QueryServer.rb \
652
               src/cloud/ec2/lib/ImageEC2.rb \
653
               src/cloud/ec2/lib/econe-server.rb"
654

    
655
ECO_LIB_CLIENT_FILES="src/cloud/ec2/lib/EC2QueryClient.rb"
656

    
657
ECO_LIB_VIEW_FILES="src/cloud/ec2/lib/views/describe_images.erb \
658
                    src/cloud/ec2/lib/views/describe_instances.erb \
659
                    src/cloud/ec2/lib/views/register_image.erb \
660
                    src/cloud/ec2/lib/views/run_instances.erb \
661
                    src/cloud/ec2/lib/views/terminate_instances.erb"
662

    
663
ECO_BIN_FILES="src/cloud/ec2/bin/econe-server \
664
               src/cloud/ec2/bin/econe-describe-images \
665
               src/cloud/ec2/bin/econe-describe-instances \
666
               src/cloud/ec2/bin/econe-register \
667
               src/cloud/ec2/bin/econe-run-instances \
668
               src/cloud/ec2/bin/econe-terminate-instances \
669
               src/cloud/ec2/bin/econe-upload"
670

    
671
ECO_BIN_CLIENT_FILES="src/cloud/ec2/bin/econe-describe-images \
672
               src/cloud/ec2/bin/econe-describe-instances \
673
               src/cloud/ec2/bin/econe-register \
674
               src/cloud/ec2/bin/econe-run-instances \
675
               src/cloud/ec2/bin/econe-terminate-instances \
676
               src/cloud/ec2/bin/econe-upload"
677

    
678
ECO_ETC_FILES="src/cloud/ec2/etc/econe.conf"
679

    
680
ECO_ETC_TEMPLATE_FILES="src/cloud/ec2/etc/templates/m1.small.erb"
681

    
682
#-----------------------------------------------------------------------------
683
# OCCI files
684
#-----------------------------------------------------------------------------
685

    
686
OCCI_LIB_FILES="src/cloud/occi/lib/OCCIServer.rb \
687
                src/cloud/occi/lib/occi-server.rb \
688
                src/cloud/occi/lib/OCCIClient.rb \
689
                src/cloud/occi/lib/VirtualMachineOCCI.rb \
690
                src/cloud/occi/lib/VirtualMachinePoolOCCI.rb \
691
                src/cloud/occi/lib/VirtualNetworkOCCI.rb \
692
                src/cloud/occi/lib/VirtualNetworkPoolOCCI.rb \
693
                src/cloud/occi/lib/ImageOCCI.rb \
694
                src/cloud/occi/lib/ImagePoolOCCI.rb"
695

    
696
OCCI_LIB_CLIENT_FILES="src/cloud/occi/lib/OCCIClient.rb"
697

    
698
OCCI_BIN_FILES="src/cloud/occi/bin/occi-server \
699
               src/cloud/occi/bin/occi-compute \
700
               src/cloud/occi/bin/occi-network \
701
               src/cloud/occi/bin/occi-storage"
702

    
703
OCCI_BIN_CLIENT_FILES="src/cloud/occi/bin/occi-compute \
704
               src/cloud/occi/bin/occi-network \
705
               src/cloud/occi/bin/occi-storage"
706

    
707
OCCI_ETC_FILES="src/cloud/occi/etc/occi-server.conf"
708

    
709
OCCI_ETC_TEMPLATE_FILES="src/cloud/occi/etc/templates/common.erb \
710
                    src/cloud/occi/etc/templates/custom.erb \
711
                    src/cloud/occi/etc/templates/small.erb \
712
                    src/cloud/occi/etc/templates/medium.erb \
713
                    src/cloud/occi/etc/templates/large.erb"
714

    
715
#-----------------------------------------------------------------------------
716
# CLI files
717
#-----------------------------------------------------------------------------
718

    
719
CLI_LIB_FILES="src/mad/ruby/CommandManager.rb \
720
               src/cli/client_utilities.rb \
721
               src/cli/command_parse.rb \
722
               src/oca/ruby/OpenNebula.rb"
723

    
724
CLI_BIN_FILES="src/cli/onevm \
725
               src/cli/onehost \
726
               src/cli/onevnet \
727
               src/cli/oneuser \
728
               src/cli/oneimage \
729
               src/cli/onecluster \
730
               src/cli/onetemplate"
731

    
732
#-----------------------------------------------------------------------------
733
# Sunstone files
734
#-----------------------------------------------------------------------------
735

    
736
SUNSTONE_FILES="src/sunstone/config.ru \
737
                src/sunstone/sunstone-server.rb"
738

    
739
SUNSTONE_BIN_FILES="src/sunstone/bin/sunstone-server"
740

    
741
SUNSTONE_ETC_FILES="src/sunstone/etc/sunstone-server.conf"
742

    
743
SUNSTONE_MODELS_FILES="src/sunstone/models/OpenNebulaJSON.rb \
744
                       src/sunstone/models/SunstoneServer.rb"
745

    
746
SUNSTONE_MODELS_JSON_FILES="src/sunstone/models/OpenNebulaJSON/ClusterJSON.rb \
747
                    src/sunstone/models/OpenNebulaJSON/HostJSON.rb \
748
                    src/sunstone/models/OpenNebulaJSON/ImageJSON.rb \
749
                    src/sunstone/models/OpenNebulaJSON/JSONUtils.rb \
750
                    src/sunstone/models/OpenNebulaJSON/PoolJSON.rb \
751
                    src/sunstone/models/OpenNebulaJSON/UserJSON.rb \
752
                    src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb \
753
                    src/sunstone/models/OpenNebulaJSON/TemplateJSON.rb \
754
                    src/sunstone/models/OpenNebulaJSON/VirtualNetworkJSON.rb"
755

    
756
SUNSTONE_TEMPLATE_FILES="src/sunstone/templates/index.html \
757
                         src/sunstone/templates/login.html"
758

    
759
SUNSTONE_PUBLIC_JS_FILES="src/sunstone/public/js/layout.js \
760
                        src/sunstone/public/js/login.js \
761
                        src/sunstone/public/js/sunstone.js \
762
                        src/sunstone/public/js/sunstone-util.js \
763
                        src/sunstone/public/js/opennebula.js"
764

    
765
SUNSTONE_PUBLIC_JS_PLUGINS_FILES="\
766
                            src/sunstone/public/js/plugins/dashboard-tab.js \
767
                            src/sunstone/public/js/plugins/hosts-tab.js \
768
                            src/sunstone/public/js/plugins/images-tab.js \
769
                            src/sunstone/public/js/plugins/templates-tab.js \
770
                            src/sunstone/public/js/plugins/users-tab.js \
771
                            src/sunstone/public/js/plugins/vms-tab.js \
772
                            src/sunstone/public/js/plugins/vnets-tab.js"
773

    
774
SUNSTONE_PUBLIC_CSS_FILES="src/sunstone/public/css/application.css \
775
                           src/sunstone/public/css/layout.css \
776
                           src/sunstone/public/css/login.css"
777

    
778
SUNSTONE_PUBLIC_VENDOR_DATATABLES="\
779
                src/sunstone/public/vendor/dataTables/jquery.dataTables.min.js \
780
                src/sunstone/public/vendor/dataTables/demo_table_jui.css \
781
                src/sunstone/public/vendor/dataTables/BSD-LICENSE.txt \
782
                src/sunstone/public/vendor/dataTables/NOTICE"
783

    
784
SUNSTONE_PUBLIC_VENDOR_JGROWL="\
785
                src/sunstone/public/vendor/jGrowl/jquery.jgrowl_minimized.js \
786
                src/sunstone/public/vendor/jGrowl/jquery.jgrowl.css \
787
                src/sunstone/public/vendor/jGrowl/NOTICE"
788

    
789
SUNSTONE_PUBLIC_VENDOR_JQUERY="\
790
                        src/sunstone/public/vendor/jQuery/jquery-1.4.4.min.js \
791
                        src/sunstone/public/vendor/jQuery/MIT-LICENSE.txt \
792
                        src/sunstone/public/vendor/jQuery/NOTICE"
793

    
794
SUNSTONE_PUBLIC_VENDOR_JQUERYUI="\
795
src/sunstone/public/vendor/jQueryUI/ui-bg_glass_75_dadada_1x400.png \
796
src/sunstone/public/vendor/jQueryUI/ui-icons_cd0a0a_256x240.png \
797
src/sunstone/public/vendor/jQueryUI/jquery-ui-1.8.7.custom.css \
798
src/sunstone/public/vendor/jQueryUI/ui-bg_flat_0_aaaaaa_40x100.png \
799
src/sunstone/public/vendor/jQueryUI/ui-bg_flat_0_8f9392_40x100.png \
800
src/sunstone/public/vendor/jQueryUI/MIT-LICENSE.txt \
801
src/sunstone/public/vendor/jQueryUI/jquery-ui-1.8.7.custom.min.js \
802
src/sunstone/public/vendor/jQueryUI/ui-bg_highlight-soft_75_cccccc_1x100.png \
803
src/sunstone/public/vendor/jQueryUI/ui-bg_glass_95_fef1ec_1x400.png \
804
src/sunstone/public/vendor/jQueryUI/ui-bg_glass_55_fbf9ee_1x400.png \
805
src/sunstone/public/vendor/jQueryUI/ui-icons_888888_256x240.png \
806
src/sunstone/public/vendor/jQueryUI/ui-bg_glass_75_e6e6e6_1x400.png \
807
src/sunstone/public/vendor/jQueryUI/ui-bg_flat_0_575c5b_40x100.png \
808
src/sunstone/public/vendor/jQueryUI/ui-bg_glass_65_ffffff_1x400.png \
809
src/sunstone/public/vendor/jQueryUI/ui-bg_flat_75_ffffff_40x100.png \
810
src/sunstone/public/vendor/jQueryUI/ui-icons_2e83ff_256x240.png \
811
src/sunstone/public/vendor/jQueryUI/ui-icons_454545_256x240.png \
812
src/sunstone/public/vendor/jQueryUI/NOTICE \
813
src/sunstone/public/vendor/jQueryUI/ui-icons_222222_256x240.png \
814
"
815
SUNSTONE_PUBLIC_VENDOR_JQUERYLAYOUT="\
816
            src/sunstone/public/vendor/jQueryLayout/layout-default-latest.css \
817
            src/sunstone/public/vendor/jQueryLayout/jquery.layout.min-1.2.0.js \
818
            src/sunstone/public/vendor/jQueryLayout/NOTICE"
819

    
820
SUNSTONE_PUBLIC_IMAGES_FILES="src/sunstone/public/images/ajax-loader.gif \
821
                        src/sunstone/public/images/login_over.png \
822
                        src/sunstone/public/images/login.png \
823
                        src/sunstone/public/images/opennebula-sunstone-big.png \
824
                        src/sunstone/public/images/opennebula-sunstone-small.png \
825
                        src/sunstone/public/images/panel.png \
826
                        src/sunstone/public/images/pbar.gif \
827
                        src/sunstone/public/images/Refresh-icon.png \
828
                        src/sunstone/public/images/vnc_off.png \
829
                        src/sunstone/public/images/vnc_on.png"
830

    
831
SUNSTONE_RUBY_LIB_FILES="src/mad/ruby/CommandManager.rb \
832
                         src/oca/ruby/OpenNebula.rb"
833

    
834
#-----------------------------------------------------------------------------
835
# MAN files
836
#-----------------------------------------------------------------------------
837

    
838
MAN_FILES="share/man/oneauth.8.gz \
839
        share/man/onecluster.8.gz \
840
        share/man/onehost.8.gz \
841
        share/man/oneimage.8.gz \
842
        share/man/oneuser.8.gz \
843
        share/man/onevm.8.gz \
844
        share/man/onevnet.8.gz \
845
        share/man/onetemplate.8.gz \
846
        share/man/onedb.8.gz \
847
        share/man/econe-describe-images.8.gz \
848
        share/man/econe-describe-instances.8.gz \
849
        share/man/econe-register.8.gz \
850
        share/man/econe-run-instances.8.gz \
851
        share/man/econe-terminate-instances.8.gz \
852
        share/man/econe-upload.8.gz \
853
        share/man/occi-compute.8.gz \
854
        share/man/occi-network.8.gz \
855
        share/man/occi-storage.8.gz"
856

    
857
#-----------------------------------------------------------------------------
858
#-----------------------------------------------------------------------------
859
# INSTALL.SH SCRIPT
860
#-----------------------------------------------------------------------------
861
#-----------------------------------------------------------------------------
862

    
863
# --- Create OpenNebula directories ---
864

    
865
if [ "$UNINSTALL" = "no" ] ; then
866
    for d in $MAKE_DIRS; do
867
        mkdir -p $DESTDIR$d
868
    done
869
fi
870

    
871
# --- Install/Uninstall files ---
872

    
873
do_file() {
874
    if [ "$UNINSTALL" = "yes" ]; then
875
        rm $2/`basename $1`
876
    else
877
        if [ "$LINK" = "yes" ]; then
878
            ln -s $SRC_DIR/$1 $DESTDIR$2
879
        else
880
            cp $SRC_DIR/$1 $DESTDIR$2
881
        fi
882
    fi
883
}
884

    
885

    
886
if [ "$CLIENT" = "yes" ]; then
887
    INSTALL_SET=${INSTALL_CLIENT_FILES[@]}
888
elif [ "$SUNSTONE" = "yes" ]; then
889
    INSTALL_SET="${INSTALL_SUNSTONE_RUBY_FILES[@]} ${INSTALL_SUNSTONE_FILES[@]}"
890
else
891
    INSTALL_SET="${INSTALL_FILES[@]} ${INSTALL_SUNSTONE_FILES[@]}"
892
fi
893

    
894
for i in ${INSTALL_SET[@]}; do
895
    SRC=$`echo $i | cut -d: -f1`
896
    DST=`echo $i | cut -d: -f2`
897

    
898
    eval SRC_FILES=$SRC
899

    
900
    for f in $SRC_FILES; do
901
        do_file $f $DST
902
    done
903
done
904

    
905
if [ "$INSTALL_ETC" = "yes" ] ; then
906
    for i in ${INSTALL_ETC_FILES[@]}; do
907
        SRC=$`echo $i | cut -d: -f1`
908
        DST=`echo $i | cut -d: -f2`
909

    
910
        eval SRC_FILES=$SRC
911

    
912
        OLD_LINK=$LINK
913
        LINK="no"
914

    
915
        for f in $SRC_FILES; do
916
            do_file $f $DST
917
        done
918

    
919
        LINK=$OLD_LINK
920
   done
921
fi
922

    
923
# --- Set ownership or remove OpenNebula directories ---
924

    
925
if [ "$UNINSTALL" = "no" ] ; then
926
    for d in $CHOWN_DIRS; do
927
        chown -R $ONEADMIN_USER:$ONEADMIN_GROUP $DESTDIR$d
928
    done
929

    
930
    # --- Set correct permissions for Image Repository ---
931

    
932
    if [ -d "$DESTDIR$IMAGES_LOCATION" ]; then
933
        chmod 3770 $DESTDIR$IMAGES_LOCATION
934
    fi
935
else
936
    for d in `echo $DELETE_DIRS | awk '{for (i=NF;i>=1;i--) printf $i" "}'`; do
937
        rmdir $d
938
    done
939
fi