summaryrefslogtreecommitdiffstats
path: root/snap/local/scripts/inkscape-variables
blob: 1c8d4566e34f5cbc8c1c4504fb9a92baa026c3e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# Set all the Inkscape specific environment variables
# SPDX-License-Identifier: GPL-2.0-or-later

# If we're on an older snapd that doesn't have SNAP_REAL_HOME try
# to fake it
if [ -z $SNAP_REAL_HOME ]; then
SNAP_REAL_HOME=`getent passwd $UID | cut -d ':' -f 6`
# fallback to pre-1.2 behaviour in case getent doesn't work due to apparmor
# could suggest to install unscd to proxy requests to blocked nss module
SNAP_REAL_HOME=${SNAP_REAL_HOME:-${SNAP_USER_DATA}/../../..}
fi

export INKSCAPE_PROFILE_DIR=${SNAP_REAL_HOME}/.config/inkscape
export INKSCAPE_LOCALEDIR=${SNAP}/share/locale
export INKSCAPE_DATADIR=${SNAP}/share
export INKSCAPE_EXTENSIONS_DIR=${SNAP_USER_COMMON}/extensions/

export GTK_USE_PORTAL=1

export GS_LIB=${SNAP}/usr/share/ghostscript/9.55.0/Resource/Init/
if [ ! -x ${GS_LIB} ]; then
  echo "WARN: Ghostscript library not executable: $GS_LIB"
fi

export PYTHONPATH=/usr/lib/python3.10:/usr/lib/python3.10/lib-dynload:${SNAP}/lib/python3.10/site-packages:${SNAP}/usr/lib/python3/dist-packages

cd $SNAP_REAL_HOME

exec "$@"