From 97eae56e6000426dabcd5ee5645f76757d279fad Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Fri, 14 Jun 2013 12:09:09 +0200 Subject: [PATCH] bug #2128: datastore file scripts are not executed in context init scripts execution is moved to an external one-context.d script. Now there is a new context variable (INIT_SCRIPTS) with the list of files to execute from context. --- .../base/etc/init.d/vmcontext | 3 --- .../base/etc/one-context.d/99-execute-scripts | 20 +++++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100755 share/scripts/context-packages/base/etc/one-context.d/99-execute-scripts diff --git a/share/scripts/context-packages/base/etc/init.d/vmcontext b/share/scripts/context-packages/base/etc/init.d/vmcontext index b05cf93d5d..f4e836368a 100755 --- a/share/scripts/context-packages/base/etc/init.d/vmcontext +++ b/share/scripts/context-packages/base/etc/init.d/vmcontext @@ -60,9 +60,6 @@ if [ -e "$CDROM_DEVICE" ]; then execute_scripts - if [ -f /mnt/init.sh ]; then - /mnt/init.sh - fi umount /mnt else execute_scripts diff --git a/share/scripts/context-packages/base/etc/one-context.d/99-execute-scripts b/share/scripts/context-packages/base/etc/one-context.d/99-execute-scripts new file mode 100755 index 0000000000..06e071c38c --- /dev/null +++ b/share/scripts/context-packages/base/etc/one-context.d/99-execute-scripts @@ -0,0 +1,20 @@ +#!/bin/bash + +MOUNT_DIR=/mnt +TMP_DIR=/tmp/one-context-tmp + +if [ -z "$INIT_SCRIPTS" ]; then + if [ -f "$MOUNT_DIR/init.sh" ]; then + INIT_SCRIPTS=init.sh + fi +fi + +mkdir -p $TMP_DIR +cd $MOUNT_DIR + +for f in $INIT_SCRIPTS; do + cp $f $TMP_DIR + chmod +x $TMP_DIR/$f + $TMP_DIR/$f +done +