LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   "Broken" envirnment variable (MANPATH) and "/etc/profile.d" question. (https://www.linuxquestions.org/questions/slackware-14/broken-envirnment-variable-manpath-and-etc-profile-d-question-539004/)

ErV 03-20-2007 08:47 AM

"Broken" envirnment variable (MANPATH) and "/etc/profile.d" question.
 
Hello.
I've recently installed Qt 4.2.2 and it looks like it changed MANPATH variable, and now system can't find some manpages (located in /usr/local/share/man).
I've searched through several scripts and finally found that MANPATH is set somewhere in scripts in the /etc/profile.d folder (/usr/lib/man.conf has correct paths, but it's ignored if MANPATH exists) to a folders that contain Qt documentation, but at the end of startup MANPATH doesn't contain paths listed in /usr/lib/man.conf.

The questions are:
1) Where should i assign/set MANPATH variable to guarantee that it won't get overwritten again? (It looks like some installation programs really like to break configuration files)
2) Is there another way to modify "man" behavior? (To make it search both MANPATH and /usr/lib/man.conf directories)
3) What is the purpose of profile.d folder (didn't find this in Slackware FAQ and using whatis and apropos)? It looks like it contains some scripts (I've already set system locale in the /etc/profile.d/lang.sh) that are called either at system startup or when user logs in, but I'm not certain about that. Where is this folder documented? And what and when calls scripts located inside?

pdw_hu 03-20-2007 08:57 AM

1) /etc/profile, .bashrc, .bash_profile
2) dunno. :)
3) it has some additional scripts which are called from /etc/profile.d/

Read the bash manpage for more info on the mentioned files.

gbonvehi 03-20-2007 09:25 AM

1) I'd opt for personal files, like pwd_hu suggested: .bashrc/.bash_profile
2) Take a look at man's man page: man man
You'll probably have to play with -C and/or -M options.
3) They contain scripts to set enviroment values which are needed by programs which are not neccesary to normally run a system. That means, no critical packages, like QT,gtk,jre. To avoid having to thinker a lot to set these values, packages often includes this scripts which goes there, so they can easily be added or removed by just playing with a file inside profile.d.
These scripts are called at the end of /etc/profile's execution.
The "official" slackware package contains a script in profile.d which set some of these enviroment values you need, this is the bash script:
Code:

#!/bin/sh
# Environment variables for the Qt package.
#
# It's best to use the generic directory to avoid
# compiling in a version-containing path:
if [ -d /usr/lib/qt ]; then
  QTDIR=/usr/lib/qt
else
  # Find the newest Qt directory and set $QTDIR to that:
  for qtd in /usr/lib/qt-* ; do
    if [ -d $qtd ]; then
      QTDIR=$qtd
    fi
  done
fi
if [ ! "$CPLUS_INCLUDE_PATH" = "" ]; then
  CPLUS_INCLUDE_PATH=$QTDIR/include:$CPLUS_INCLUDE_PATH
else
  CPLUS_INCLUDE_PATH=$QTDIR/include
fi
MANPATH="$MANPATH:$QTDIR/doc/man"
PATH="$PATH:$QTDIR/bin"
export QTDIR
export CPLUS_INCLUDE_PATH
export MANPATH


ErV 03-20-2007 09:42 AM

pdw_hu, gbonvehi
Thanks a lot for a quick replies! The mention about /etc/profile was quite useful, now I know how this thing works... :) I think adding another script into the profile.d will solve the problem...
--added--
It was even simpler. MANPATH is declared at the start of /etc/profile. I just had to change initial value (I've added /etc/local/share/man).
Thanks again. problem solved.


All times are GMT -5. The time now is 10:34 AM.