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 matche 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"

Change-Id: I934486b3ff5884063d29c6d9b66fd9b11140464c
This commit is contained in:
Ian Wienand 2014-07-03 11:39:53 +10:00
parent 451e571753
commit 32eda4b92f

View File

@ -73,8 +73,11 @@ 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
source $env_file
env_files=$(find $ENVIRONMENT_D_DIR \
-maxdepth 1 -xtype f -printf '%f\n' | \
grep -E "^[0-9A-Za-z_\.-]+$")
for env_file in $env_files ; do
source $ENVIRONMENT_D_DIR/$env_file
done
fi