File indexing completed on 2025-01-19 03:59:49
0001 #!/bin/bash 0002 0003 # Script to bundle data using previously-built KF5 with digiKam installation 0004 # and create a Linux AppImage bundle file. 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 # Halt and catch errors 0012 set -eE 0013 trap 'PREVIOUS_COMMAND=$THIS_COMMAND; THIS_COMMAND=$BASH_COMMAND' DEBUG 0014 trap 'echo "FAILED COMMAND: $PREVIOUS_COMMAND"' ERR 0015 0016 ################################################################################################# 0017 # Manage script traces to log file 0018 0019 mkdir -p ./logs 0020 exec > >(tee ./logs/build-appimage.full.log) 2>&1 0021 0022 ################################################################################################# 0023 0024 echo "04-build-appimage.sh : build digiKam AppImage bundle." 0025 echo "-----------------------------------------------------" 0026 0027 ################################################################################################# 0028 # Pre-processing checks 0029 0030 . ./common.sh 0031 . ./config.sh 0032 ChecksRunAsRoot 0033 StartScript 0034 ChecksCPUCores 0035 HostAdjustments 0036 RegisterRemoteServers 0037 CheckSystemReleaseID 0038 0039 ################################################################################################# 0040 0041 # Working directory 0042 ORIG_WD="`pwd`" 0043 0044 DK_RELEASEID=`cat $ORIG_WD/data/RELEASEID.txt` 0045 0046 if [[ "$OS_NAME" == "ubuntu" ]] ; then 0047 0048 LIBSUFFIX="lib/x86_64-linux-gnu" 0049 0050 else 0051 0052 LIBSUFFIX="lib64" 0053 0054 fi 0055 0056 ################################################################################################# 0057 0058 echo -e "------------- Prepare directories in bundle\n" 0059 0060 # Make sure we build from the /, parts of this script depends on that. We also need to run as root... 0061 cd / 0062 0063 # Prepare the install location 0064 rm -rf $APP_IMG_DIR/ || true 0065 mkdir -p $APP_IMG_DIR/usr/bin 0066 mkdir -p $APP_IMG_DIR/usr/etc 0067 mkdir -p $APP_IMG_DIR/usr/share 0068 mkdir -p $APP_IMG_DIR/usr/share/icons 0069 mkdir -p $APP_IMG_DIR/usr/share/X11 0070 mkdir -p $APP_IMG_DIR/usr/share/metainfo 0071 mkdir -p $APP_IMG_DIR/usr/share/dbus-1/interfaces 0072 mkdir -p $APP_IMG_DIR/usr/share/dbus-1/services 0073 0074 # make sure lib and lib64 are the same thing 0075 mkdir -p $APP_IMG_DIR/usr/lib 0076 mkdir -p $APP_IMG_DIR/usr/lib/libexec 0077 mkdir -p $APP_IMG_DIR/usr/lib/libgphoto2 0078 mkdir -p $APP_IMG_DIR/usr/lib/libgphoto2_port 0079 cd $APP_IMG_DIR/usr 0080 ln -s lib lib64 0081 0082 ################################################################################################# 0083 0084 echo -e "------------- Copy Files in bundle\n" 0085 0086 cd $APP_IMG_DIR 0087 0088 # FIXME: How to find out which subset of plugins is really needed? I used strace when running the binary 0089 cp -r /usr/plugins ./usr/ 0090 rm -fr ./usr/plugins/ktexteditor 0091 rm -fr ./usr/plugins/kf5/parts 0092 rm -fr ./usr/plugins/konsolepart.so 0093 0094 # See bug #476290 0095 rm -fr ./usr/plugins/imageformats/libqjp2.so 0096 0097 echo -e "------------- Copy runtime data files\n" 0098 0099 cp -r /usr/share/digikam ./usr/share 0100 cp -r /usr/share/showfoto ./usr/share 0101 cp /usr/share/icons/breeze/breeze-icons.rcc ./usr/share/digikam/breeze.rcc 0102 cp /usr/share/icons/breeze-dark/breeze-icons-dark.rcc ./usr/share/digikam/breeze-dark.rcc 0103 0104 cd $APP_IMG_DIR/usr/share/showfoto 0105 ln -s ../digikam/breeze.rcc breeze.rcc 0106 ln -s ../digikam/breeze-dark.rcc breeze-dark.rcc 0107 0108 cd $APP_IMG_DIR 0109 cp $ORIG_WD/data/qt.conf ./usr/bin 0110 cp -r /usr/share/lensfun ./usr/share 0111 0112 if [[ $DK_QTVERSION == 5 ]] ; then 0113 0114 cp -r /usr/share/knotifications5 ./usr/share 0115 cp -r /usr/share/kservices5 ./usr/share 0116 cp -r /usr/share/kservicetypes5 ./usr/share 0117 cp -r /usr/share/kxmlgui5 ./usr/share 0118 cp -r /usr/share/kf5 ./usr/share 0119 0120 else 0121 0122 cp -r /usr/share/knotifications6 ./usr/share 0123 0124 # Not avaialble with KF6 0125 cp -r /usr/share/kservices6 ./usr/share || true 0126 cp -r /usr/share/kservicetypes6 ./usr/share || true 0127 0128 # KF6 still use kxmlgui5 subdir. 0129 cp -r /usr/share/kxmlgui5 ./usr/share 0130 cp -r /usr/share/kf6 ./usr/share 0131 0132 # WHY it's necessary, else application menu are broken... 0133 ln -s ./kxmlgui6 ./usr/share/kxmlgui5 0134 0135 fi 0136 0137 cp -r /usr/share/solid ./usr/share 0138 cp -r /usr/share/icu ./usr/share 0139 cp -r /usr/share/mime ./usr/share 0140 0141 # depending of OpenCV version installed, data directory is not the same. 0142 cp -r /usr/share/OpenCV ./usr/share || true 0143 cp -r /usr/share/opencv4 ./usr/share || true 0144 0145 # TODO check when kf6 prefix will be used here. 0146 cp -r /usr/share/dbus-1/services/*kde* ./usr/share/dbus-1/services/ 0147 0148 if [[ $DK_QTVERSION == 5 ]] ; then 0149 0150 cp -r /usr/share/dbus-1/interfaces/kf5* ./usr/share/dbus-1/interfaces/ 0151 cp -r /usr/${LIBSUFFIX}/libexec/kf5 ./usr/lib/libexec/ 0152 0153 else 0154 0155 cp -r /usr/share/dbus-1/interfaces/kf6* ./usr/share/dbus-1/interfaces/ 0156 cp -r /usr/${LIBSUFFIX}/libexec/kf6 ./usr/lib/libexec/ 0157 0158 fi 0159 0160 echo -e "------------- Copy AppImage stream data filess\n" 0161 0162 cp -r /usr/share/metainfo/org.kde.digikam.appdata.xml ./usr/share/metainfo 0163 cp -r /usr/share/metainfo/org.kde.showfoto.appdata.xml ./usr/share/metainfo 0164 0165 # NOTE: no resources data are provided with QtWebKit 0166 0167 if [[ $DK_QTWEBENGINE = 1 ]] ; then 0168 0169 echo -e "------------- Copy QWebEngine bin data files\n" 0170 0171 cp -r /usr/resources ./usr 0172 0173 fi 0174 0175 echo -e "------------- Copy libgphoto2 drivers\n" 0176 0177 find /usr/${LIBSUFFIX}/libgphoto2 -name "*.so" -type f -exec cp {} ./usr/lib/libgphoto2 \; 2>/dev/null 0178 find /usr/${LIBSUFFIX}/libgphoto2_port -name "*.so" -type f -exec cp {} ./usr/lib/libgphoto2_port \; 2>/dev/null 0179 0180 echo -e "------------- Copy sane backends\n" 0181 0182 cp -r /usr/${LIBSUFFIX}/sane ./usr/lib 0183 cp -r /etc/sane.d ./usr/etc 0184 0185 echo -e "------------- Copy I18n\n" 0186 0187 # Qt translations files 0188 0189 if [[ -e /usr/translations ]]; then 0190 0191 echo -e "------------- Copy Qt translations files\n" 0192 0193 cp -r /usr/translations ./usr 0194 ln -s ../../translations ./usr/share/digikam/translations 0195 ln -s ../../translations ./usr/share/showfoto/translations 0196 0197 # optimizations 0198 0199 rm -rf ./usr/translations/assistant* || true 0200 rm -rf ./usr/translations/designer* || true 0201 rm -rf ./usr/translations/linguist* || true 0202 rm -rf ./usr/translations/qmlviewer* || true 0203 rm -rf ./usr/translations/qtmultimedia* || true 0204 rm -rf ./usr/translations/qtscript* || true 0205 rm -rf ./usr/translations/qtquick* || true 0206 rm -rf ./usr/translations/qt_help* || true 0207 rm -rf ./usr/translations/qtserialport* || true 0208 rm -rf ./usr/translations/qtwebsockets* || true 0209 0210 fi 0211 0212 echo -e "------------- Copy KDE translations files\n" 0213 0214 FILES=$(cat $ORIG_WD/logs/build-extralibs.full.log | grep /usr/share/locale | grep -e .qm -e .mo | cut -d' ' -f3) 0215 0216 for FILE in $FILES ; do 0217 echo $FILE 0218 cp --parents $FILE ./ 0219 done 0220 0221 echo -e "------------- Copy digiKam translations files\n" 0222 0223 FILES=$(cat $ORIG_WD/logs/build-digikam.full.log | grep /usr/share/locale | grep -e .qm -e .mo | cut -d' ' -f3) 0224 0225 for FILE in $FILES ; do 0226 echo $FILE 0227 cp --parents $FILE ./ 0228 done 0229 0230 echo -e "------------- Copy digiKam icons files\n" 0231 0232 FILES=$(cat $ORIG_WD/logs/build-digikam.full.log | grep /usr/share/icons/ | cut -d' ' -f3) 0233 0234 for FILE in $FILES ; do 0235 if [[ $FILE != "touch:" ]] ; then 0236 echo $FILE 0237 cp --parents $FILE ./ 0238 fi 0239 done 0240 0241 echo -e "------------- Copy Git Revisions Manifest\n" 0242 0243 touch ./usr/share/digikam/MANIFEST.txt 0244 0245 FILES=$(ls $ORIG_WD/data/*_manifest.txt) 0246 0247 for FILE in $FILES ; do 0248 echo $FILE 0249 cat $FILE >> ./usr/share/digikam/MANIFEST.txt 0250 done 0251 0252 ln -s ../digikam/MANIFEST.txt ./usr/share/showfoto/MANIFEST.txt || true 0253 0254 echo -e "------------- Copy system libraries for binary compatibility\n" 0255 0256 # otherwise segfaults!? 0257 0258 cp $(ldconfig -p | grep /${LIBSUFFIX}/libsasl2.so.2 | cut -d ">" -f 2 | xargs) ./usr/lib/ 0259 cp $(ldconfig -p | grep /${LIBSUFFIX}/libGL.so.1 | cut -d ">" -f 2 | xargs) ./usr/lib/ 0260 cp $(ldconfig -p | grep /${LIBSUFFIX}/libGLU.so.1 | cut -d ">" -f 2 | xargs) ./usr/lib/ 0261 0262 # Fedora 23 seemed to be missing SOMETHING from the Centos 6.7. The only message was: 0263 # This application failed to start because it could not find or load the Qt platform plugin "xcb". 0264 # Setting export QT_DEBUG_PLUGINS=1 revealed the cause. 0265 # QLibraryPrivate::loadPlugin failed on "/usr/lib64/qt5/plugins/platforms/libqxcb.so" : 0266 # "Cannot load library /usr/lib64/qt5/plugins/platforms/libqxcb.so: (/lib64/libEGL.so.1: undefined symbol: drmGetNodeTypeFromFd)" 0267 # Which means that we have to copy libEGL.so.1 in too 0268 0269 # Otherwise F23 cannot load the Qt platform plugin "xcb" 0270 cp $(ldconfig -p | grep /${LIBSUFFIX}/libEGL.so.1 | cut -d ">" -f 2 | xargs) ./usr/lib/ 0271 0272 # let's not copy xcb itself, that breaks on dri3 systems https://bugs.kde.org/show_bug.cgi?id=360552 0273 #cp $(ldconfig -p | grep libxcb.so.1 | cut -d ">" -f 2 | xargs) ./usr/lib/ 0274 0275 # For Fedora 20 0276 cp $(ldconfig -p | grep /${LIBSUFFIX}/libfreetype.so.6 | cut -d ">" -f 2 | xargs) ./usr/lib/ 0277 0278 echo -e "---------- Copy target binaries\n" 0279 0280 cp /usr/bin/digikam ./usr/bin 0281 cp /usr/bin/showfoto ./usr/bin 0282 0283 if [[ $DK_QTVERSION == 5 ]] ; then 0284 0285 cp /usr/bin/kbuildsycoca5 ./usr/bin 0286 cp /usr/bin/solid-hardware5 ./usr/bin 0287 0288 else 0289 0290 cp /usr/bin/kbuildsycoca6 ./usr/bin 0291 cp /usr/bin/solid-hardware6 ./usr/bin 0292 0293 fi 0294 0295 if [[ $DK_QTWEBENGINE = 1 ]] ; then 0296 0297 echo -e "------------- Copy QtWebEngine runtime process\n" 0298 0299 [[ -e /usr/libexec/QtWebEngineProcess ]] && cp /usr/libexec/QtWebEngineProcess ./usr/bin 0300 0301 else 0302 0303 echo -e "------------- Copy QtWebKit runtime process\n" 0304 0305 [[ -e /usr/libexec/QtWebNetworkProcess ]] && cp /usr/libexec/QtWebNetworkProcess ./usr/bin 0306 [[ -e /usr/libexec/QtWebProcess ]] && cp /usr/libexec/QtWebProcess ./usr/bin 0307 [[ -e /usr/libexec/QtWebStorageProcess ]] && cp /usr/libexec/QtWebStorageProcess ./usr/bin 0308 [[ -e /usr/libexec/QtWebPluginProcess ]] && cp /usr/libexec/QtWebPluginProcess ./usr/bin 0309 0310 fi 0311 0312 echo -e "------------- Copy Solid binary\n" 0313 0314 # For Solid action when camera is connected to computer 0315 cp /usr/bin/qdbus ./usr/share/digikam/utils 0316 sed -i "/Exec=/c\Exec=digikam-camera downloadFromUdi %i" ./usr/share/solid/actions/digikam-opencamera.desktop 0317 0318 ################################################################################################# 0319 0320 echo -e "------------- Scan dependencies recurssively\n" 0321 0322 CopyReccursiveDependencies /usr/bin/digikam ./usr/lib 0323 CopyReccursiveDependencies /usr/bin/showfoto ./usr/lib 0324 CopyReccursiveDependencies /usr/plugins/platforms/libqxcb.so ./usr/lib 0325 0326 FILES=$(ls /usr/${LIBSUFFIX}/libdigikam*.so) 0327 0328 for FILE in $FILES ; do 0329 CopyReccursiveDependencies ${FILE} ./usr/lib 0330 done 0331 0332 FILES=$(ls /usr/plugins/imageformats/*.so) 0333 0334 for FILE in $FILES ; do 0335 CopyReccursiveDependencies ${FILE} ./usr/lib 0336 done 0337 0338 FILES=$(find /usr/plugins/digikam -name "*.so") 0339 0340 for FILE in $FILES ; do 0341 CopyReccursiveDependencies ${FILE} ./usr/lib 0342 done 0343 0344 # Copy in the indirect dependencies 0345 FILES=$(find . -type f -executable) 0346 0347 for FILE in $FILES ; do 0348 CopyReccursiveDependencies ${FILE} ./usr/lib 0349 done 0350 0351 ################################################################################################# 0352 0353 echo -e "---------- Clean-up Bundle Directory Contents\n" 0354 0355 # The following are assumed to be part of the base system 0356 0357 # This list is taken from linuxdeployqt 0358 # [https://github.com/probonopd/linuxdeployqt/blob/master/tools/linuxdeployqt/excludelist.h] 0359 # NOTES: 0360 # Libglapi is included explicitly in Krita exclude list. 0361 # With the transition from Mageia6 to 7 to build AppImage libnss* must be included in the bundle (see bug #440689) 0362 # With the transition from Mageia7 to Ubuntu 18.04 to build AppImage libnsl* must be included in the bundle (see bug #455922) 0363 0364 EXCLUDE_FILES="\ 0365 ld-linux.so.2 \ 0366 ld-linux-x86-64.so.2 \ 0367 libanl.so.1 \ 0368 libasound.so.2 \ 0369 libBrokenLocale.so.1 \ 0370 libcidn.so.1 \ 0371 libcom_err.so.2 \ 0372 libcrypt.so.1 \ 0373 libc.so.6 \ 0374 libdl.so.2 \ 0375 libdrm.so.2 \ 0376 libexpat.so.1 \ 0377 libfontconfig.so.1 \ 0378 libfreetype.so.6 \ 0379 libgcc_s.so.1 \ 0380 libgdk_pixbuf-2.0.so.0 \ 0381 libgio-2.0.so.0 \ 0382 libglapi.so.0 \ 0383 libglib-2.0.so.0 \ 0384 libGL.so.1 \ 0385 libgobject-2.0.so.0 \ 0386 libgpg-error.so.0 \ 0387 libharfbuzz.so.0 \ 0388 libICE.so.6 \ 0389 libjack.so.0 \ 0390 libm.so.6 \ 0391 libmvec.so.1 \ 0392 libp11-kit.so.0 \ 0393 libpangocairo-1.0.so.0 \ 0394 libpthread.so.0 \ 0395 libresolv.so.2 \ 0396 librt.so.1 \ 0397 libSM.so.6 \ 0398 libstdc++.so.6 \ 0399 libthai.so.0 \ 0400 libthread_db.so.1 \ 0401 libusb-1.0.so.0 \ 0402 libutil.so.1 \ 0403 libuuid.so.1 \ 0404 libX11.so.6 \ 0405 libxcb.so.1 \ 0406 " 0407 0408 for FILE in $EXCLUDE_FILES ; do 0409 if [[ -f usr/lib/${FILE} ]] ; then 0410 echo -e " ==> ${FILE} will be removed from the bundle" 0411 rm -f usr/lib/${FILE} 0412 else 0413 echo -e " ==> ${FILE} DO OT EXISTS!!!" 0414 fi 0415 done 0416 0417 # This list is taken from older AppImage build script from krita 0418 # NOTE: libopenal => see bug 390162. 0419 # libdbus-1 => see Krita rules. 0420 # libxcb-dri3 => see bug 417088. 0421 # libidn2.so.0 => Ubuntu 22.04 0422 0423 EXTRA_EXCLUDE_FILES="\ 0424 libgssapi_krb5.so.2 \ 0425 libgssapi.so.3 \ 0426 libhcrypto.so.4 \ 0427 libheimbase.so.1 \ 0428 libheimntlm.so.0 \ 0429 libhx509.so.5 \ 0430 libidn.so.11 \ 0431 libidn2.so.0 \ 0432 libk5crypto.so.3 \ 0433 libkrb5.so.26 \ 0434 libkrb5.so.3 \ 0435 libkrb5support.so.0 \ 0436 libroken.so.18 \ 0437 libsasl2.so.2 \ 0438 libwind.so.0 \ 0439 libopenal.so.1 \ 0440 libdbus-1.so.3 \ 0441 libxcb-dri3.so.0 \ 0442 " 0443 0444 #liblber-2.4.so.2 # needed for Debian Wheezy 0445 #libldap_r-2.4.so.2 # needed for Debian Wheezy 0446 0447 #libffi.so.6 # needed for Ubuntu 11.04 0448 #libxcb-glx.so.0 # needed for Ubuntu 11.04 0449 0450 #libkeyutils.so.1 # Originally removed in linuxdeployqt, but needed for Gentoo (see https://bugs.kde.org/show_bug.cgi?id=406171#c2) 0451 #libz.so.1 # needed for Mint 18.1 (see http://digikam.1695700.n4.nabble.com/digikam-6-2-0-64-bit-appimage-error-td4708921.html) 0452 0453 #libpango-1.0.so.0 0454 #libpangoft2-1.0.so.0 0455 0456 for FILE in $EXTRA_EXCLUDE_FILES ; do 0457 if [[ -f usr/lib/${FILE} ]] ; then 0458 echo -e " ==> ${FILE} will be removed from the bundle" 0459 rm -f usr/lib/${FILE} 0460 else 0461 echo -e " ==> ${FILE} DO NOT EXISTS!!!" 0462 fi 0463 done 0464 0465 if [[ -f usr/lib/libssl.so.1.1 ]] ; then 0466 0467 ln -s libssl.so.1.1 usr/lib/libssl.so || true 0468 0469 fi 0470 0471 # We don't bundle the developer stuff 0472 rm -rf usr/include || true 0473 rm -rf usr/lib/cmake3 || true 0474 rm -rf usr/lib/pkgconfig || true 0475 rm -rf usr/share/ECM/ || true 0476 rm -rf usr/share/gettext || true 0477 rm -rf usr/share/pkgconfig || true 0478 0479 ################################################################################################# 0480 # See LFS instruction: http://www.linuxfromscratch.org/lfs/view/systemd/chapter05/stripping.html 0481 0482 echo -e "------------- Strip Symbols in Binaries Files\n" 0483 0484 if [[ $DK_DEBUG = 1 ]] ; then 0485 FILES=$(find . -type f -exec file {} \; | grep ELF | grep -Ev '(digikam|showfoto)' | cut -d':' -f1) 0486 # FILES=$(find . -type f -executable | grep -Ev '(digikam|showfoto)') 0487 else 0488 FILES=$(find . -type f -exec file {} \; | grep ELF | cut -d':' -f1) 0489 # FILES=$(find . -type f -executable) 0490 fi 0491 0492 for FILE in $FILES ; do 0493 echo -en "Strip symbols in: $FILE\n" 0494 /usr/bin/strip --strip-all ${FILE} || true 0495 done 0496 0497 ################################################################################################# 0498 0499 echo -e "------------- Strip Configuration Files \n" 0500 0501 # Since we set $APP_IMG_DIR as the prefix, we need to patch it away too (FIXME) 0502 # Probably it would be better to use /app as a prefix because it has the same length for all apps 0503 cd usr/ ; find . -type f -exec sed -i -e 's|$APP_IMG_DIR/usr/|./././././././././|g' {} \; ; cd .. 0504 0505 # On openSUSE Qt is picking up the wrong libqxcb.so 0506 # (the one from the system when in fact it should use the bundled one) - is this a Qt bug? 0507 # Also, digiKam has a hardcoded /usr which we patch away 0508 cd usr/ ; find . -type f -exec sed -i -e 's|/usr|././|g' {} \; ; cd .. 0509 0510 # We do not bundle this, so let's not search that inside the AppImage. 0511 # Fixes "Qt: Failed to create XKB context!" and lets us enter text 0512 sed -i -e 's|././/share/X11/|/usr/share/X11/|g' ./usr/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so 0513 0514 if [[ $DK_QTVERSION == 6 ]] ; then 0515 0516 sed -i -e 's|././/share/X11/|/usr/share/X11/|g' ./usr/lib/libQt6XcbQpa.so.6 0517 0518 else 0519 0520 sed -i -e 's|././/share/X11/|/usr/share/X11/|g' ./usr/lib/libQt5XcbQpa.so.5 0521 0522 fi 0523 0524 ################################################################################################# 0525 # Install ExifTool binary. 0526 0527 cd $DOWNLOAD_DIR 0528 0529 #if [ ! -f $DOWNLOAD_DIR/Image-ExifTool.tar.gz ] ; then 0530 wget --no-check-certificate https://files.kde.org/digikam/exiftool/Image-ExifTool.tar.gz -O Image-ExifTool.tar.gz 0531 #fi 0532 0533 tar -xvf $DOWNLOAD_DIR/Image-ExifTool.tar.gz -C $APP_IMG_DIR/usr/bin 0534 mv $APP_IMG_DIR/usr/bin/Image-ExifTool* $APP_IMG_DIR/usr/bin/Image-ExifTool 0535 0536 cd $APP_IMG_DIR/usr/bin 0537 ln -s ./Image-ExifTool/exiftool exiftool 0538 0539 ################################################################################################# 0540 0541 cd / 0542 0543 APP=digiKam 0544 0545 if [[ $DK_DEBUG = 1 ]] ; then 0546 DEBUG_SUF="-debug" 0547 fi 0548 0549 if [[ $DK_VERSION != v* ]] ; then 0550 0551 # with non-official release version, use build time-stamp as sub-version string. 0552 DK_SUBVER="-`cat $ORIG_WD/data/BUILDDATE.txt`" 0553 0554 else 0555 0556 # with official release version, disable upload to KDE server, as this break check for new version function. 0557 echo -e "Official release version detected, upload is disabled.\n" 0558 DK_UPLOAD=0 0559 0560 fi 0561 0562 if [[ $DK_QTVERSION == 5 ]] ; then 0563 0564 # No prefix for the Qt5 version. 0565 QT_SUF="" 0566 0567 else 0568 0569 QT_SUF="-Qt6" 0570 0571 fi 0572 0573 APPIMAGE=$APP"-"$DK_RELEASEID$DK_SUBVER"-x86-64$QT_SUF$DEBUG_SUF.appimage" 0574 0575 echo -e "------------- Create Bundle with AppImage SDK stage1\n" 0576 0577 # Source functions 0578 0579 if [[ ! -s ./functions.sh ]] ; then 0580 wget --no-check-certificate https://github.com/probonopd/AppImages/raw/master/functions.sh -O ./functions.sh 0581 fi 0582 0583 # Install desktopintegration in usr/bin/digikam.wrapper 0584 cd $APP_IMG_DIR 0585 0586 # We will use a dedicated bash script to run inside the AppImage to be sure that XDG_* variable are set for Qt5 0587 cp ${ORIG_WD}/data/AppRun ./ 0588 0589 # desktop integration files 0590 0591 cp /usr/share/applications/org.kde.digikam.desktop ./ 0592 cp /usr/share/icons/hicolor/256x256/apps/digikam.png ./digikam.png 0593 cp /usr/share/icons/hicolor/256x256/apps/digikam.png ./.DirIcon 0594 0595 mkdir -p $APP_IMG_DIR/usr/share/icons/default/128x128/apps 0596 cp -r /usr/share/icons/hicolor/128x128/apps/digikam.png ./usr/share/icons/default/128x128/apps/digikam.png 0597 0598 mkdir -p $APP_IMG_DIR/usr/share/icons/default/128x128/mimetypes 0599 cp -r /usr/share/icons/hicolor/128x128/apps/digikam.png ./usr/share/icons/default/128x128/mimetypes/application-vnd.digikam.png 0600 0601 mkdir -p $ORIG_WD/bundle 0602 0603 rm -f $ORIG_WD/bundle/*x86-64*$DEBUG_SUF* || true 0604 0605 echo -e "---------- Create Bundle with AppImage SDK stage2\n" 0606 0607 cd / 0608 0609 # Get right version of Appimage toolkit. 0610 0611 APPIMGBIN=AppImageTool-x86_64.AppImage 0612 0613 if [[ ! -s ./$APPIMGBIN ]] ; then 0614 wget --no-check-certificate https://github.com/AppImage/AppImageKit/releases/download/continuous/$APPIMGBIN -O ./$APPIMGBIN 0615 fi 0616 0617 chmod a+x ./$APPIMGBIN 0618 0619 ARCH=x86_64 ./$APPIMGBIN --comp xz $APP_IMG_DIR/ $ORIG_WD/bundle/$APPIMAGE 0620 chmod a+rwx $ORIG_WD/bundle/$APPIMAGE 0621 0622 ################################################################################################# 0623 # Show resume information and future instructions to host installer file to remote server 0624 0625 echo -e "\n---------- Compute package checksums for digiKam $DK_RELEASEID\n" > $ORIG_WD/bundle/$APPIMAGE.sum 0626 echo "File : $APPIMAGE" >> $ORIG_WD/bundle/$APPIMAGE.sum 0627 echo -n "Size : " >> $ORIG_WD/bundle/$APPIMAGE.sum 0628 du -h "$ORIG_WD/bundle/$APPIMAGE" | { read first rest ; echo $first ; } >> $ORIG_WD/bundle/$APPIMAGE.sum 0629 echo -n "SHA256 sum : " >> $ORIG_WD/bundle/$APPIMAGE.sum 0630 sha256sum "$ORIG_WD/bundle/$APPIMAGE" | { read first rest ; echo $first ; } >> $ORIG_WD/bundle/$APPIMAGE.sum 0631 0632 # Checksums to post on Phabricator at release time. 0633 sha256sum "$ORIG_WD/bundle/$APPIMAGE" > $ORIG_WD/bundle/sha256_release.sum 0634 0635 if [[ $DK_SIGN = 1 ]] ; then 0636 0637 cat ~/.gnupg/dkorg-gpg-pwd.txt | gpg --batch --yes --passphrase-fd 0 -sabv "$ORIG_WD/bundle/$APPIMAGE" 0638 mv -f $ORIG_WD/bundle/$APPIMAGE.asc $ORIG_WD/bundle/$APPIMAGE.sig 0639 0640 echo "File : $APPIMAGE.sig" >> $ORIG_WD/bundle/$APPIMAGE.sum 0641 echo -n "Size : " >> $ORIG_WD/bundle/$APPIMAGE.sum 0642 du -h "$ORIG_WD/bundle/$APPIMAGE.sig" | { read first rest ; echo $first ; } >> $ORIG_WD/bundle/$APPIMAGE.sum 0643 echo -n "SHA256 sum : " >> $ORIG_WD/bundle/$APPIMAGE.sum 0644 sha256sum "$ORIG_WD/bundle/$APPIMAGE.sig" | { read first rest ; echo $first ; } >> $ORIG_WD/bundle/$APPIMAGE.sum 0645 0646 # Checksums to post on Phabricator at release time. 0647 sha256sum "$ORIG_WD/bundle/$APPIMAGE.sig" >> $ORIG_WD/bundle/sha256_release.sum 0648 0649 fi 0650 0651 cat $ORIG_WD/bundle/$APPIMAGE.sum 0652 0653 if [[ $DK_UPLOAD = 1 ]] ; then 0654 0655 echo -e "---------- Cleanup older bundle AppImage files from files.kde.org repository \n" 0656 0657 sftp -q $DK_UPLOADURL:$DK_UPLOADDIR <<< "rm *-x86-64*$DEBUG_SUF.appimage*" 0658 0659 echo -e "---------- Upload new bundle AppImage files to files.kde.org repository \n" 0660 0661 rsync -r -v --progress -e ssh $ORIG_WD/bundle/$APPIMAGE $DK_UPLOADURL:$DK_UPLOADDIR 0662 0663 if [[ $DK_SIGN = 1 ]] ; then 0664 scp $ORIG_WD/bundle/$APPIMAGE.sig $DK_UPLOADURL:$DK_UPLOADDIR 0665 fi 0666 0667 # update remote files list 0668 0669 sftp -q $DK_UPLOADURL:$DK_UPLOADDIR <<< "ls digi*" > $ORIG_WD/bundle/ls.txt 0670 tail -n +2 $ORIG_WD/bundle/ls.txt > $ORIG_WD/bundle/ls.tmp 0671 cat $ORIG_WD/bundle/ls.tmp | grep -E '(.pkg |.appimage |.exe )' | grep -Ev '(debug)' > $ORIG_WD/bundle/FILES 0672 rm $ORIG_WD/bundle/ls.tmp 0673 rm $ORIG_WD/bundle/ls.txt 0674 sftp -q $DK_UPLOADURL:$DK_UPLOADDIR <<< "rm FILES" 0675 rsync -r -v --progress -e ssh $ORIG_WD/bundle/FILES $DK_UPLOADURL:$DK_UPLOADDIR 0676 0677 else 0678 echo -e "\n------------------------------------------------------------------" 0679 curl https://download.kde.org/README_UPLOAD 0680 echo -e "------------------------------------------------------------------\n" 0681 fi 0682 0683 ################################################################################################# 0684 0685 TerminateScript