37 lines
1.1 KiB
Plaintext
37 lines
1.1 KiB
Plaintext
|
##@cooked comments # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||
|
## Fonctions de base: initialisation de l'environnement
|
||
|
##@cooked nocomments
|
||
|
|
||
|
# Emplacement du script courant
|
||
|
if [ -n "$UTOOLS_HAVE_SCRIPTVARS" ]; then
|
||
|
# ne pas mettre à jour script, scriptname, scriptdir. Ils ont déjà été
|
||
|
# calculés
|
||
|
:
|
||
|
elif [ "$0" == "-bash" ]; then
|
||
|
scriptname=
|
||
|
scriptdir=
|
||
|
script=
|
||
|
elif [ ! -f "$0" -a -f "${0#-}" ]; then
|
||
|
scriptname="$(basename -- "${0#-}")"
|
||
|
scriptdir="$(dirname -- "${0#-}")"
|
||
|
scriptdir="$(cd "$scriptdir"; pwd)"
|
||
|
script="$scriptdir/$scriptname"
|
||
|
else
|
||
|
scriptname="$(basename -- "$0")"
|
||
|
scriptdir="$(dirname -- "$0")"
|
||
|
scriptdir="$(cd "$scriptdir"; pwd)"
|
||
|
script="$scriptdir/$scriptname"
|
||
|
fi
|
||
|
: "${ULIBDIR:=$scriptdir}"
|
||
|
|
||
|
# Repertoire temporaire
|
||
|
[ -z "$TMPDIR" -a -d "$HOME/tmp" ] && TMPDIR="$HOME/tmp"
|
||
|
export TMPDIR="${TMPDIR:-${TMP:-${TEMP:-/tmp}}}"
|
||
|
|
||
|
# User
|
||
|
[ -z "$USER" -a -n "$LOGNAME" ] && export USER="$LOGNAME"
|
||
|
|
||
|
# Le fichier nutoolsrc doit être chargé systématiquement
|
||
|
[ -f /etc/nutoolsrc ] && . /etc/nutoolsrc
|
||
|
[ -f ~/.nutoolsrc ] && . ~/.nutoolsrc
|