##----------------------------------------------------------------------------
## Script         : profile_init.env
## Module Puppet  : gnc-script_core_dtsi
## Auteur         : Emmanuel Confrere
## Date           : 11-07-2017
## Version        : 1.2.3
## Objet          : Initialisation des variables d environements du socle
##                  Chargement des librairie bash
##                  Initialisation du PATH
##           
## Fonctionnement : Ce script est depose dans le repertoire ${NC_EXPL_ROOT}/conf/shell-env
##                  avec les droits suivant : 0644 asr:asr
##
##                  Il initialise l environement globale du socles, charge les librairie et 
##                  initialise les PATH et les alias commun.
##
##                  Il est appele par le script /etc/profile.d/dtsi.sh
##
# ----------------------------------------------------------------------------
# Mise a jour :
# 1.0.0    10-02-2016 - Emmanuel Confrere  - Cre : A partir de l ancien fichier .dbenv
# 1.0.1    21-07-2016 - Stephane Tourneyre - Ano : Ajout ancien path pour man ADMLINUX-1176
# 1.1.0    28-07-2016 - Emmanuel Confrere  - Evo : Normalisation : Versionnage Sementique
# 1.2.0    05-04-2017 - Emmanuel Confrere  - Evo : Ajout de la variable NC_EXPL_NFS
# 1.2.1    07-04-2017 - Emmanuel Confrere  - Ano : Definition du prompt
# 1.2.2    11-04-2017 - Emmanuel Confrere  - Ano : Suppression de la definition du Prompt
# 1.2.3    11-07-2017 - Emmanuel Confrere  - Ano : Description du fonctionnement erronee.
# ----------------------------------------------------------------------------

# -- Initialisation des variable globale NC_*
#
NC_EXPL_LIB=${NC_EXPL_ROOT}/lib
NC_EXPL_BIN=${NC_EXPL_ROOT}/bin
NC_EXPL_LOG=${NC_EXPL_ROOT}/log
NC_EXPL_HST=${NC_EXPL_ROOT}/hist
NC_EXPL_CPT=${NC_EXPL_ROOT}/cpt
NC_EXPL_TMP=${NC_EXPL_ROOT}/tmp
NC_EXPL_DAT=${NC_EXPL_ROOT}/dat
NC_EXPL_MOD=${NC_EXPL_ROOT}/mod
NC_EXPL_CFG=${NC_EXPL_ROOT}/conf
NC_EXPL_MSG=${NC_EXPL_ROOT}/msg
NC_EXPL_MAN=${NC_EXPL_ROOT}/man


#[ `df|grep -c "srv-nfs"` -eq 1 ] && NC_EXPL_NFS="oui" || NC_EXPL_NFS="non"
NC_EXPL_NFS="non"

# -- Export des variables
#
export NC_EXPL_LOG NC_EXPL_HST NC_EXPL_TMP NC_EXPL_LIB NC_EXPL_DAT NC_EXPL_MAN
export NC_EXPL_CPT NC_EXPL_BIN NC_EXPL_CFG NC_EXPL_MSG NC_EXPL_MOD NC_EXPL_NFS

# -- Chargement des librairies
#
for lib in `find ${NC_EXPL_LIB} -name \*.lib`
do
. ${lib}
done

# Ajout du repertoire des scripts au Path
#  bin -> Repertoire des script dba
fctpath "${NC_EXPL_BIN}" PATH :
fctpath '/usr/local/share/man' MANPATH :
fctpath '/usr/share/man/fr' MANPATH :
fctpath '/usr/share/man/overrides' MANPATH :
fctpath '/usr/share/man/' MANPATH :
fctpath "${NC_EXPL_MAN}" MANPATH :

# -- Definition des alias
#
alias bbin='cd ${NC_EXPL_ROOT}/bin'
alias type='whence -v'
alias log='cd ${NC_EXPL_LOG}'
alias hist='cd ${NC_EXPL_HST}'