Statistics
| Branch: | Tag: | Revision:

root / snf-image-host / verify @ master

History | View | Annotate | Download (1.7 kB)

1 64605956 Nikos Skalkotos
#!/bin/bash
2 64605956 Nikos Skalkotos
3 9baf3e2c Nikos Skalkotos
# Copyright (C) 2012 GRNET S.A.
4 9baf3e2c Nikos Skalkotos
#
5 9baf3e2c Nikos Skalkotos
# This program is free software; you can redistribute it and/or modify
6 9baf3e2c Nikos Skalkotos
# it under the terms of the GNU General Public License as published by
7 9baf3e2c Nikos Skalkotos
# the Free Software Foundation; either version 2 of the License, or
8 9baf3e2c Nikos Skalkotos
# (at your option) any later version.
9 9baf3e2c Nikos Skalkotos
#
10 9baf3e2c Nikos Skalkotos
# This program is distributed in the hope that it will be useful, but
11 9baf3e2c Nikos Skalkotos
# WITHOUT ANY WARRANTY; without even the implied warranty of
12 9baf3e2c Nikos Skalkotos
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 9baf3e2c Nikos Skalkotos
# General Public License for more details.
14 9baf3e2c Nikos Skalkotos
#
15 9baf3e2c Nikos Skalkotos
# You should have received a copy of the GNU General Public License
16 9baf3e2c Nikos Skalkotos
# along with this program; if not, write to the Free Software
17 9baf3e2c Nikos Skalkotos
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 9baf3e2c Nikos Skalkotos
# 02110-1301, USA.
19 9baf3e2c Nikos Skalkotos
20 7a7a6bd3 Constantinos Venetsanopoulos
set -e
21 7a7a6bd3 Constantinos Venetsanopoulos
22 7a7a6bd3 Constantinos Venetsanopoulos
. common.sh
23 7a7a6bd3 Constantinos Venetsanopoulos
24 7a7a6bd3 Constantinos Venetsanopoulos
25 3707aa73 Nikos Skalkotos
check_required() {
26 3707aa73 Nikos Skalkotos
    local required_params="IMG_ID IMG_FORMAT IMG_PASSWD"
27 3707aa73 Nikos Skalkotos
    local osparams="$required_params IMG_PROPERTIES IMG_PERSONALITY CONFIG_URL"
28 7a7a6bd3 Constantinos Venetsanopoulos
29 3707aa73 Nikos Skalkotos
    # Store OSP_VAR in VAR
30 3707aa73 Nikos Skalkotos
    for param in $osparams; do
31 3707aa73 Nikos Skalkotos
        eval $param=\"\$OSP_$param\"
32 3707aa73 Nikos Skalkotos
    done
33 7a7a6bd3 Constantinos Venetsanopoulos
34 3707aa73 Nikos Skalkotos
    for var in $required_params; do
35 3707aa73 Nikos Skalkotos
        if [ -z "${!var}" ]; then
36 3707aa73 Nikos Skalkotos
             log_error "Missing OS API Parameter: ${var}"
37 3707aa73 Nikos Skalkotos
             exit 1
38 3707aa73 Nikos Skalkotos
        fi
39 3707aa73 Nikos Skalkotos
    done
40 7a7a6bd3 Constantinos Venetsanopoulos
41 3707aa73 Nikos Skalkotos
    case $IMG_FORMAT in
42 3707aa73 Nikos Skalkotos
        extdump|ntfsdump)
43 7a7a6bd3 Constantinos Venetsanopoulos
        ;;
44 3707aa73 Nikos Skalkotos
	diskdump)
45 7a7a6bd3 Constantinos Venetsanopoulos
        if [ -z "$IMG_PROPERTIES" ]; then
46 3707aa73 Nikos Skalkotos
            log_error "\`img_properties' parameter must be present when"
47 3707aa73 Nikos Skalkotos
            log_error "using \`diskdump' format."
48 7a7a6bd3 Constantinos Venetsanopoulos
            exit 1
49 7a7a6bd3 Constantinos Venetsanopoulos
        fi
50 7a7a6bd3 Constantinos Venetsanopoulos
        ;;
51 7a7a6bd3 Constantinos Venetsanopoulos
    *)
52 9baf3e2c Nikos Skalkotos
        log_error "Unknown Image format: \`$IMAGE_TYPE'"
53 7a7a6bd3 Constantinos Venetsanopoulos
        exit 1
54 7a7a6bd3 Constantinos Venetsanopoulos
        ;;
55 7a7a6bd3 Constantinos Venetsanopoulos
esac
56 3707aa73 Nikos Skalkotos
}
57 3707aa73 Nikos Skalkotos
58 3707aa73 Nikos Skalkotos
if [ -z "$OSP_CONFIG_URL" ]; then
59 3707aa73 Nikos Skalkotos
    check_required
60 3707aa73 Nikos Skalkotos
fi
61 7a7a6bd3 Constantinos Venetsanopoulos
62 64605956 Nikos Skalkotos
exit 0
63 3707aa73 Nikos Skalkotos
64 3707aa73 Nikos Skalkotos
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :