This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: base-files: Does not permit the use of symlinks in /etc/profile.d/


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 9/17/2005 7:19 AM:
> 
> Here's my idea - add a /etc/profile/symlinkhandler.sh that detects whether
> /etc/profile has been patched yet, and if not, source all the symlinks in
> /etc/profile.

And after more thought, one easy way for symlinkhandler to realize if
symlinks have been sourced, which works since the profile.d scripts are
sourced in alphabetical order:

/etc/profile.d/symlinkhandler1.sh -> /etc/profile.d/symlinkhandler1

/etc/profile.d/symlinkhandler1:
# set to let symlinkhandler2.sh know that symlinkhandler1.sh was called
symlinks_in_profile_d_have_been_sourced=yes

/etc/profile.d/symlinkhandler2.sh:
if [ "x$symlinks_in_profile_d_have_been_sourced" != xyes ] ; then
  # only regular files have been sourced so far; source the symlinks
  for f in `find /etc/profile.d -type l -xtype f -name '*.sh'` ; do
    . "$f"
  done
fi
# unset to avoid polluting the shell variable namespace
unset symlinks_in_profile_d_have_been_sourced

- --
Life is short - so eat dessert first!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDLBt+84KuGfSFAYARAt4zAKCMSISRkvbGtOuaMU7OHVgHysY7nQCeM5h3
j37zXYFTYOl1GN/gAAvnQm0=
=tLOq
-----END PGP SIGNATURE-----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]