From 2f6fdb414236c220f9b287b75eb97123df80182c Mon Sep 17 00:00:00 2001 From: Alexis Lee Date: Fri, 11 Jul 2014 16:50:15 +0100 Subject: [PATCH] Fix sourcing of environment files Includes "Don't match editor backup files in environment" and "Order execution of environment.d scripts". These had to be squashed because the first change alone changes the order env.d scripts are sourced in. The current glob match for environment files can source editor backup files (foo.bash~) which will override the real changes you have made. Other parts use the regex to avoid matching such files, so do the same for environment file matching. Note this has to match "." unlike the other regex, as most env files are "foo.bash" Also sort the files before sourcing them to ensure a reliable order. This change should be in line with current expectations, given the convention is to numerically prefix scripts in this directory. Update of: I934486b3ff5884063d29c6d9b66fd9b11140464c Subsumes: Icc509f695d7a15a8026d8c7e463f06acf65499d7 Change-Id: Ibfb562c5970b40598fc95da1e8d4beb9d51d7612 --- elements/dib-run-parts/bin/dib-run-parts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/elements/dib-run-parts/bin/dib-run-parts b/elements/dib-run-parts/bin/dib-run-parts index 1aed34b2..018da92b 100755 --- a/elements/dib-run-parts/bin/dib-run-parts +++ b/elements/dib-run-parts/bin/dib-run-parts @@ -73,7 +73,10 @@ PROFILE_DIR=$(mktemp -d /tmp/profiledir.XXXXXX) ENVIRONMENT_D_DIR=$target_dir/../environment.d if [ -d $ENVIRONMENT_D_DIR ] ; then - for env_file in $ENVIRONMENT_D_DIR/* ; do + env_files=$(find $ENVIRONMENT_D_DIR -maxdepth 1 -xtype f | \ + grep -E "/[0-9A-Za-z_\.-]+$" | \ + LANG=C sort -n) + for env_file in $env_files ; do source $env_file done fi