Package: base-files
Version: 3.1.9
Severity: wishlist
Tags: patch

Adding the snippet below to /etc/profile modularizes /etc/profile so 
packages can drop snippets they want to add into an /etc/profile.d dir and 
have them picket up.

Several other packages in Debian have similar mechanisms in place the 
advantage being that packages can add configuration snippets they need in a 
policy compliant manner without needing to bother you guys for each change, 
and without having the snippet when the package that needs it isn't 
present.

I currently need this in order to fix a shortcoming of the current 
desktop-profiles package (see beastie #344030 for details)

<<<<< begin snippet
# Allow packages to add stuff in a policy compliant manner
# approach is essentially copied form Debian's /etc/X11/Xsession file
SESSION_DIR=/etc/profile.d

run_parts () {
  # until run-parts --noexec is implemented
  for FILE in $(/bin/ls $1); do
    if expr "$FILE" : '[[:alnum:]_-]\+$' > /dev/null 2>&1; then
      if [ -f "$1/$FILE" ]; then
        echo "$1/$FILE";
      fi;
    fi;
  done;
}

# If $SESSION_DIR is a directory, source all scripts in it.
# We source instead of execute since we want scripts to be able to set
# variables, and define functions.
if [ -d "$SESSION_DIR" ]; then
 SESSION_FILES=$(run_parts "$SESSION_DIR");
  if [ -n "$SESSION_FILES" ]; then
    for SESSION_FILE in $SESSION_FILES; do
      . "$SESSION_FILE";
    done;
  fi;
fi;
>>>>> end snippet
--
Cheers, cobaco

/"\  ASCII Ribbon Campaign
\ /  No proprietary formats in attachments without request
 X   i.e. *NO* WORD, POWERPOINT or EXCEL documents
/ \  Respect Open Standards
      http://www.fsf.org/philosophy/no-word-attachments.html
      http://www.goldmark.org/netrants/no-word/attach.html






Attachment: pgpOFhsBPpd1V.pgp
Description: PGP signature

Reply via email to