diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:24:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:24:48 +0000 |
commit | cca66b9ec4e494c1d919bff0f71a820d8afab1fa (patch) | |
tree | 146f39ded1c938019e1ed42d30923c2ac9e86789 /snap/local/scripts | |
parent | Initial commit. (diff) | |
download | inkscape-cca66b9ec4e494c1d919bff0f71a820d8afab1fa.tar.xz inkscape-cca66b9ec4e494c1d919bff0f71a820d8afab1fa.zip |
Adding upstream version 1.2.2.upstream/1.2.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | snap/local/scripts/inkscape-variables | 30 | ||||
-rwxr-xr-x | snap/local/scripts/private-fontcache | 42 |
2 files changed, 72 insertions, 0 deletions
diff --git a/snap/local/scripts/inkscape-variables b/snap/local/scripts/inkscape-variables new file mode 100755 index 0000000..1c8d456 --- /dev/null +++ b/snap/local/scripts/inkscape-variables @@ -0,0 +1,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 "$@" diff --git a/snap/local/scripts/private-fontcache b/snap/local/scripts/private-fontcache new file mode 100755 index 0000000..e85623d --- /dev/null +++ b/snap/local/scripts/private-fontcache @@ -0,0 +1,42 @@ +#!/bin/bash +# Ensure that we prioritize using the private font cache +# SPDX-License-Identifier: GPL-2.0-or-later + +# ensure_dir_exists calls `mkdir -p` if the given path is not a directory. +# This speeds up execution time by avoiding unnecessary calls to mkdir. +# +# Usage: ensure_dir_exists <path> [<mkdir-options>]... +function ensure_dir_exists() { + [ -d "$1" ] || mkdir -p "$@" +} + +# Set $REALHOME to the users real home directory +REALHOME=$(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 +REALHOME=${REALHOME:-${SNAP_USER_DATA}/../../..} + +# Set config folder to local path +export XDG_CONFIG_HOME="$SNAP_USER_DATA/.config" +ensure_dir_exists "$XDG_CONFIG_HOME" +chmod 700 "$XDG_CONFIG_HOME" + +function make_user_fontconfig { + echo "<fontconfig>" + echo " <dir>$REALHOME/.local/share/fonts</dir>" + echo " <dir>$REALHOME/.fonts</dir>" + echo " <cachedir prefix=\"xdg\">fontconfig</cachedir>" + echo " <cachedir>$SNAP_DATA/fontconfig</cachedir>" + echo " <include ignore_missing=\"yes\">/etc/fonts/fonts.conf</include>" + if [ ! -z $SNAP_DESKTOP_RUNTIME ]; then + echo " <include ignore_missing=\"yes\">${SNAP_DESKTOP_RUNTIME}/etc/fonts/fonts.conf</include>" + fi + echo "</fontconfig>" +} + +ensure_dir_exists "$XDG_CONFIG_HOME/fontconfig" +make_user_fontconfig > "$XDG_CONFIG_HOME/fontconfig/fonts.conf" + +export FONTCONFIG_FILE=${XDG_CONFIG_HOME}/fontconfig/fonts.conf + +exec "$@" |