verify 1.64 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
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
set -e

. common.sh


if [ -z "$OSP_IMG_ID" ]; then
    log_error "Missing OS API Parameter: OSP_IMG_ID"
    exit 1
fi
if [ -z "$OSP_IMG_FORMAT" ]; then
    log_error "Missing OS API Parameter: OSP_IMG_FORMAT"
    exit 1
fi
if [ -z "$OSP_IMG_PASSWD" ]; then
    log_error "Missing OS API Parameter: OSP_IMG_PASSWD"
    exit 1
fi

IMG_ID=$OSP_IMG_ID
IMG_FORMAT=$OSP_IMG_FORMAT
IMG_PASSWD=$OSP_IMG_PASSWD
if [ -n "$OSP_IMG_PROPERTIES" ]; then
    IMG_PROPERTIES="$OSP_IMG_PROPERTIES"
fi
if [ -n "$OSP_IMG_PERSONALITY" ]; then
    IMG_PERSONALITY="$OSP_IMG_PERSONALITY"
fi


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

64
exit 0