Zsh Utilities Configuration

This is part of the Zsh Utilities.

Zsh Utilities - Configuration

This file sets different environment variables given the hostname of the machine. Using org-mode's folding, each item contains the configuration for a given hostname. The function name must be __configure_$(hostname) in such a way it should be easy to add its own configuration.

Main configuration function

function __configure_machine ()
{
    __pkgtools__at_function_enter __configure_machine

    # This must be done by default
    export HOSTNAME=$(hostname)

    case "$HOSTNAME" in
        garrido-laptop|pc-91089)
            __configure_laptop
            ;;
        lx3.lal.in2p3.fr|nemo*.lal.in2p3.fr)
            __configure_lal_machines
            ;;
        ccige*|ccage*)
            __configure_lyon_machines
            ;;
        *)
            type __configure_$(hostname) | grep -q "shell function" > /dev/null 2>&1
            if [ $? -eq 0 ]; then
                __configure_$(hostname)
            else
                pkgtools__msg_warning "No configuration for machine '$(hostname)' has been found ! Use default one"
                __configure_default
            fi
            ;;
    esac

    __pkgtools__at_function_exit
    return 0
}

Default configuration

function __configure_default ()
{
    __pkgtools__at_function_enter __configure_default
    umask 022
    __pkgtools__at_function_exit
    return 0
}

Laptop/server configuration

function __configure_laptop ()
{
    __pkgtools__at_function_enter __configure_laptop

    # Use 256 colors terminal
    pkgtools__reset_variable TERM xterm-256color

    # Homemade latex style
    pkgtools__reset_variable TEXMFHOME ${HOME}/.config/texmf
    pkgtools__reset_variable TEXMFOUTPUT /tmp

    # Load Go Programming Language
    pkgtools__reset_variable GOPATH ${HOME}/Development/go
    pkgtools__add_path_to_PATH ${GOPATH}/bin

    # Adding also /usr/local/lib to LD_LIBRARY_PATH
    pkgtools__add_path_to_LD_LIBRARY_PATH /usr/local/lib

    # Adding utilities path
    pkgtools__add_path_to_PATH ${HOME}/.bin

    # Set HOST
    pkgtools__reset_variable HOST ${HOSTNAME}
    pkgtools__reset_variable WORKDIR ${HOME}/Workdir/NEMO

    # Set EDITOR
    pkgtools__reset_variable EDITOR "emacsclient"

    __pkgtools__at_function_exit
    return 0
}

LAL machines configuration

function __configure_lal_machines ()
{
    __pkgtools__at_function_enter __configure_lal_machines

    umask 022
    pkgtools__reset_variable EXPDIR /exp/nemo/garrido
    pkgtools__reset_variable WORKDIR /exp/nemo/garrido/workdir

    # Add emacs 24.3
    pkgtools__add_path_to_PATH ${EXPDIR}/software/bin
    # Add TeXLive 2012
    pkgtools__add_path_to_PATH ${EXPDIR}/software/texlive/2012/bin/x86_64-linux
    pkgtools__unset_variable TEXMFCNF
    pkgtools__unset_variable TETEXDIR

    __pkgtools__at_function_exit
    return 0
}

Lyon machines configuration

function __configure_lyon_machines ()
{
    __pkgtools__at_function_enter __configure_lyon_machines
    pkgtools__reset_variable SCRATCH_DIR /sps/nemo/scratch/garrido
    pkgtools__add_path_to_PATH /usr/local/cmake/3.0.0/bin
    __pkgtools__at_function_exit
    return 0
}
File under version control - commit b7f7874 - 2014-11-07