#!/bin/bash

[ -d /var/lib/lxc ] || exit 0

MODULE="$(CreoleGet eole_module)"
if [ "$MODULE" == "scribe" ]; then
    CONTENEURS="addc"
elif [ "$MODULE" == "amonecole" ]; then
    CONTENEURS="addc bdd  internet  partage  reseau"
fi

for i in $CONTENEURS
do
    CONTENEUR_PATH="/var/lib/lxc/${i}/rootfs"
    [ -d "$CONTENEUR_PATH" ] || continue
    /bin/cp /etc/profile.d/eolerc.sh "$CONTENEUR_PATH/etc/profile.d/eolerc.sh"
    if [ -f "$CONTENEUR_PATH/root/.bashrc" ]
    then
        sed -i 's/^HISTCONTROL.*$/# &/' "$CONTENEUR_PATH/root/.bashrc"
        sed -i 's/^HISTSIZE.*$/# &/' "$CONTENEUR_PATH/root/.bashrc"
        sed -i 's/^HISTFILESIZE.*$/# &/' "$CONTENEUR_PATH/root/.bashrc"
    fi
done
