From a6968a769ad2d91403bafafed82a6b8873f3e2e9 Mon Sep 17 00:00:00 2001 From: Grazvydas Ignotas Date: Sun, 13 Sep 2015 19:58:37 +0300 Subject: [PATCH] pnd_run.sh: move pre/post-run scripts where env is set up Note: pre was run before env was set up and post still with env set, now both are ran with env (PATH and LD_LIBRARY_PATH) set, so things may break. This is unlikely though as almost nobody is using pre/post scripts. --- testdata/scripts/pnd_run.sh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/testdata/scripts/pnd_run.sh b/testdata/scripts/pnd_run.sh index abf1b1e..2244ef3 100755 --- a/testdata/scripts/pnd_run.sh +++ b/testdata/scripts/pnd_run.sh @@ -561,6 +561,12 @@ runApp() { export XDG_DATA_HOME="$HOME" export XDG_CACHE_HOME="$HOME" + if [ -e "${APPDATADIR}/PND_pre_script.sh" ]; then + echo "Starting user configured pre-script ${APPDATADIR}/PND_pre_script.sh" + . ${APPDATADIR}/PND_pre_script.sh # Sourcing so it can shared vars with post-script ;) + echo "${APPDATADIR}/PND_pre_script.sh is done" + fi + if [ "$DOTSLASH" = "true" ]; then "$EXENAME" $ARGUMENTS "$@" else @@ -571,6 +577,12 @@ runApp() { #the app could have exited now, OR it went into bg, we still need to wait in that case till it really quits! LD_LIBRARY_PATH= PATH="$REAL_PATH" PND_WaitForExit "$EXENAME" + if [ -e "${APPDATADIR}/PND_post_script.sh" ]; then + echo "Starting user configured post-script ${APPDATADIR}/PND_post_script.sh" + . ${APPDATADIR}/PND_post_script.sh + echo "${APPDATADIR}/PND_post_script.sh is done" + fi + # clean up to avoid any effects of the .pnd on the remaining parts of this script unset LD_LIBRARY_PATH export HOME="$REAL_HOME" @@ -611,21 +623,11 @@ main() { fi oPWD=$(pwd) old_fb0_geometry=$(fbset -fb /dev/fb0 -s | grep geometry | awk '{print $2, $3, $4, $5, $6}') - if [ -e "${APPDATADIR}/PND_pre_script.sh" ]; then - PND_BeginTask "Starting user configured pre-script" - . ${APPDATADIR}/PND_pre_script.sh # Sourcing so it can shared vars with post-script ;) - PND_EndTask - fi PND_BeginTask "Starting the application ( $EXENAME $ARGUMENTS "$@")" runApp "$@" PND_EndTask - if [ -e "${APPDATADIR}/PND_post_script.sh" ]; then - PND_BeginTask "Starting user configured post-script" - . ${APPDATADIR}/PND_post_script.sh - PND_EndTask - fi cd $oPWD if [ $CLOSE_X ]; then PND_BeginTask "Restarting X" -- 2.39.2