#!/bin/sh
#
# A wrapper script for Blender
#
# In case user's home directory doesn't contain ~/.blender, copy it
# from /usr/share/blender
if [ ! -d ~/.blender ]; then
install -d ~/.blender
ln -sf /usr/share/locale ~/.blender/locale
ln -sf /usr/share/blender/.Blanguages ~/.blender
ln -sf /usr/share/blender/.bfont.ttf ~/.blender
cp -a /usr/share/blender/bpydata ~/.blender
cp -a /usr/share/blender/VERSION ~/.blender
install -d ~/.blender/plugins/sequence
install -d ~/.blender/plugins/texture
install -d ~/.blender/scripts
ln -sf /usr/share/blender/scripts/* ~/.blender/scripts/
fi
#
# In case the user's ~/.blender came from older versions, some files
# should be reinstalled.
#
if [ $(cat ~/.blender/VERSION) != $(cat /usr/share/blender/VERSION) ]; then
cp -a /usr/share/blender/bpydata ~/.blender
ln -sf /usr/share/blender/scripts/* ~/.blender/scripts/
cp -a /usr/share/blender/VERSION ~/.blender
fi
#
# Fully update the plugins every time blender is launched.
#
for s in /usr/share/blender/scripts/* ; do
s=`basename $s`
if [ ! -e ~/.blender/scripts/$s ] ; then
ln -sf /usr/share/blender/scripts/$s ~/.blender/scripts/
fi
done
/usr/bin/blender.bin $@