#975394 fish: honor scripts in /etc/profile.d

Package:
fish
Source:
fish
Description:
friendly interactive shell
Submitter:
Patrice Duroux
Date:
2020-11-21 18:15:03 UTC
Severity:
wishlist
#975394#5
Date:
2020-11-21 15:24:52 UTC
From:
To:
Dear Maintainer,

Using fish as a login shell may leave apart some package provided env settings.
For instance snapd provides a SH script to extends $PATH (and other variables).

It should be possible by default or under comments (or notified in a
README.Debian or...) in the system-wide /etc/fish/config.fish to execute those
.sh scripts by running 'sh' command to get their effects at least for the ones
doing well their job.

May be this should be addressed to any virtual Debian SHELL team as it may not
concern only fish but also other shells! ;-)

Thanks,
Patrice

#975394#10
Date:
2020-11-21 18:13:13 UTC
From:
To:
Here is my awful solution used sure only on my personal system:

~> cat /etc/fish/conf.d/etc-profile.fish
#
eval (/usr/bin/sh -c 'envfile=$(mktemp -t fish_importenv.XXXXXX) ; export | sort  > "$envfile" ; for f in $(ls /etc/profile.d/*.sh) ; do . "$f" ; done ; export | sort | comm -3 "$envfile" - | sed -r "s/export ([^=]+)=(.*)/set -x \1 \2;/g" ; rm -f "$envfile"')


At least this working to set PATH also according to /etc/profile.d/apps-bin-path.sh
and IM_CONFIG_CHECK_ENV according to /etc/profile.d/im-config_wayland.sh.

Here is a potential list of candidate packages:

~> apt-file search /etc/profile.d
bash-completion: /etc/profile.d/bash_completion.sh
byobu: /etc/profile.d/Z97-byobu.sh
chkboot: /etc/profile.d/chkboot-profilealert.sh
cloud-init: /etc/profile.d/Z99-cloud-locale-test.sh
debian-mate-default-settings: /etc/profile.d/debian-mate-default-settings_gtk-accessibility.sh
environment-modules: /etc/profile.d/modules.sh
flatpak: /etc/profile.d/flatpak.sh
gawk: /etc/profile.d/gawk.csh
gawk: /etc/profile.d/gawk.sh
im-config: /etc/profile.d/im-config_wayland.sh
junior-config: /etc/profile.d/debian-junior.sh
lammps: /etc/profile.d/lammps.csh
lammps: /etc/profile.d/lammps.sh
libvte-2.91-common: /etc/profile.d/vte-2.91.sh
libvte-2.91-common: /etc/profile.d/vte.csh
lmod: /etc/profile.d/lmod.sh
med-config: /etc/profile.d/debian-med.sh
mobile-tweaks-common: /etc/profile.d/mobile-tweaks.sh
osc: /etc/profile.d/osc.csh
packagekit-command-not-found: /etc/profile.d/PackageKit.sh
pan-config: /etc/profile.d/debian-pan.sh
safe-rm: /etc/profile.d/safe-rm.sh
sbmltoolbox: /etc/profile.d/SBMLToolbox.sh
science-config: /etc/profile.d/debian-science.sh
sendfile: /etc/profile.d/sendfile
snapd: /etc/profile.d/apps-bin-path.sh
sumo: /etc/profile.d/sumo.csh
sumo: /etc/profile.d/sumo.sh
undistract-me: /etc/profile.d/undistract-me.sh
vala-panel-appmenu-common: /etc/profile.d/vala-panel-appmenu.sh