#!/bin/bash # Copyright (C) 2011 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. set -e set -o errtrace . @osdir@/common.sh DEFAULT_FILE="@sysconfdir@/default/snf-image-update-helper" if [ -f "$DEFAULT_FILE" ]; then . "$DEFAULT_FILE" fi : ${HELPER_URL:="@HELPER_URL@"} usage() { local rc="$1" cat <&1 <&2 echo "Downloading helper image from $HELPER_URL ..." >&2 $CURL -O -L -f "$HELPER_URL" add_cleanup rm -f "$IMAGE_DIR/$IMAGE" cd "$HELPER_DIR" echo >&2 echo "Extracting helper image under \`$HELPER_DIR':" >&2 tar -xvf "$IMAGE_DIR/$IMAGE" if [ "x$FORCE" != "xyes" ]; then echo >&2 echo "Checking helper image version ..." >&2 if [ ! -f "$HELPER_DIR/version" ]; then log_error "File: \`$HELPER_DIR/version' is missing!" exit 1 fi helper_version="$(cat $HELPER_DIR/version)" if [ "x$SNF_IMAGE_VERSION" != "x$helper_version" ]; then log_error "snf-image version (=$SNF_IMAGE_VERSION) and " \ "helper image version (=$helper_version) don't match!" log_error "Use \`-f' to bypass the version check." exit 1 fi fi echo >&2 echo "Helper image was installed successfully!" >&2 exit 0 # vim: set sta sts=4 shiftwidth=4 sw=4 et ai :