#!/bin/sh

for x in bzip2 cairo fontconfig freetype2 gimp210 gtkcore
do
    LD_LIBRARY_PATH=__META_PRODTREE__/$x/lib:$LD_LIBRARY_PATH
done
export LD_LIBRARY_PATH

DIR=$HOME/.config/GIMP/2.10
mkdir -p $DIR $DIR/gradients
GRCFILE=$DIR/gimprc

if [ \! -f $GRCFILE ]; then
    WHO=`whoami`
    WHODIR=/ram/gimp/$WHO
    mkdir -p $WHODIR

    cat  > $GRCFILE << END
(temp-path "$WHODIR")
(swap-path "$WHODIR")
(num-processors 4)
(tile-cache-size 512M)
(theme "System")
(icon-theme "Color")
END
fi

if [ \! -f $DIR/tags.xml ]; then
    cp -p __META_PREFIX__/share/tags.xml $DIR/
fi

cp -p __META_PREFIX__/share/sessionrc $DIR/
exec  __META_PREFIX__/bin/gimp-2.10.bin $*
