Commit 348c654a authored by Vangelis Koukis's avatar Vangelis Koukis
Browse files

Merge branch 'master' into debian

parents d41b5e40 78e9f209
#!/bin/bash
# Copyright 2011 GRNET S.A. All rights reserved.
# Copyright (C) 2011 GRNET S.A.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 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.
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 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.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of GRNET S.A.
# 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.
. @commondir@/common.sh
......@@ -65,8 +53,6 @@ if [ -n "$SNF_IMAGE_PROPERTIES" ]; then
echo "$SNF_IMAGE_PROPERTIES" |
"@scriptsdir@/decode-properties.py" "$properties"
source "$properties"
else
log_error "SNF_IMAGE_PROPERTIES variable is missing"
fi
# Image mount point...
......
......@@ -31,12 +31,18 @@ windows_password() {
local target="$1"
local password="$2"
echo -n "Installing new admin password..."
echo "@echo off" > "$target/Windows/SnfScripts/ChangeAdminPassword.cmd"
echo "net user Administrator $password" >> \
"$target/Windows/SnfScripts/ChangeAdminPassword.cmd"
echo done
if [ -z "$SNF_IMAGE_PROPERTY_USERS" ]; then
SNF_IMAGE_PROPERTY_USERS="Administrator"
fi
for usr in $SNF_IMAGE_PROPERTY_USERS; do
echo -n "Installing new password for user \`$usr'..."
echo "net user $usr $password" >> \
"$target/Windows/SnfScripts/ChangeAdminPassword.cmd"
echo done
done
}
linux_password() {
......@@ -86,6 +92,9 @@ if [ -z "$SNF_IMAGE_PASSWORD" ]; then
log_error "Password is missing"
fi
#trim users var
SNF_IMAGE_PROPERTY_USERS=$(echo $SNF_IMAGE_PROPERTY_USERS)
if [ "$SNF_IMAGE_PROPERTY_OSFAMILY" = "windows" ]; then
windows_password "$SNF_IMAGE_TARGET" "$SNF_IMAGE_PASSWORD"
elif [ "$SNF_IMAGE_PROPERTY_OSFAMILY" = "linux" ]; then
......
......@@ -35,6 +35,7 @@ fi
if [ -z "$SNF_IMAGE_PERSONALITY" ]; then
warn "This image has no personality (0 files to inject)"
exit 0
fi
if [ "$SNF_IMAGE_PROPERTY_OSFAMILY" = "windows" ]; then
......
......@@ -117,17 +117,15 @@ get_api20_arguments() {
log_error "Missing OS API Parameter: OSP_IMG_PASSWD"
exit 1
fi
if [ -z "$OSP_IMG_PROPERTIES" ]; then
log_error "Missing OS API Parameter: OSP_IMG_PROPERTIES"
exit 1
fi
IMG_ID=$OSP_IMG_ID
IMG_FORMAT=$OSP_IMG_FORMAT
IMG_PASSWD=$OSP_IMG_PASSWD
IMG_PROPERTIES=$OSP_IMG_PROPERTIES
if [ -n "$OSP_IMG_PROPERTIES" ]
IMG_PROPERTIES="$OSP_IMG_PROPERTIES"
fi
if [ -n "$OSP_IMG_PERSONALITY" ]; then
IMG_PERSONALITY=$OSP_IMG_PERSONALITY
IMG_PERSONALITY="$OSP_IMG_PERSONALITY"
fi
}
......
......@@ -93,7 +93,9 @@ snf_export_DEV=/dev/vda
snf_export_TYPE="$IMG_FORMAT"
snf_export_PASSWORD="$IMG_PASSWD"
snf_export_HOSTNAME="$instance"
snf_export_PROPERTIES="$IMG_PROPERTIES"
if [ -n "$IMG_PROPERTIES" ]
snf_export_PROPERTIES="$IMG_PROPERTIES"
fi
if [ -n "$IMG_PERSONALITY" ]; then
snf_export_PERSONALITY="$IMG_PERSONALITY"
fi
......
#!/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 pipefail
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment