3 # Copyright (C) 2011 GRNET S.A.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
32 This script will download a suitable fixed snf-image-helper image and will
33 install it under $IMAGE_DIR.
39 Download URL to use for the helper image instead of $HELPER_URL
41 -y Assume Yes to all queries and do not prompt
48 while getopts "hu:y" opt; do
52 u) HELPER_URL="$OPTARG"
56 ?) log_error "User \`-h' for help"; exit 1
63 $(basename $0) will download a suitable snf-image-helper image and will install
64 it under $IMAGE_DIR. The following files will be overwritten if present:
67 \`$HELPER_DIR/initrd-xen'
68 \`$HELPER_DIR/kernel-xen'
70 \`$HELPER_DIR/packages'
74 echo -n "Do you want to continue [y/N]? "
75 if [ "x$NO_PROMPT" = "xyes" ]; then
81 [ "$(echo -n "$answer" | tr [A-Z] [a-z])" = "y" ] && break
82 if [ -z "$answer" -o "$(echo -n "$answer" | tr [A-Z] [a-z])" = "n" ]; then
88 IMAGE_DIR=$(mktemp -d)
89 add_cleanup rmdir "$IMAGE_DIR"
93 IMAGE=$(basename "$HELPER_URL")
95 echo "Downloading helper image from $HELPER_URL ..." >&2
96 $CURL -O -L -f "$HELPER_URL"
97 add_cleanup rm -f "$IMAGE_DIR/$IMAGE"
102 echo "Extracting helper image under \`$HELPER_DIR':" >&2
103 tar -xvf "$IMAGE_DIR/$IMAGE"
106 echo "Helper image was installed successfully!" >&2
109 # vim: set sta sts=4 shiftwidth=4 sw=4 et ai :