Revision 29f35803 snf-image-host/snf-image-update-helper.in

b/snf-image-host/snf-image-update-helper.in
48 48

  
49 49
    -y Assume Yes to all queries and do not prompt
50 50

  
51
    -f Force the installation even if the snf-image and helper versions don't match
52

  
51 53
EOF
52 54

  
53 55
    exit "$rc"
54 56
}
55 57

  
56
while getopts "hu:y" opt; do
58
while getopts "hu:yf" opt; do
57 59
    case $opt in
58 60
        h) usage 0
59 61
            ;;
......
61 63
            ;;
62 64
        y) NO_PROMPT="yes"
63 65
            ;;
66
        f) FORCE="yes"
67
            ;;
64 68
        ?) log_error "User \`-h' for help"; exit 1
65 69
            ;;
66 70
    esac
......
74 78
  \`$HELPER_DIR/kernel'
75 79
  \`$HELPER_DIR/image'
76 80
  \`$HELPER_DIR/packages'
81
  \`$HELPER_DIR/version'
77 82
EOF
78 83

  
79 84
while [[ 1 ]]; do
......
108 113
echo "Extracting helper image under \`$HELPER_DIR':" >&2
109 114
tar -xvf "$IMAGE_DIR/$IMAGE"
110 115

  
116
if [ "x$FORCE" != "xyes" ]; then
117
    echo >&2
118
    echo "Checking helper image version ..." >&2
119
    if [ ! -f "$HELPER_DIR/version" ]; then
120
        log_error "File: \`$HELPER_DIR/version' is missing!"
121
        exit 1
122
    fi
123
    helper_version="$(cat $HELPER_DIR/version)"
124
    if [ "x$SNF_IMAGE_VERSION" != "x$helper_version" ]; then
125
        log_error "snf-image version (=$SNF_IMAGE_VERSION) and " \
126
            "helper image version (=$helper_version) don't match!"
127
        log_error "Use \`-f' to bypass the version check."
128
        exit 1
129
    fi
130
fi
131

  
111 132
echo >&2
112 133
echo "Helper image was installed successfully!" >&2
113 134
exit 0

Also available in: Unified diff