verify 1.68 KB
Newer Older
1
2
#!/bin/bash

Nikos Skalkotos's avatar
Nikos Skalkotos committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Copyright (C) 2012 GRNET S.A.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.

20
21
22
23
24
set -e

. common.sh


25
check_required() {
26
27
    local required_params="IMG_ID IMG_FORMAT"
    local osparams="$required_params IMG_PASSWD IMG_PROPERTIES IMG_PERSONALITY CONFIG_URL"
28

29
30
31
32
    # Store OSP_VAR in VAR
    for param in $osparams; do
        eval $param=\"\$OSP_$param\"
    done
33

34
35
    source_variant

36
37
38
39
40
41
    for var in $required_params; do
        if [ -z "${!var}" ]; then
             log_error "Missing OS API Parameter: ${var}"
             exit 1
        fi
    done
42

43
44
    case $IMG_FORMAT in
        extdump|ntfsdump)
45
        ;;
46
	diskdump)
47
        if [ -z "$IMG_PROPERTIES" ]; then
48
49
            log_error "\`img_properties' parameter must be present when"
            log_error "using \`diskdump' format."
50
51
52
53
            exit 1
        fi
        ;;
    *)
Nikos Skalkotos's avatar
Nikos Skalkotos committed
54
        log_error "Unknown Image format: \`$IMAGE_TYPE'"
55
56
57
        exit 1
        ;;
esac
58
59
60
61
62
}

if [ -z "$OSP_CONFIG_URL" ]; then
    check_required
fi
63

64
exit 0
65
66

# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :