-
Notifications
You must be signed in to change notification settings - Fork 14
/
entrypoint
38 lines (32 loc) · 1.58 KB
/
entrypoint
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
31
32
33
34
35
36
37
38
#!/usr/bin/env sh
# Starting from release 2.7.2 we register prusaslicer:// protocol handler directly inside flatpak dekstop file.
# If exists a previous integration remove them
DESKTOP_FILE=~/.local/share/applications/PrusaSlicerURLProtocol.desktop
if [ -f "$DESKTOP_FILE" ]; then
if grep -q flatpak "$DESKTOP_FILE"; then
rm -f "$DESKTOP_FILE"
fi
fi
PRUSA_SLICER_APP_LOCALE_ERROR="An error occured while setting up locale"
PRUSA_SLICER_APP_FALLBACK_LOCALE=en_US.UTF-8
USE_LOCALE_WORKAROUND=$( (/app/bin/prusa-slicer --help 2>&1 | grep "$PRUSA_SLICER_APP_LOCALE_ERROR") >/dev/null && echo true || echo false )
echo "--------------------------------------------------------------------------"
echo "Message: $(date +%T): Starting PrusaSlicer flatpak with entrypoint script"
echo "--------------------------------------------------------------------------"
if [ $USE_LOCALE_WORKAROUND = true ]; then
echo "WARN: detected locale error, trying to use fallback locale"
# Check if LANG is in locale -a output
LANG_PRESENT=$( (locale -a | grep -q "^$LANG$") && echo true || echo false )
if [ $LANG_PRESENT = true ]; then
export LC_ALL=$LANG
echo "WARN: $LANG is available, setting LC_ALL to $LC_ALL."
else
export LC_ALL=$PRUSA_SLICER_APP_FALLBACK_LOCALE
echo "WARN: $LANG is not available in locale -a. Setting LC_ALL to $LC_ALL."
fi
fi
[ $PRUSA_SLICER_DARK_THEME == true ] &&
export GTK_THEME='Adwaita:dark' &&
echo "Message: $(date +%T): INFO: using dark theme variant"
exec /app/bin/prusa-slicer "$@" &
$(/app/bin/set-dark-theme-variant.py) &