# Copyright (C) SineSoft 1999, version 1.0
# This script is a part of Sinux distribution.
# Find paths and set them correctly
# It should be sourced from the initial script (/etc/profile or similar)

# No, it is NOT actually used in Sinux-P ;)

# Set regular paths first
if [ `id | cut -c7-10` = "root" ]; then
  PATH="/usr/bin:/bin:/usr/sbin:/sbin"
else
  PATH="/usr/bin:/bin:/usr/local/bin:/usr/games/bin:/usr/local/games/bin:."
fi
MANPATH=/usr/man:/usr/man/preformat:/usr/local/man:/usr/games/man:/usr/local/games/man

# If the X11 directory is present, add it to the path.
if [ -d /usr/X11 ]; then
  PATH=$PATH:/usr/X11/bin
  MANPATH=$MANPATH:/usr/X11/man
fi

# Do not forget for samba...
if [ -d /usr/samba ]; then
  PATH=$PATH:/usr/samba/bin
  MANPATH=$MANPATH:/usr/samba/man
fi

# Now search for packages in /opt
for i in /opt/* ; do
  if [ -d $i ]; then
    # .nopath file prevents the directory from being added
    if [ ! -e $i/.nopath ]; then
#      echo $i
      if [ -d $i/bin ]; then
        PATH=$PATH:$i/bin
#	echo $i/bin
      fi
      if [ -d $i/man ]; then
        MANPATH=$MANPATH:$i/man
#	echo $i/man
      fi
      # Special assignments can be made in this file
      if [ -e $i/.setpath ]; then
        . $i/.setpath
      fi
    fi
  fi
done

#echo $PATH
#echo $MANPATH

export PATH MANPATH

