|
|
@ -32,7 +32,7 @@ function export_rc_vars
|
|
|
|
function execute_scripts {
|
|
|
|
function execute_scripts {
|
|
|
|
SCRIPTS_DIR="/etc/one-context.d"
|
|
|
|
SCRIPTS_DIR="/etc/one-context.d"
|
|
|
|
for script in $SCRIPTS_DIR/*; do
|
|
|
|
for script in $SCRIPTS_DIR/*; do
|
|
|
|
$script
|
|
|
|
"$script" "$1"
|
|
|
|
done
|
|
|
|
done
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -45,18 +45,20 @@ function start {
|
|
|
|
cp /mnt/context.sh /tmp/context.sh
|
|
|
|
cp /mnt/context.sh /tmp/context.sh
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
execute_scripts
|
|
|
|
execute_scripts "$1"
|
|
|
|
|
|
|
|
|
|
|
|
umount /mnt
|
|
|
|
umount /mnt
|
|
|
|
elif curl -o /tmp/context.sh http://169.254.169.254/latest/user-data ; then
|
|
|
|
elif curl -o /tmp/context.sh http://169.254.169.254/latest/user-data ; then
|
|
|
|
export_rc_vars /tmp/context.sh
|
|
|
|
export_rc_vars /tmp/context.sh
|
|
|
|
execute_scripts
|
|
|
|
execute_scripts "$1"
|
|
|
|
elif type vmtoolsd ; then
|
|
|
|
elif type vmtoolsd ; then
|
|
|
|
vmtoolsd --cmd 'info-get guestinfo.opennebula.context' | \
|
|
|
|
vmtoolsd --cmd 'info-get guestinfo.opennebula.context' | \
|
|
|
|
openssl base64 -d > /tmp/context.sh
|
|
|
|
openssl base64 -d > /tmp/context.sh
|
|
|
|
export_rc_vars /tmp/context.sh
|
|
|
|
export_rc_vars /tmp/context.sh
|
|
|
|
execute_scripts
|
|
|
|
execute_scripts "$1"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
start
|
|
|
|
COMMAND="$1"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
start "$COMMAND"
|
|
|
|