diff --git a/meta-arm-autonomy/documentation/xenguest-manager.md b/meta-arm-autonomy/documentation/xenguest-manager.md index 93453bfb..5a66e8a0 100644 --- a/meta-arm-autonomy/documentation/xenguest-manager.md +++ b/meta-arm-autonomy/documentation/xenguest-manager.md @@ -83,11 +83,13 @@ Inside the directory, scripts will be executed in alphabetical order. Since these scripts are sourced by xenguest-manager they can acccess functions and variables from the parent file's scope, including: -- ${guestname} : The name of the guest being created +- ${guestname} : The name of the guest being created -- ${guestdir} : The path to the guest directory +- ${guestdir} : The path to the guest directory -- ${LOGFILE} : The file to append any logging to, e.g. +- ${guestcfgfile} : The name of the config file for the starting guest + +- ${LOGFILE} : The file to append any logging to, e.g. echo "Hello, World" >> ${LOGFILE} Sourcing also allows the script to access params.cfg. diff --git a/meta-arm-autonomy/recipes-extended/xenguest/files/network-bridge.sh.in b/meta-arm-autonomy/recipes-extended/xenguest/files/network-bridge.sh.in index 42ccb703..27306e40 100755 --- a/meta-arm-autonomy/recipes-extended/xenguest/files/network-bridge.sh.in +++ b/meta-arm-autonomy/recipes-extended/xenguest/files/network-bridge.sh.in @@ -20,10 +20,10 @@ case "${XENGUEST_NETWORK_TYPE:-}" in if [ ! -f /etc/default/dhcp3-server ]; then ln -s dhcp-server /etc/default/dhcp3-server fi - echo "vif = ['script=vif-nat']" >> ${guestname}.cfg + echo "vif = ['script=vif-nat']" >> ${guestcfgfile} ;; bridge) - echo "vif = ['script=vif-bridge,bridge=${BRIDGE_NAME}']" >> ${guestname}.cfg + echo "vif = ['script=vif-bridge,bridge=${BRIDGE_NAME}']" >> ${guestcfgfile} ;; *) echo "${@}: XENGUEST_NETWORK_TYPE=$XENGUEST_NETWORK_TYPE invalid" diff --git a/meta-arm-autonomy/recipes-extended/xenguest/files/xenguest-manager b/meta-arm-autonomy/recipes-extended/xenguest/files/xenguest-manager index 4d598455..78ac55d3 100755 --- a/meta-arm-autonomy/recipes-extended/xenguest/files/xenguest-manager +++ b/meta-arm-autonomy/recipes-extended/xenguest/files/xenguest-manager @@ -465,13 +465,15 @@ function xenguest_guest_start() guestname="${1}" guestdir=${XENGUEST_CONF_BASE}/guests/${guestname} + guestcfgfile=$(mktemp -u "${guestname}.XXXXXX" --tmpdir="${guestdir}" --suffix=".cfg") + # Get guest configuration source ${guestdir}/params.cfg pushd ${guestdir} > /dev/null 2>&1 # create config by merging all configurations together - cat guest.cfg $(find guest.d -type f 2> /dev/null) > ${guestname}.cfg + cat guest.cfg $(find guest.d -type f 2> /dev/null) > ${guestcfgfile} # Build init script lists (ignore non existing dirs errors, # sort alphabetically and run global scripts first) @@ -491,7 +493,7 @@ function xenguest_guest_start() echo "( . $f )" >> ${LOGFILE} 2>&1 ( . $f ) >> ${LOGFILE} 2>&1 if [ $? -ne 0 ]; then - rm -f ${guestname}.cfg + rm -f ${guestcfgfile} popd > /dev/null 2>&1 echo "Error in init script $f" >> ${LOGFILE} 2>&1 echo "${PREF} Error during pre init script of ${guestname}" @@ -503,10 +505,10 @@ function xenguest_guest_start() done # Create non started guest - echo "xl create -p ${guestname}.cfg" >> ${LOGFILE} 2>&1 - xl create -p ${guestname}.cfg >> ${LOGFILE} 2>&1 + echo "xl create -p ${guestcfgfile}" >> ${LOGFILE} 2>&1 + xl create -p ${guestcfgfile} >> ${LOGFILE} 2>&1 if [ $? -ne 0 ]; then - rm -f ${guestname}.cfg + rm -f ${guestcfgfile} popd > /dev/null 2>&1 echo "${PREF} Error starting ${guestname}" exit 1 @@ -518,7 +520,7 @@ function xenguest_guest_start() echo "( . $f )" >> ${LOGFILE} 2>&1 ( . $f ) >> ${LOGFILE} 2>&1 if [ $? -ne 0 ]; then - rm -f ${guestname}.cfg + rm -f ${guestcfgfile} echo "xl destroy ${guestname}" >> ${LOGFILE} 2>&1 xl destroy ${guestname} >> ${LOGFILE} 2>&1 popd > /dev/null 2>&1 @@ -535,7 +537,7 @@ function xenguest_guest_start() echo "xl unpause ${guestname}" >> ${LOGFILE} 2>&1 xl unpause ${guestname} >> ${LOGFILE} 2>&1 if [ $? -ne 0 ]; then - rm -f ${guestname}.cfg + rm -f ${guestcfgfile} popd > /dev/null 2>&1 echo "${PREF} Error starting ${guestname}" exit 1 @@ -547,7 +549,7 @@ function xenguest_guest_start() echo "( . $f )" >> ${LOGFILE} 2>&1 ( . $f ) >> ${LOGFILE} 2>&1 if [ $? -ne 0 ]; then - rm -f ${guestname}.cfg + rm -f ${guestcfgfile} echo "xl destroy ${guestname}" >> ${LOGFILE} 2>&1 xl destroy ${guestname} >> ${LOGFILE} 2>&1 popd > /dev/null 2>&1 @@ -560,7 +562,7 @@ function xenguest_guest_start() fi done - rm -f ${guestname}.cfg + rm -f ${guestcfgfile} popd > /dev/null 2>&1 }