File indexing completed on 2024-06-16 04:06:50

0001 #! /bin/bash
0002 
0003 # Script to bundle data using previously-built KDE and digiKam installation
0004 # and create a Windows installer file with NSIS application
0005 # Dependencies:
0006 #   - NSIS makensis program for Windows.
0007 #   - DumpBin from VSCommunity C++ profiling tools.
0008 #   - ImageMagick for the rune-time dll.
0009 #   - Msys2/Rsync CLI tools for Windows.
0010 #
0011 # SPDX-FileCopyrightText: 2015-2024 by Gilles Caulier  <caulier dot gilles at gmail dot com>
0012 #
0013 # SPDX-License-Identifier: BSD-3-Clause
0014 #
0015 
0016 # Halt and catch errors
0017 set -eE
0018 trap 'PREVIOUS_COMMAND=$THIS_COMMAND; THIS_COMMAND=$BASH_COMMAND' DEBUG
0019 trap 'echo "FAILED COMMAND: $PREVIOUS_COMMAND"' ERR
0020 
0021 export LANG=C
0022 
0023 #################################################################################################
0024 # Manage script traces to log file
0025 
0026 mkdir -p ./logs
0027 exec > >(tee ./logs/build-installer.full.log) 2>&1
0028 
0029 #################################################################################################
0030 
0031 echo "04-build-installer.sh : build digiKam Windows installer."
0032 echo "--------------------------------------------------------"
0033 
0034 #################################################################################################
0035 # Pre-processing checks
0036 
0037 . ./config.sh
0038 . ./common.sh
0039 StartScript
0040 ChecksCPUCores
0041 RegisterRemoteServers
0042 AppendVCPKGPaths
0043 
0044 #################################################################################################
0045 
0046 # Check if NSIS CLI tool is installed.
0047 
0048 if ! which "/c/Program Files (x86)/NSIS/Bin/makensis" ; then
0049     echo "NSIS CLI tool is not installed"
0050     echo "Install Msys2::nsis with pacman tool."
0051     exit 1
0052 else
0053     echo "Check NSIS CLI tools passed..."
0054 fi
0055 
0056 # Check if DumpBin CLI tool is installed.
0057 
0058 DUMP_BIN="`find "/c/Program Files/Microsoft Visual Studio/" -name "dumpbin.exe" -type f -executable | grep 'Hostx64/x64/dumpbin.exe'`"
0059 echo "$DUMP_BIN"
0060 
0061 if [ ! -f "$DUMP_BIN" ] ; then
0062     echo "DumpBin CLI tool is not installed"
0063     echo "Install VSCommunity C++ Profiling tools component."
0064     exit 1
0065 else
0066     echo "Check DumpBin CLI tools passed..."
0067 fi
0068 
0069 # Check for the ImageMagick install directory.
0070 
0071 MAGICK_PREFIX="`find "/c/Program Files/" -maxdepth 1 -name "ImageMagick*" -type d`"
0072 echo "$MAGICK_PREFIX"
0073 
0074 if [ ! -d "$MAGICK_PREFIX" ] ; then
0075     echo "ImageMagick is not installed"
0076     exit 1
0077 else
0078     echo "Check ImageMagick install path passed..."
0079 fi
0080 
0081 #################################################################################################
0082 # Configurations
0083 
0084 # Directory where this script is located (default - current directory)
0085 BUILDDIR="$PWD"
0086 
0087 # Directory where bundle files are located
0088 BUNDLEDIR="$BUILDDIR/temp"
0089 
0090 ORIG_WD="`pwd`"
0091 
0092 DK_RELEASEID=`cat $ORIG_WD/data/RELEASEID.txt`
0093 
0094 #################################################################################################
0095 # Copy files
0096 
0097 echo -e "\n---------- Preparing files to host in the bundle"
0098 
0099 # Directories creation -----------------------------------------------------------------------
0100 
0101 cd $ORIG_WD
0102 
0103 if [ -d "$BUNDLEDIR" ] ; then
0104     echo "Cleanup temporary directory $BUNDLEDIR..."
0105     rm -fr "$BUNDLEDIR"
0106     mkdir "$BUNDLEDIR"
0107 fi
0108 
0109 mkdir -p $BUNDLEDIR/data
0110 mkdir -p $BUNDLEDIR/etc
0111 mkdir -p $BUNDLEDIR/share
0112 mkdir -p $BUNDLEDIR/translations
0113 
0114 # Data files ---------------------------------------------------------------------------------
0115 
0116 echo -e "\n---------- Generics data"
0117 cp -r $VCPKG_INSTALL_PREFIX/share/lensfun                                 $BUNDLEDIR/data                       2>/dev/null
0118 cp -r $VCPKG_INSTALL_PREFIX/share/digikam                                 $BUNDLEDIR/data                       2>/dev/null
0119 cp -r $VCPKG_INSTALL_PREFIX/share/showfoto                                $BUNDLEDIR/data                       2>/dev/null
0120 cp -r $VCPKG_INSTALL_PREFIX/share/solid                                   $BUNDLEDIR/data                       2>/dev/null
0121 cp -r $VCPKG_INSTALL_PREFIX/share/kxmlgui5                                $BUNDLEDIR/data                       2>/dev/null
0122 cp -r $VCPKG_INSTALL_PREFIX/share/knotifications6                         $BUNDLEDIR/data                       2>/dev/null
0123 cp -r $VCPKG_INSTALL_PREFIX/bin/data/k*                                   $BUNDLEDIR/data                       2>/dev/null
0124 cp -r $VCPKG_INSTALL_PREFIX/resources                                     $BUNDLEDIR/                           2>/dev/null
0125 
0126 echo -e "\n---------- Qt config"
0127 cp    $BUILDDIR/data/qt.conf                                              $BUNDLEDIR/                           2>/dev/null
0128 
0129 echo -e "\n---------- icons-set"
0130 # Temporary solution until breeze-icons generator works under windows.
0131 cp    $BUILDDIR/data/breeze.rcc                                           $BUNDLEDIR/breeze.rcc                 2>/dev/null
0132 cp    $BUILDDIR/data/breeze-dark.rcc                                      $BUNDLEDIR/breeze-dark.rcc            2>/dev/null
0133 #cp    $VCPKG_INSTALL_PREFIX/bin/data/icons/breeze/breeze-icons.rcc               $BUNDLEDIR/breeze.rcc          2>/dev/null
0134 #cp    $VCPKG_INSTALL_PREFIX/bin/data/icons/breeze-dark/breeze-icons-dark.rcc     $BUNDLEDIR/breeze-dark.rcc     2>/dev/null
0135 cp -r $VCPKG_INSTALL_PREFIX/share/icons                                   $BUNDLEDIR/data                       2>/dev/null
0136 
0137 echo -e "\n---------- i18n"
0138 # Qt framekork translations
0139 cp -r $VCPKG_INSTALL_PREFIX/translations/Qt6/*                            $BUNDLEDIR/translations               2>/dev/null
0140 rm -fr $BUNDLEDIR/translations/assistant*.qm
0141 rm -fr $BUNDLEDIR/translations/designer*.qm
0142 rm -fr $BUNDLEDIR/translations/linguist*.qm
0143 rm -fr $BUNDLEDIR/translations/qt_help*.qm
0144 # KDE framework translations
0145 cp -r $VCPKG_INSTALL_PREFIX/bin/data/locale                               $BUNDLEDIR/data                       2>/dev/null
0146 # digiKam translations
0147 cp -r $VCPKG_INSTALL_PREFIX/share/locale                                  $BUNDLEDIR/data                       2>/dev/null
0148 
0149 # See bug 471058
0150 echo -e "\n---------- Freedesktop"
0151 mkdir -p $BUNDLEDIR/share/mime/packages/                                                                        2>/dev/null
0152 cp -r  $ORIG_WD/data/freedesktop.org.xml                                  $BUNDLEDIR/share/mime/packages        2>/dev/null
0153 
0154 echo -e "\n---------- Copy Git Revisions Manifest"
0155 
0156 touch $BUNDLEDIR/MANIFEST.txt
0157 
0158 FILES=$(ls $ORIG_WD/data/*_manifest.txt)
0159 
0160 for FILE in $FILES ; do
0161     echo $FILE
0162     cat $FILE >> $BUNDLEDIR/MANIFEST.txt
0163 done
0164 
0165 # Plugins Shared libraries -------------------------------------------------------------------
0166 
0167 echo -e "\n---------- Qt6 plugins"
0168 cp -r $VCPKG_INSTALL_PREFIX/Qt6/plugins                                   $BUNDLEDIR/                           2>/dev/null
0169 
0170 echo -e "\n---------- OpenGl Software for Qt6"
0171 # Taken from https://download.qt.io/development_releases/prebuilt/llvmpipe/windows/
0172 # See bug #479148
0173 cp -r $ORIG_WD/data/opengl32sw.dll                                        $BUNDLEDIR/                           2>/dev/null
0174 
0175 echo -e "\n---------- ImageMagick"
0176 
0177 cp -r "$MAGICK_PREFIX"/CORE_RL_*.dll                                      $BUNDLEDIR/                           2>/dev/null
0178 cp -r "$MAGICK_PREFIX"/modules/coders/*.dll                               $BUNDLEDIR/                           2>/dev/null
0179 cp -r "$MAGICK_PREFIX"/modules/filters/*.dll                              $BUNDLEDIR/                           2>/dev/null
0180 
0181 # Black-list of ImageMagick coders to not host in the bundles.
0182 # Prior digiKam/Qt image loaders first which provides the same type-mimes.
0183 
0184 IM_CODERS_BL="\
0185 $BUNDLEDIR/IM_MOD_RL_dng_.dll   \
0186 $BUNDLEDIR/IM_MOD_RL_exr_.dll   \
0187 $BUNDLEDIR/IM_MOD_RL_gif_.dll   \
0188 $BUNDLEDIR/IM_MOD_RL_hdr_.dll   \
0189 $BUNDLEDIR/IM_MOD_RL_heic_.dll  \
0190 $BUNDLEDIR/IM_MOD_RL_jp2_.dll   \
0191 $BUNDLEDIR/IM_MOD_RL_jpeg_.dll  \
0192 $BUNDLEDIR/IM_MOD_RL_jxl_.dll   \
0193 $BUNDLEDIR/IM_MOD_RL_ora_.dll   \
0194 $BUNDLEDIR/IM_MOD_RL_pcx_.dll   \
0195 $BUNDLEDIR/IM_MOD_RL_pdf_.dll   \
0196 $BUNDLEDIR/IM_MOD_RL_png_.dll   \
0197 $BUNDLEDIR/IM_MOD_RL_psd_.dll   \
0198 $BUNDLEDIR/IM_MOD_RL_raw_.dll   \
0199 $BUNDLEDIR/IM_MOD_RL_svg_.dll   \
0200 $BUNDLEDIR/IM_MOD_RL_tga_.dll   \
0201 $BUNDLEDIR/IM_MOD_RL_tiff_.dll  \
0202 $BUNDLEDIR/IM_MOD_RL_video_.dll \
0203 $BUNDLEDIR/IM_MOD_RL_wbmp_.dll  \
0204 $BUNDLEDIR/IM_MOD_RL_webp_.dll  \
0205 $BUNDLEDIR/IM_MOD_RL_xcf_.dll   \
0206 "
0207 
0208 for coder in $IM_CODERS_BL ; do
0209 
0210     rm -rf "$coder"
0211 
0212 done
0213 
0214 #################################################################################################
0215 # Add debug symbols for few binary files to optimize space.
0216 # NOTE: NSIS only support < 2Gb of file to package in the same installer. If size is bigger, a bus error exception is genenrated.
0217 # Only the digiKam shared libraries debug symbols are preserved. All digiKam plugins are not present.
0218 
0219 # First drop all existing pdb files from the bundles if any.
0220 
0221 echo -e "\n---------- Clean up debug symbols in the bundle"
0222 
0223 PDB_FILES="`find "$BUNDLEDIR"/plugins -name "*.pdb" -type f`"
0224 
0225 for pdb in $PDB_FILES ; do
0226 
0227     if [ "$DK_DEBUG" = 0 ] ; then
0228 
0229         # In non debug clean all
0230 
0231         echo "   (ND del) ==> $pdb"
0232         rm -rf "$pdb"
0233 
0234 #    NOTE: due to size limitation of NSIS archive to 2Gb,
0235 #    the number of extra debug symbols must be limited.
0236 #
0237 #    elif [[ "$pdb" = *"plugins/digikam"* ]] ; then
0238 #
0239 #        # In debug preserve digiKam Plugins
0240 #
0241 #        echo "   (Skip) ==> $pdb"
0242 
0243     else
0244 
0245         echo "   (DB del) ==> $pdb"
0246         rm -rf "$pdb"
0247 
0248     fi
0249 
0250 done
0251 
0252 # Second add only wanted pdb files in the bundles
0253 
0254 if [ "$DK_DEBUG" = 1 ] ; then
0255 
0256     echo -e "\n---------- Add necessary debug symbols in the bundle"
0257 
0258     # digikam libs
0259     cp -rv "$VCPKG_INSTALL_PREFIX"/bin/digikam*.pdb                        $BUNDLEDIR/                           2>/dev/null
0260 
0261 fi
0262 
0263 echo -e "\n---------- Copy executables with recursive dependencies in bundle directory\n"
0264 
0265 # Executables and plugins shared libraries dependencies scan ---------------------------------
0266 
0267 EXE_FILES="\
0268 $VCPKG_INSTALL_PREFIX/bin/digikam.exe                      \
0269 $VCPKG_INSTALL_PREFIX/bin/showfoto.exe                     \
0270 $VCPKG_INSTALL_PREFIX/bin/kbuildsycoca6.exe                \
0271 $VCPKG_INSTALL_PREFIX/tools/Qt6/bin/QtWebEngineProcess.exe \
0272 $VCPKG_INSTALL_PREFIX/tools/ffmpeg/ffmpeg.exe \
0273 "
0274 
0275 for app in $EXE_FILES ; do
0276 
0277     cp $app $BUNDLEDIR/
0278     CopyReccursiveDependencies "$DUMP_BIN" "$app" "$BUNDLEDIR/" "$VCPKG_INSTALL_PREFIX/bin"
0279 
0280 done
0281 
0282 DLL_FILES="\
0283 `find  $VCPKG_INSTALL_PREFIX/Qt6/plugins -name "*.dll" -type f | sed 's|$VCPKG_INSTALL_PREFIX/Qt6/plugins||'`  \
0284 "
0285 
0286 for app in $DLL_FILES ; do
0287 
0288     CopyReccursiveDependencies "$DUMP_BIN" "$app" "$BUNDLEDIR/" "$VCPKG_INSTALL_PREFIX/bin"
0289 
0290 done
0291 
0292 FFMPEG_DLL_FILES="\
0293 `find  $VCPKG_INSTALL_PREFIX/tools/ffmpeg -name "*.dll" -type f | sed 's|$VCPKG_INSTALL_PREFIX/tools/ffmpeg||'` \
0294 `find  $VCPKG_INSTALL_PREFIX/tools/ffmpeg -name "*.DLL" -type f | sed 's|$VCPKG_INSTALL_PREFIX/tools/ffmpeg||'` \
0295 "
0296 
0297 for ffmpegdll in $FFMPEG_DLL_FILES ; do
0298 
0299     cp $ffmpegdll $BUNDLEDIR/
0300     CopyReccursiveDependencies "$DUMP_BIN" "$ffmpegdll" "$BUNDLEDIR/" "$VCPKG_INSTALL_PREFIX/bin"
0301 
0302 done
0303 
0304 echo -e "\n---------- Copy redistributable VSCommunity compatibility dlls"
0305 
0306 VS_DLL_VERSION=140
0307 
0308 VS_DLL_FILES="\
0309 $VCPKG_INSTALL_PREFIX/bin/msvcp${VS_DLL_VERSION}.dll              \
0310 $VCPKG_INSTALL_PREFIX/bin/msvcp${VS_DLL_VERSION}_1.dll            \
0311 $VCPKG_INSTALL_PREFIX/bin/msvcp${VS_DLL_VERSION}_2.dll            \
0312 $VCPKG_INSTALL_PREFIX/bin/msvcp${VS_DLL_VERSION}_atomic_wait.dll  \
0313 $VCPKG_INSTALL_PREFIX/bin/msvcp${VS_DLL_VERSION}_codecvt_ids.dll  \
0314 $VCPKG_INSTALL_PREFIX/bin/vcruntime${VS_DLL_VERSION}_1.dll        \
0315 $VCPKG_INSTALL_PREFIX/bin/vcruntime${VS_DLL_VERSION}.dll          \
0316 $VCPKG_INSTALL_PREFIX/bin/concrt${VS_DLL_VERSION}.dll             \
0317 "
0318 
0319 for vsdll in $VS_DLL_FILES ; do
0320 
0321     echo -e "   => $vsdll"
0322     cp -r "$vsdll" $BUNDLEDIR/ 2>/dev/null
0323 
0324 done
0325 
0326 # Copy also the vcomp dlls for Windows 11 support
0327 
0328 # To prevent broken array parsing of paths with spaces.
0329 IFS=$'\n'
0330 
0331 VS_DLL_COMP="`find "/c/Program Files/Microsoft Visual Studio/" -name "vcomp${VS_DLL_VERSION}*.dll" -type f | grep 'x64/' | grep 'OpenMP' | grep -v 'onecore'`"
0332 
0333 for vscompdll in $VS_DLL_COMP ; do
0334 
0335     echo -e "   => $vscompdll"
0336     cp -r "$vscompdll" $BUNDLEDIR/ 2>/dev/null
0337 
0338 done
0339 
0340 #################################################################################################
0341 # Install ExifTool binary.
0342 
0343 echo -e "\n---------- Copy ExifTool executable"
0344 
0345 cd $DOWNLOAD_DIR
0346 curl -LO https://files.kde.org/digikam/exiftool/exiftool.zip
0347 unzip -o $DOWNLOAD_DIR/exiftool.zip -d $BUNDLEDIR
0348 mv "$BUNDLEDIR/exiftool(-k).exe" "$BUNDLEDIR/exiftool.exe"
0349 
0350 #################################################################################################
0351 
0352 if [ "$DK_DEBUG" = 1 ] ; then
0353 
0354     DEBUG_SUF="-debug"
0355 
0356 fi
0357 
0358 if [[ "$DK_VERSION" != "v"* ]] ; then
0359 
0360     # with non-official release version, use build time-stamp as sub-version string.
0361     DK_SUBVER="-`cat $ORIG_WD/data/BUILDDATE.txt`"
0362 
0363 else
0364 
0365     # with official release version, disable upload to KDE server, as this break check for new version function.
0366     echo -e "Official release version detected, upload is disabled.\n"
0367     DK_UPLOAD=0
0368 
0369 fi
0370 
0371 TARGET_INSTALLER=digiKam-$DK_RELEASEID$DK_SUBVER-Win64$DEBUG_SUF.exe
0372 PORTABLE_FILE=digiKam-$DK_RELEASEID$DK_SUBVER-Win64$DEBUG_SUF.tar.xz
0373 CHECKSUM_FILE=digiKam-$DK_RELEASEID$DK_SUBVER-Win64$DEBUG_SUF.sum
0374 
0375 #################################################################################################
0376 # Build NSIS installer and Portable archive.
0377 
0378 echo -e "\n---------- Build NSIS installer and Portable archive\n"
0379 
0380 mkdir -p $ORIG_WD/bundle
0381 
0382 rm -f $ORIG_WD/bundle/*Win64$DEBUG_SUF* || true
0383 
0384 cd $ORIG_WD/installer
0385 
0386 if [ "$DK_DEBUG" = 1 ] ; then
0387 
0388     DEBUG_SYMB="-DDEBUG_SYMB"
0389 
0390 fi
0391 
0392 "/c/Program Files (x86)/NSIS/Bin/makensis" \
0393         -DVERSION=$DK_RELEASEID \
0394         -DBUNDLEPATH=$BUNDLEDIR \
0395         $DEBUG_SYMB \
0396         -DOUTPUT=$ORIG_WD/bundle/$TARGET_INSTALLER \
0397         ./digikam.nsi
0398 
0399 cd $ORIG_WD
0400 tar cf - `basename $BUNDLEDIR` --transform s/temp/digiKam/ | xz -4e > $ORIG_WD/bundle/$PORTABLE_FILE
0401 
0402 #################################################################################################
0403 # Show resume information and future instructions to host target files on remote server
0404 
0405 echo -e "\n---------- Compute installer checksums for digiKam $DK_RELEASEID\n"          >  $ORIG_WD/bundle/$TARGET_INSTALLER.sum
0406 echo    "File       : $TARGET_INSTALLER"                                                >> $ORIG_WD/bundle/$TARGET_INSTALLER.sum
0407 echo -n "Size       : "                                                                 >> $ORIG_WD/bundle/$TARGET_INSTALLER.sum
0408 du -h "$ORIG_WD/bundle/$TARGET_INSTALLER"        | { read first rest ; echo $first ; }  >> $ORIG_WD/bundle/$TARGET_INSTALLER.sum
0409 echo -n "SHA256 sum : "                                                                 >> $ORIG_WD/bundle/$TARGET_INSTALLER.sum
0410 shasum -a256 "$ORIG_WD/bundle/$TARGET_INSTALLER" | { read first rest ; echo $first ; }  >> $ORIG_WD/bundle/$TARGET_INSTALLER.sum
0411 
0412 # Checksums to post on Phabricator at release time.
0413 shasum -a256 "$ORIG_WD/bundle/$TARGET_INSTALLER" > $ORIG_WD/bundle/$CHECKSUM_FILE
0414 
0415 echo -e "\n---------- Compute Portable archive checksums for digiKam $DK_RELEASEID\n"   >  $ORIG_WD/bundle/$PORTABLE_FILE.sum
0416 echo    "File       : $PORTABLE_FILE"                                                   >> $ORIG_WD/bundle/$PORTABLE_FILE.sum
0417 echo -n "Size       : "                                                                 >> $ORIG_WD/bundle/$PORTABLE_FILE.sum
0418 du -h "$ORIG_WD/bundle/$PORTABLE_FILE"        | { read first rest ; echo $first ; }     >> $ORIG_WD/bundle/$PORTABLE_FILE.sum
0419 echo -n "SHA256 sum : "                                                                 >> $ORIG_WD/bundle/$PORTABLE_FILE.sum
0420 shasum -a256 "$ORIG_WD/bundle/$PORTABLE_FILE" | { read first rest ; echo $first ; }     >> $ORIG_WD/bundle/$PORTABLE_FILE.sum
0421 
0422 # Checksums to post on Phabricator at release time.
0423 shasum -a256 "$ORIG_WD/bundle/$PORTABLE_FILE" >> $ORIG_WD/bundle/$CHECKSUM_FILE
0424 
0425 if [ "$DK_SIGN" = 1 ] ; then
0426 
0427     echo -e "\n---------- Compute Signature checksums for digiKam installer $DK_RELEASEID\n"    >  $ORIG_WD/bundle/$TARGET_INSTALLER.sum
0428 
0429     cat ~/.gnupg/dkorg-gpg-pwd.txt | gpg --batch --yes --passphrase-fd 0 -sabv "$ORIG_WD/bundle/$TARGET_INSTALLER"
0430     mv -f $ORIG_WD/bundle/$TARGET_INSTALLER.asc $ORIG_WD/bundle/$TARGET_INSTALLER.sig
0431 
0432     echo    "File       : $TARGET_INSTALLER.sig"                                                >> $ORIG_WD/bundle/$TARGET_INSTALLER.sum
0433     echo -n "Size       : "                                                                     >> $ORIG_WD/bundle/$TARGET_INSTALLER.sum
0434     du -h "$ORIG_WD/bundle/$TARGET_INSTALLER.sig"        | { read first rest ; echo $first ; }  >> $ORIG_WD/bundle/$TARGET_INSTALLER.sum
0435     echo -n "SHA256 sum : "                                                                     >> $ORIG_WD/bundle/$TARGET_INSTALLER.sum
0436     shasum -a256 "$ORIG_WD/bundle/$TARGET_INSTALLER.sig" | { read first rest ; echo $first ; }  >> $ORIG_WD/bundle/$TARGET_INSTALLER.sum
0437 
0438     # Checksums to post on Phabricator at release time.
0439     shasum -a256 "$ORIG_WD/bundle/$TARGET_INSTALLER.sig" >> $ORIG_WD/bundle/$CHECKSUM_FILE
0440 
0441     echo -e "\n---------- Compute Signature checksums for digiKam Portable $DK_RELEASEID\n"     >  $ORIG_WD/bundle/$PORTABLE_FILE.sum
0442 
0443     cat ~/.gnupg/dkorg-gpg-pwd.txt | gpg --batch --yes --passphrase-fd 0 -sabv "$ORIG_WD/bundle/$PORTABLE_FILE"
0444     mv -f $ORIG_WD/bundle/$PORTABLE_FILE.asc $ORIG_WD/bundle/$PORTABLE_FILE.sig
0445 
0446     echo    "File       : $PORTABLE_FILE.sig"                                                >> $ORIG_WD/bundle/$PORTABLE_FILE.sum
0447     echo -n "Size       : "                                                                  >> $ORIG_WD/bundle/$PORTABLE_FILE.sum
0448     du -h "$ORIG_WD/bundle/$PORTABLE_FILE.sig"        | { read first rest ; echo $first ; }  >> $ORIG_WD/bundle/$PORTABLE_FILE.sum
0449     echo -n "SHA256 sum : "                                                                  >> $ORIG_WD/bundle/$PORTABLE_FILE.sum
0450     shasum -a256 "$ORIG_WD/bundle/$PORTABLE_FILE.sig" | { read first rest ; echo $first ; }  >> $ORIG_WD/bundle/$PORTABLE_FILE.sum
0451 
0452     # Checksums to post on Phabricator at release time.
0453     shasum -a256 "$ORIG_WD/bundle/$PORTABLE_FILE.sig" >> $ORIG_WD/bundle/$CHECKSUM_FILE
0454 
0455 fi
0456 
0457 cat $ORIG_WD/bundle/$TARGET_INSTALLER.sum
0458 cat $ORIG_WD/bundle/$PORTABLE_FILE.sum
0459 
0460 if [ "$DK_UPLOAD" = 1 ] ; then
0461 
0462     echo -e "---------- Cleanup older Windows bundle files from files.kde.org repository \n"
0463 
0464     sftp -q $DK_UPLOADURL:$DK_UPLOADDIR <<< "rm *-Win64$DEBUG_SUF.exe*"
0465     sftp -q $DK_UPLOADURL:$DK_UPLOADDIR <<< "rm *-Win64$DEBUG_SUF.tar.xz*"
0466 
0467     echo -e "---------- Upload new Windows bundle files to files.kde.org repository \n"
0468 
0469     UploadWithRetry $ORIG_WD/bundle/$TARGET_INSTALLER $DK_UPLOADURL $DK_UPLOADDIR 10
0470     UploadWithRetry $ORIG_WD/bundle/$PORTABLE_FILE    $DK_UPLOADURL $DK_UPLOADDIR 10
0471 
0472     if [[ $DK_SIGN = 1 ]] ; then
0473         scp $ORIG_WD/bundle/$TARGET_INSTALLER.sig $DK_UPLOADURL:$DK_UPLOADDIR
0474         scp $ORIG_WD/bundle/$PORTABLE_FILE.sig    $DK_UPLOADURL:$DK_UPLOADDIR
0475     fi
0476 
0477     # update remote files list
0478 
0479     sftp -q $DK_UPLOADURL:$DK_UPLOADDIR <<< "ls digi*" > $ORIG_WD/bundle/ls.txt
0480     tail -n +2 $ORIG_WD/bundle/ls.txt > $ORIG_WD/bundle/ls.tmp
0481     cat $ORIG_WD/bundle/ls.tmp | grep -E '(.pkg |.appimage |.exe )' | grep -Ev '(debug)' > $ORIG_WD/bundle/FILES
0482     rm $ORIG_WD/bundle/ls.tmp
0483     rm $ORIG_WD/bundle/ls.txt
0484     sftp -q $DK_UPLOADURL:$DK_UPLOADDIR <<< "rm FILES"
0485 
0486     UploadWithRetry $BUILDDIR/bundle/FILES $DK_UPLOADURL $DK_UPLOADDIR 10
0487 
0488 else
0489 
0490     echo -e "\n------------------------------------------------------------------"
0491     curl https://download.kde.org/README_UPLOAD
0492     echo -e "------------------------------------------------------------------\n"
0493 
0494 fi
0495 
0496 #################################################################################################
0497 
0498 TerminateScript