At the moment the /etc/profile we install with sysfiles tries to load in bash every file there is in /etc/profile.d. This code:
# include local profiles#for x in /etc/profile.d/* /etc/conf/profile ;do[ -f $x]&& . $xdone
At least gawk (probably others) install in /etc/profile non bash files (gawc.csh).
We need to expand the code in the sysfiles: /etc/profile to something along the lines of:
# include local profiles#for x in /etc/profile.d/* /etc/conf/profile ;doif[ -f $x];thencase"$x"
*.csh)continue;;
*) . $x;;esacfidone
At the moment the /etc/profile we install with sysfiles tries to load in bash every file there is in /etc/profile.d. This code:
```bash
# include local profiles
#
for x in /etc/profile.d/* /etc/conf/profile ; do
[ -f $x ] && . $x
done
```
At least gawk (probably others) install in /etc/profile non bash files (gawc.csh).
We need to expand the code in the sysfiles: /etc/profile to something along the lines of:
```bash
# include local profiles
#
for x in /etc/profile.d/* /etc/conf/profile ; do
if [ -f $x ]; then
case "$x"
*.csh) continue ;;
*) . $x ;;
esac
fi
done
```
for x;do# skip empty and .csh files[ -s "$x" -a "$x"="${x%.csh}"]||continue
. "$x"done
In this case I'm more of a fan of something like:
```sh
for x; do
# skip empty and .csh files
[ -s "$x" -a "$x" = "${x%.csh}" ] || continue
. "$x"
done
```
I thought we agreed that in order to be able to expand the exclusion list in a cleaner way we will use a case statement...
I was simply documenting the approach I would prefer, not that I was against of using a case
> I thought we agreed that in order to be able to expand the exclusion list in a cleaner way we will use a case statement...
I was simply documenting the approach I would prefer, not that I was against of using a `case`
It is interesting to know that for example Ubuntu has the relevand code snippet:
if[ -d /etc/profile.d ];thenfor i in /etc/profile.d/*.sh;doif[ -r $i];then
. $ifidoneunset i
fi
The issues is that we have packages that install files in /etc/profile.d/ without extension (I am looking at you pkgconfig and Python). Usually those are files with only one export statement or so.
I think that we should use something that only sources files that either have no extension or have a .sh extension. I would not filter files with .csh extension because what if tomorrow something installs a .tsh or who knows what.
Maybe something on the lines of:
if[ -d /etc/profile.d ];thenfor i in $(find /etc/profile.d/ -type f ! -name "?*.*" -o -name "*.sh");doif[ -r $i];then
. $ifidoneunset i
fi
It is interesting to know that for example Ubuntu has the relevand code snippet:
```bash
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
```
The issues is that we have packages that install files in `/etc/profile.d/` without extension (I am looking at you `pkgconfig` and `Python`). Usually those are files with only one `export` statement or so.
I think that we should use something that only sources files that either have no extension or have a `.sh` extension. I would not filter files with `.csh` extension because what if tomorrow something installs a `.tsh` or who knows what.
Maybe something on the lines of:
```bash
if [ -d /etc/profile.d ]; then
for i in $(find /etc/profile.d/ -type f ! -name "?*.*" -o -name "*.sh"); do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
```
At the moment the /etc/profile we install with sysfiles tries to load in bash every file there is in /etc/profile.d. This code:
At least gawk (probably others) install in /etc/profile non bash files (gawc.csh).
We need to expand the code in the sysfiles: /etc/profile to something along the lines of:
In this case I'm more of a fan of something like:
I thought we agreed that in order to be able to expand the exclusion list in a cleaner way we will use a case statement...
I was simply documenting the approach I would prefer, not that I was against of using a
case
It is interesting to know that for example Ubuntu has the relevand code snippet:
The issues is that we have packages that install files in
/etc/profile.d/
without extension (I am looking at youpkgconfig
andPython
). Usually those are files with only oneexport
statement or so.I think that we should use something that only sources files that either have no extension or have a
.sh
extension. I would not filter files with.csh
extension because what if tomorrow something installs a.tsh
or who knows what.Maybe something on the lines of: