Don't match editor backup files in environment

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"

Port to dib-utils of: I934486b3ff5884063d29c6d9b66fd9b11140464c
Change-Id: I11c030e8556d89c240e36233b249f0c1d9f80908
This commit is contained in:
Alexis Lee 2014-07-08 15:02:32 +01:00
parent 6ab247204e
commit 7c03ab48a1
1 changed files with 3 additions and 1 deletions

View File

@ -73,7 +73,9 @@ 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_\.-]+$")
for env_file in $env_files ; do
source $env_file
done
fi