Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Commit

Permalink
feature #3651: Add support for start script in context
Browse files Browse the repository at this point in the history
If START_SCRIPT_BASE64 or START_SCRIPT is found in the context it is saved
to a temporary file and executed.

For OpenNebula ticket: http://dev.opennebula.org/issues/3651
  • Loading branch information
jfontan committed May 14, 2015
1 parent d54cad7 commit 5b4d39f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions base/etc/one-context.d/99-start-script
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

MOUNT_DIR=/mnt
TMP_DIR=/tmp/one-context-tmp
TMP_FILE=$TMP_DIR/one-start-script
START_SCRIPT_AVAILABLE=no

mkdir -p $TMP_DIR

if [ -n "$START_SCRIPT_BASE64" ]; then
echo -en "$START_SCRIPT_BASE64" | openssl enc -d -base64 -A > $TMP_FILE
START_SCRIPT_AVAILABLE=yes
elif [ -n "$START_SCRIPT" ]; then
echo -en "$START_SCRIPT" > $TMP_FILE
START_SCRIPT_AVAILABLE=yes
fi

if [ "$START_SCRIPT_AVAILABLE" = "yes" ]; then
cd $MOUNT_DIR
chmod +x $TMP_FILE

$TMP_FILE
fi

0 comments on commit 5b4d39f

Please sign in to comment.