File indexing completed on 2025-01-19 03:59:48
0001 #!/bin/bash 0002 0003 # Main AppImage internal startup script. 0004 # Wrap XDG_* variables properly for Qt. 0005 # 0006 # SPDX-FileCopyrightText: 2015-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0007 # 0008 # SPDX-License-Identifier: BSD-3-Clause 0009 # 0010 0011 # Function to preload a shared library in memory before to start application. 0012 0013 preload_shared_library () 0014 { 0015 FILE=$1 0016 echo -e "Check library $FILE" 0017 0018 # if [ -f "$DIR/usr/lib64/$FILE" ] ; then 0019 # export LD_PRELOAD=$LD_PRELOAD:$DIR/usr/lib64/$FILE 0020 # elif 0021 if [ -f "/usr/lib64/$FILE" ] ; then 0022 export LD_PRELOAD=$LD_PRELOAD:/usr/lib64/$FILE 0023 elif [ -f "/usr/lib/x86_64-linux-gnu/$FILE" ] ; then 0024 export LD_PRELOAD=$LD_PRELOAD:/usr/lib/x86_64-linux-gnu/$FILE 0025 elif [ -f "/lib/x86_64-linux-gnu/$FILE" ] ; then 0026 export LD_PRELOAD=$LD_PRELOAD:/lib/x86_64-linux-gnu/$FILE 0027 fi 0028 } 0029 0030 ### 0031 0032 echo "-- digiKam Linux AppImage Bundle" 0033 echo "-- Use 'help' as CLI argument to know all available options for digiKam application." 0034 echo "-- Notes: to integrate this bundle to your desktop, use AppImageLauncher." 0035 echo "-- to enable all debug messages on the console, use 'export QT_LOGGING_RULES=\"digikam*=true\"'." 0036 echo "-- to extract the bundle contents locally, use option '--appimage-extract' on the command line." 0037 0038 if [[ "$(uname -m)" != "x86_64" ]] ; then 0039 0040 echo "!!! You trying to run a 64 bits binary on a 32 bits system. Aborted !!!" 0041 exit -1; 0042 0043 fi 0044 0045 # Show host OS name and version. 0046 0047 OS_NAME=$(awk '/DISTRIB_ID=/' /etc/*-release | sed 's/DISTRIB_ID=//' | sed 's/\"//' | sed 's/\"//' | tr '[:upper:]' '[:lower:]') 0048 OS_ARCH=$(uname -m | sed 's/x86_//;s/i[3-6]86/32/') 0049 OS_VERSION=$(awk '/DISTRIB_RELEASE=/' /etc/*-release | sed 's/DISTRIB_RELEASE=//' | sed 's/[.]0/./') 0050 0051 echo "-- Detected host Linux $OS_NAME-$OS_ARCH-$OS_VERSION" 0052 0053 # See bugs #414016, #414028, #415882, Qt fill log files with unwanted debug trace about locale rules. 0054 export QT_LOGGING_RULES="default*=false;"$QT_LOGGING_RULES 0055 0056 # try to make Qt apps more "native looking" on Gtk-based desktops, if possible 0057 # see https://github.com/AppImage/AppImageKit/issues/977#issue-462374883 0058 case "${XDG_CURRENT_DESKTOP}" in 0059 *GNOME*|*gnome*|*XFCE*) 0060 export QT_QPA_PLATFORMTHEME=gtk2 0061 ;; 0062 esac 0063 0064 DIR="`dirname \"$0\"`" 0065 DIR="`( cd \"$DIR\" && readlink -f $(pwd) )`" 0066 echo "-- AppImage mounted directory: $DIR" 0067 export APPDIR=$DIR 0068 0069 # Note: these variables are used in patched Qt to detect AppImage session. 0070 export APPIMAGE_ORIGINAL_LD_LIBRARY_PATH=$LD_LIBRARY_PATH 0071 export APPIMAGE_ORIGINAL_QT_PLUGIN_PATH=$QT_PLUGIN_PATH 0072 export APPIMAGE_ORIGINAL_XDG_DATA_DIRS=$XDG_DATA_DIRS 0073 export APPIMAGE_ORIGINAL_LD_PRELOAD=$LD_PRELOAD 0074 export APPIMAGE_ORIGINAL_PATH=$PATH 0075 0076 export LD_LIBRARY_PATH=$DIR/usr/lib/:$LD_LIBRARY_PATH 0077 export QT_PLUGIN_PATH=$DIR/usr/plugins/ 0078 0079 # See bug #427906 0080 if [ -d "/usr/share/X11/xkb/" ]; then 0081 export XKB_CONFIG_ROOT=/usr/share/X11/xkb/ 0082 fi 0083 0084 export XDG_DATA_DIRS=$DIR/usr/share/:$XDG_DATA_DIRS 0085 export PATH=$DIR/usr/bin:$DIR/usr/lib:$DIR/usr/lib/libexec/kf5:$DIR/usr/share/digikam/utils:$PATH 0086 0087 # Gphoto2 runtime environment 0088 export CAMLIBS=$DIR/usr/lib/libgphoto2 0089 export IOLIBS=$DIR/usr/lib/libgphoto2_port 0090 0091 # ImageMagick run-time environment 0092 export MAGICK_CODER_MODULE_PATH=$DIR/usr/lib/modules-Q16HDRI/coders 0093 export MAGICK_CODER_FILTER_PATH=$DIR/usr/lib/modules-Q16HDRI/filters 0094 0095 # QtWebEngine crash with some video card drivers 0096 # https://github.com/qutebrowser/qutebrowser/issues/2368 0097 export QT_XCB_FORCE_SOFTWARE_OPENGL=1 0098 export QTWEBENGINE_CHROMIUM_FLAGS="--disable-gpu" 0099 0100 # Code to disable Plasma desktop detection with QDesktopService 0101 export APPIMAGE_ORIGINAL_KDE_FULL_SESSION=$KDE_FULL_SESSION 0102 export APPIMAGE_ORIGINAL_DESKTOP_SESSION=$DESKTOP_SESSION 0103 export APPIMAGE_ORIGINAL_XDG_CURRENT_DESKTOP=$XDG_CURRENT_DESKTOP 0104 export APPIMAGE_ORIGINAL_XDG_SESSION_DESKTOP=$XDG_SESSION_DESKTOP 0105 #unset KDE_FULL_SESSION 0106 #unset DESKTOP_SESSION 0107 #unset XDG_CURRENT_DESKTOP 0108 #unset XDG_SESSION_DESKTOP 0109 0110 # if no customized Qt debug loggin variable is set, turn on one for a better readability 0111 0112 if [ -z "$QT_MESSAGE_PATTERN" ]; then 0113 export QT_MESSAGE_PATTERN="`echo -e "\033[34m%{function}\033[0m: %{message}"`" 0114 fi 0115 0116 export APPIMAGE_STARTUP_LD_LIBRARY_PATH=$LD_LIBRARY_PATH 0117 export APPIMAGE_STARTUP_QT_PLUGIN_PATH=$QT_PLUGIN_PATH 0118 export APPIMAGE_STARTUP_XDG_DATA_DIRS=$XDG_DATA_DIRS 0119 export APPIMAGE_STARTUP_PATH=$PATH 0120 0121 # See bug #401377: tested on Fedora 29 and Mageia 7 for transitional migration from openssl 1.0 to openssl 1.1 0122 if [ -f /etc/pki/openssl10.cnf ]; then 0123 export OPENSSL_CONF=/etc/pki/openssl10.cnf 0124 fi 0125 0126 # See Bug #109060 0127 if [ -f $DIR/usr/lib/libavif.so.13 ]; then 0128 export LD_PRELOAD=$LD_PRELOAD:$DIR/usr/lib/libavif.so.13 0129 fi 0130 0131 preload_shared_library libudev.so.0 0132 0133 # See bug #414737 0134 preload_shared_library libxcb-dri3.so.0 0135 0136 # See bug #447150 0137 preload_shared_library libcrypto.so.1.1 0138 preload_shared_library libssl.so.1.1 0139 0140 # See bug #449308 0141 preload_shared_library libnss3.so 0142 preload_shared_library libnssutil3.so 0143 preload_shared_library libsmime3.so 0144 0145 # See bug #451196 and #451780 0146 preload_shared_library libgmodule-2.0.so.0 0147 0148 # See bug #216915 0149 preload_shared_library libgnutls.so.30 0150 0151 # See bug #461495 0152 #preload_shared_library libpcre.so.3 0153 0154 #preload_shared_library libfontconfig.so.1 0155 #preload_shared_library libfreetype.so.6 0156 0157 echo "-- Preloading shared libs: $LD_PRELOAD" 0158 0159 # Parse CLI options. 0160 0161 if [[ $1 == "showfoto" ]] ; then 0162 0163 # Run Showfoto as well. 0164 showfoto ${@:2} 0165 0166 elif [[ $1 == "debug" ]] ; then 0167 0168 if [[ $2 == "showfoto" ]] ; then 0169 0170 # Showfoto in debug mode. 0171 0172 echo "Starting Showfoto into GDB..." 0173 echo "Use 'bt' command on debugger prompt to get a crash backtrace." 0174 echo "Use 'q' command to quit debugger session." 0175 gdb -ex=r --args showfoto ${@:3} 0176 0177 else 0178 0179 # digiKam in debug mode. 0180 0181 echo "Starting digiKam into GDB..." 0182 echo "Use 'bt' command on debugger prompt to get a crash backtrace." 0183 echo "Use 'q' command to quit debugger session." 0184 gdb -ex=r --args digikam ${@:2} 0185 0186 fi 0187 0188 elif [[ $1 == "help" ]] ; then 0189 0190 # digiKam/Showfoto/AVplayer CLI help. 0191 0192 echo "digiKam AppImage bundle CLI options:" 0193 echo " without option : run digiKam." 0194 echo " <showfoto> : run Showfoto instead digiKam." 0195 echo " <debug> : run digiKam into GDB." 0196 echo " <debug> <showfoto> : run Showfoto into GDB." 0197 echo " <help> : show these information." 0198 0199 else 0200 0201 # Run digiKam as well. 0202 0203 digikam $@ 0204 0205 fi