|
|
e14835 |
#!/bin/sh
|
|
|
e14835 |
|
|
|
e7b20d |
OLDDIR=`pwd`
|
|
|
b0fa99 |
SCRIPT_DIR=$(cd `dirname "$0"`; pwd)
|
|
|
e7b20d |
cd "$OLDDIR"
|
|
|
e14835 |
BASE_DIR=`dirname "$SCRIPT_DIR"`
|
|
|
e14835 |
|
|
|
abfde6 |
export LD_LIBRARY_PATH="$BASE_DIR/lib:$BASE_DIR/lib/opentoonz:$BASE_DIR/lib64:$LD_LIBRARY_PATH"
|
|
|
caca5f |
export XCURSOR_PATH="$BASE_DIR/share/icons:$XCURSOR_PATH:/usr/local/share/icons:/usr/share/icons"
|
|
|
caca5f |
export QT_XKB_CONFIG_ROOT="$QT_XKB_CONFIG_ROOT:/usr/local/share/X11/xkb:/usr/share/X11/xkb"
|
|
|
e14835 |
|
|
|
f49009 |
# fix stuff
|
|
|
f49009 |
CONFIG_DIR="$HOME/.config/OpenToonz"
|
|
|
f49009 |
if [ ! -d "$CONFIG_DIR" ]; then
|
|
|
f49009 |
echo "fix config: copy stuff".
|
|
|
f49009 |
mkdir -p "$CONFIG_DIR"
|
|
|
f49009 |
cp -r "$BASE_DIR/share/opentoonz/stuff" "$CONFIG_DIR"
|
|
|
f49009 |
|
|
|
f49009 |
echo "fix config: create SystemVar.ini"
|
|
|
f49009 |
cat << EOF > "$CONFIG_DIR/SystemVar.ini"
|
|
|
f49009 |
[General]
|
|
|
f49009 |
OPENTOONZROOT="$HOME/.config/OpenToonz/stuff"
|
|
|
f49009 |
OpenToonzPROFILES="$HOME/.config/OpenToonz/stuff/profiles"
|
|
|
f49009 |
TOONZCACHEROOT="$HOME/.config/OpenToonz/stuff/cache"
|
|
|
f49009 |
TOONZCONFIG="$HOME/.config/OpenToonz/stuff/config"
|
|
|
f49009 |
TOONZFXPRESETS="$HOME/.config/OpenToonz/stuff/fxs"
|
|
|
f49009 |
TOONZLIBRARY="$HOME/.config/OpenToonz/stuff/library"
|
|
|
f49009 |
TOONZPROFILES="$HOME/.config/OpenToonz/stuff/profiles"
|
|
|
f49009 |
TOONZPROJECTS="$HOME/.config/OpenToonz/stuff/projects"
|
|
|
f49009 |
TOONZROOT="$HOME/.config/OpenToonz/stuff"
|
|
|
f49009 |
TOONZSTUDIOPALETTE="$HOME/.config/OpenToonz/stuff/projects/studiopalette"
|
|
|
f49009 |
EOF
|
|
|
f49009 |
|
|
|
f49009 |
else
|
|
|
f49009 |
# add mypaint brushes if need
|
|
|
f49009 |
if [ ! -d "$CONFIG_DIR/stuff/library/mypaint brushes" ]; then
|
|
|
f49009 |
echo "fix config: copy mypaint brushes"
|
|
|
f49009 |
mkdir -p "$CONFIG_DIR/stuff/library"
|
|
|
f49009 |
cp -r "$BASE_DIR/share/opentoonz/stuff/library/mypaint brushes" "$CONFIG_DIR/stuff/library/"
|
|
|
f49009 |
fi
|
|
|
f49009 |
|
|
|
f49009 |
# fix paths
|
|
|
f49009 |
INI="$HOME/.config/OpenToonz/SystemVar.ini"
|
|
|
f49009 |
if [ -e "$INI" ]; then
|
|
|
f49009 |
[ -e "$INI.bak" ] || cp "$INI" "$INI.bak"
|
|
|
f49009 |
|
|
|
f49009 |
# fix path to fxs
|
|
|
f49009 |
FX_PATH_OLD="$CONFIG_DIR/stuff/projects/fxs"
|
|
|
f49009 |
FX_PATH_NEW="$CONFIG_DIR/stuff/fxs"
|
|
|
f49009 |
FX_LINE_OLD="TOONZFXPRESETS=\"$FX_PATH_OLD\""
|
|
|
f49009 |
FX_LINE_NEW="TOONZFXPRESETS=\"$FX_PATH_NEW\""
|
|
|
f49009 |
if [ ! -z "`grep "$FX_LINE_OLD" "$INI"`" ] \
|
|
|
f49009 |
&& ( [ ! -d "$FX_PATH_OLD" ] || [ -z "`ls -A "$FX_PATH_OLD"`" ] ); then
|
|
|
f49009 |
echo "fix config: fix path to fxs"
|
|
|
f49009 |
cat "$INI" \
|
|
|
f49009 |
| sed "s|$FX_LINE_OLD|$FX_LINE_NEW|g" \
|
|
|
f49009 |
> "$INI.out"
|
|
|
f49009 |
cp "$INI.out" "$INI"
|
|
|
f49009 |
rm -f "$INI.out"
|
|
|
f49009 |
fi
|
|
|
f49009 |
|
|
|
f49009 |
# fix path to library
|
|
|
f49009 |
LIBRARY_PATH_OLD="$CONFIG_DIR/stuff/projects/library"
|
|
|
f49009 |
LIBRARY_PATH_NEW="$CONFIG_DIR/stuff/library"
|
|
|
f49009 |
LIBRARY_LINE_OLD="TOONZLIBRARY=\"$LIBRARY_PATH_OLD\""
|
|
|
f49009 |
LIBRARY_LINE_NEW="TOONZLIBRARY=\"$LIBRARY_PATH_NEW\""
|
|
|
f49009 |
if [ ! -z "`grep "$LIBRARY_LINE_OLD" "$INI"`" ] \
|
|
|
f49009 |
&& ( [ ! -d "$LIBRARY_PATH_OLD" ] || [ -z "`ls -A "$LIBRARY_PATH_OLD"`" ] ); then
|
|
|
f49009 |
echo "fix config: fix path to library"
|
|
|
f49009 |
cat "$INI" \
|
|
|
f49009 |
| sed "s|$LIBRARY_LINE_OLD|$LIBRARY_LINE_NEW|g" \
|
|
|
f49009 |
> "$INI.out"
|
|
|
f49009 |
cp "$INI.out" "$INI"
|
|
|
f49009 |
rm -f "$INI.out"
|
|
|
f49009 |
fi
|
|
|
f49009 |
fi
|
|
|
d3f373 |
|
|
|
d3f373 |
# update themes
|
|
|
d3f373 |
echo "fix config: update themes"
|
|
|
d3f373 |
cp -ur "$BASE_DIR/share/opentoonz/stuff/config/qss" "$CONFIG_DIR/stuff/config/"
|
|
|
d3f373 |
|
|
|
d3f373 |
# update localizations
|
|
|
d3f373 |
echo "fix config: update themes"
|
|
|
d3f373 |
cp -ur "$BASE_DIR/share/opentoonz/stuff/config/loc" "$CONFIG_DIR/stuff/config/"
|
|
|
f49009 |
fi
|
|
|
f49009 |
|
|
|
e14835 |
cd "$BASE_DIR/bin"
|
|
|
abfde6 |
if ! ./opentoonz "$@"; then
|
|
|
abfde6 |
cd "$OLDDIR"
|
|
|
abfde6 |
exit 1
|
|
|
abfde6 |
fi
|
|
|
e14835 |
cd "$OLDDIR"
|