use profile configuration directory

get profile configuration from file(s) in directory (instead of from one file
only), assume there is a file "default.sh" which is sourced in deployment.sh
+ minimal example profile setting for my SPPRO/CE VMs
ksolomko/vlan
Erhard Rank 14 years ago
parent 61afe42710
commit 3bf3f74522

@ -291,11 +291,11 @@ fi
# load site specific profile if specified
if [ -n "$PROFILE" ] && [ -n "$NETSCRIPT_SERVER" ] ; then
getconfig() {
wget --timeout=10 --dns-timeout=10 --connect-timeout=10 --tries=1 \
--read-timeout=10 ${NETSCRIPT_SERVER}/$PROFILE -O ${PROFILE} && return 0 || return 1
wget -r --no-parent --timeout=10 --dns-timeout=10 --connect-timeout=10 --tries=1 \
--read-timeout=10 ${NETSCRIPT_SERVER}/$PROFILE/ && return 0 || return 1
}
echo "Trying to get ${NETSCRIPT_SERVER}/$PROFILE"
echo "Trying to get ${NETSCRIPT_SERVER}/$PROFILE/*"
counter=10
while ! getconfig && [[ "$counter" != 0 ]] ; do
echo -n "Sleeping for 1 second and trying to get config again... "
@ -303,11 +303,21 @@ if [ -n "$PROFILE" ] && [ -n "$NETSCRIPT_SERVER" ] ; then
echo "$counter tries left" ; sleep 1
done
if [ -s "$PROFILE" ] ; then
echo "Loading profile $PROFILE"
. $PROFILE
DOWNLOADDIR=$(echo ${NETSCRIPT_SERVER}/$PROFILE | sed 's|^http://||')
echo $DOWNLOADDIR
if [ -d "$DOWNLOADDIR" ] ; then
if [ -s "$DOWNLOADDIR/default.sh" ] ; then
rm -f $DOWNLOADDIR/index.html*
mv $DOWNLOADDIR/* ./
rmdir -p $DOWNLOADDIR
echo "Loading profile $PROFILE"
. default.sh
else
echo "Error: No default.sh in profile $PROFILE from $NETSCRIPT_SERVER" >&2
exit 1
fi
else
echo "Error: Could not get profile file $PROFILE from $NETSCRIPT_SERVER" >&2
echo "Error: Could not get profile $PROFILE from $NETSCRIPT_SERVER" >&2
exit 1
fi
fi

@ -0,0 +1,27 @@
# example profile
#
# profiles contain deployment site specific configurations
# this one is for erank's VMs
# SP_VERSION=2.3
# INSTALLER_VERSION=0.5.3
# internal IP addresses of sp1/sp2 (on eth1)
IP1=192.168.51.133
IP2=192.168.51.134
# INTERNAL_NETMASK=192.168.255.248 # TODO: has to be enabled in deployment.sh
if "$PRO_EDITION" ; then
case "$ROLE" in
sp1) EADDR=77.244.249.112 ; # external IP address of sp1
EIFACE=eth0 ;; # on interface ...
sp2) EADDR=77.244.249.113 ; # external IP address of sp2
EIFACE=eth0 ;; # on interface ...
esac
MCASTADDR=226.94.1.1 ; # multicast address
else
EADDR=77.244.249.109 ; # external IP address of ce server
EIFACE=eth0 ; # on interface ...
fi
Loading…
Cancel
Save