Debian Codegraph @

project/bundles/vcpkg/04-build-installer.sh

raw
1 #! /bin/bash
2
3 # Script to bundle data using previously-built KDE and digiKam installation
4 # and create a Windows installer file with NSIS application
5 #
6 # Dependencies:
7 #
8 # - NSIS makensis program for Windows.
9 # - DumpBin from VSCommunity C++ profiling tools.
10 # - Mt from VSCommunity C++ Desktop tools.
11 # - ImageMagick for the run-time dlls.
12 # - Msys2/Rsync CLI tools for Windows.
13 #
14 # SPDX-FileCopyrightText: 2015-2026 by Gilles Caulier <caulier dot gilles at gmail dot com>
15 #
16 # SPDX-License-Identifier: BSD-3-Clause
17 #
18
19 # Halt and catch errors
20 set -eE
21 trap 'PREVIOUS_COMMAND=$THIS_COMMAND; THIS_COMMAND=$BASH_COMMAND' DEBUG
22 trap 'echo "FAILED COMMAND: $PREVIOUS_COMMAND"' ERR
23
24 export LANG=C
25
26 #################################################################################################
27 # Manage script traces to log file
28
29 mkdir -p ./logs
30 exec > >(tee ./logs/build-installer.full.log) 2>&1
31
32 #################################################################################################
33
34 echo "04-build-installer.sh : build digiKam Windows installer."
35 echo "--------------------------------------------------------"
36
37 #################################################################################################
38 # Pre-processing checks
39
40 . ./config.sh
41 . ./common.sh
42 StartScript
43 ChecksCPUCores
44 RegisterRemoteServers
45 AppendVCPKGPaths
46
47 #################################################################################################
48
49 # Check if NSIS CLI tool is installed.
50
51 if ! which "/c/Program Files (x86)/NSIS/Bin/makensis" ; then
52 echo "NSIS CLI tool is not installed"
53 echo "Install Msys2::nsis with pacman tool."
54 exit 1
55 else
56 echo "Check NSIS CLI tools passed..."
57 fi
58
59 # Check if the DumpBin CLI tool is installed.
60
61 DUMP_BIN="`find "/c/Program Files/Microsoft Visual Studio/" -name "dumpbin.exe" -type f -executable | grep 'Hostx64/x64/dumpbin.exe'`"
62 echo "$DUMP_BIN"
63
64 if [ ! -f "$DUMP_BIN" ] ; then
65 echo "DumpBin CLI tool is not installed"
66 echo "Install VSCommunity C++ Profiling tools component."
67 exit 1
68 else
69 echo "Check DumpBin CLI tools passed..."
70 fi
71
72 # Check if the Mt CLI tool is installed.
73
74 MT_BIN="`find "/c/Program Files (x86)/Windows Kits/" -name "mt.exe" -type f -executable | grep '/x64/mt.exe'`"
75 echo "$MT_BIN"
76
77 if [ ! -f "$MT_BIN" ] ; then
78 echo "Mt CLI tool is not installed"
79 echo "Install VSCommunity C++ Desktop tools component."
80 exit 1
81 else
82 echo "Check Mt CLI tools passed..."
83 fi
84
85 # Check for the ImageMagick install directory.
86
87 MAGICK_PREFIX="`find "/c/Program Files/" -maxdepth 1 -name "ImageMagick*" -type d`"
88 echo "$MAGICK_PREFIX"
89
90 if [ ! -d "$MAGICK_PREFIX" ] ; then
91 echo "ImageMagick is not installed"
92 exit 1
93 else
94 echo "Check ImageMagick install path passed..."
95 fi
96
97 #################################################################################################
98 # Configurations
99
100 # Directory where this script is located (default - current directory)
101 BUILDDIR="$PWD"
102
103 # Directory where bundle files are located
104 BUNDLEDIR="$BUILDDIR/temp"
105
106 ORIG_WD="`pwd`"
107
108 DK_RELEASEID=`cat $ORIG_WD/data/RELEASEID.txt`
109
110 #################################################################################################
111 # Copy files
112
113 echo -e "\n---------- Preparing files to host in the bundle"
114
115 # Directories creation -----------------------------------------------------------------------
116
117 cd $ORIG_WD
118
119 if [ -d "$BUNDLEDIR" ] ; then
120 echo "Cleanup temporary directory $BUNDLEDIR..."
121 rm -fr "$BUNDLEDIR"
122 mkdir "$BUNDLEDIR"
123 fi
124
125 mkdir -p $BUNDLEDIR/data
126 mkdir -p $BUNDLEDIR/etc
127 mkdir -p $BUNDLEDIR/share
128 mkdir -p $BUNDLEDIR/translations
129
130 # Data files ---------------------------------------------------------------------------------
131
132 echo -e "\n---------- Generics data"
133 cp -r $VCPKG_INSTALL_PREFIX/share/lensfun $BUNDLEDIR/data 2>/dev/null
134
135
136
137 if [[ $DK_QTVERSION = 6 ]] ; then
138
139 cp -r $VCPKG_INSTALL_PREFIX/share/digikam $BUNDLEDIR/data 2>/dev/null
140 cp -r $VCPKG_INSTALL_PREFIX/share/showfoto $BUNDLEDIR/data 2>/dev/null
141 cp -r $VCPKG_INSTALL_PREFIX/share/solid $BUNDLEDIR/data 2>/dev/null
142 cp -r $VCPKG_INSTALL_PREFIX/share/kxmlgui5 $BUNDLEDIR/data 2>/dev/null
143 cp -r $VCPKG_INSTALL_PREFIX/share/knotifications6 $BUNDLEDIR/data 2>/dev/null
144 cp -r $VCPKG_INSTALL_PREFIX/share/applications $BUNDLEDIR/data 2>/dev/null
145 cp -r $VCPKG_INSTALL_PREFIX/share/Qt6/resources $BUNDLEDIR/ 2>/dev/null
146
147 else
148
149 cp -r $VCPKG_INSTALL_PREFIX/bin/data/digikam $BUNDLEDIR/data 2>/dev/null
150 cp -r $VCPKG_INSTALL_PREFIX/bin/data/showfoto $BUNDLEDIR/data 2>/dev/null
151 cp -r $VCPKG_INSTALL_PREFIX/bin/data/solid $BUNDLEDIR/data 2>/dev/null
152 cp -r $VCPKG_INSTALL_PREFIX/bin/data/kxmlgui5 $BUNDLEDIR/data 2>/dev/null
153 cp -r $VCPKG_INSTALL_PREFIX/bin/data/knotifications5 $BUNDLEDIR/data 2>/dev/null
154 cp -r $VCPKG_INSTALL_PREFIX/bin/data/applications $BUNDLEDIR/data 2>/dev/null
155 cp -r $VCPKG_INSTALL_PREFIX/share/qt5/resources $BUNDLEDIR/ 2>/dev/null
156
157 fi
158
159 cp -r $VCPKG_INSTALL_PREFIX/bin/data/k* $BUNDLEDIR/data 2>/dev/null
160
161 echo -e "\n---------- Qt config"
162 cp $BUILDDIR/data/qt.conf $BUNDLEDIR/ 2>/dev/null
163
164 echo -e "\n---------- icons-set"
165
166 # See https://bugs.kde.org/show_bug.cgi?id=487799#c54
167
168 if [[ $DK_QTVERSION = 6 ]] ; then
169
170 # Icons generation with vcpkg::python3 from KF6::breeze-icons do not work yet (lxml module is missing).
171 # Use the pre-compiled rcc file instead for the moment.
172 #
173 # cp $VCPKG_INSTALL_PREFIX/bin/data/icons/breeze/breeze-icons.rcc $BUNDLEDIR/breeze.rcc 2>/dev/null
174
175 cp $BUILDDIR/../common/breeze.rcc $BUNDLEDIR/breeze.rcc 2>/dev/null
176
177 else
178
179 cp $BUILDDIR/../common/breeze.rcc $BUNDLEDIR/breeze.rcc 2>/dev/null
180 cp $BUILDDIR/../common/breeze-dark.rcc $BUNDLEDIR/breeze-dark.rcc 2>/dev/null
181
182 fi
183
184 if [[ $DK_QTVERSION = 6 ]] ; then
185
186 cp -r $VCPKG_INSTALL_PREFIX/share/icons $BUNDLEDIR/data 2>/dev/null
187
188 else
189
190 cp -r $VCPKG_INSTALL_PREFIX/bin/data/icons $BUNDLEDIR/data 2>/dev/null
191
192 fi
193
194 echo -e "\n---------- i18n"
195
196 # Qt framekork translations
197
198 if [[ $DK_QTVERSION = 6 ]] ; then
199
200 cp -r $VCPKG_INSTALL_PREFIX/translations/Qt6/* $BUNDLEDIR/translations 2>/dev/null
201
202 else
203
204 cp -r $VCPKG_INSTALL_PREFIX/share/qt5/translations/* $BUNDLEDIR/translations 2>/dev/null
205
206 fi
207
208 rm -fr $BUNDLEDIR/translations/assistant*.qm
209 rm -fr $BUNDLEDIR/translations/designer*.qm
210 rm -fr $BUNDLEDIR/translations/linguist*.qm
211 rm -fr $BUNDLEDIR/translations/qt_help*.qm
212 # KDE framework translations
213 cp -r $VCPKG_INSTALL_PREFIX/bin/data/locale $BUNDLEDIR/data 2>/dev/null
214 # digiKam translations
215 cp -r $VCPKG_INSTALL_PREFIX/share/locale $BUNDLEDIR/data 2>/dev/null
216
217 # See bug 471058
218 echo -e "\n---------- Freedesktop"
219 mkdir -p $BUNDLEDIR/share/mime/packages/ 2>/dev/null
220 cp -r $ORIG_WD/data/freedesktop.org.xml $BUNDLEDIR/share/mime/packages 2>/dev/null
221
222 echo -e "\n---------- Copy Git Revisions Manifest"
223
224 touch $BUNDLEDIR/MANIFEST.txt
225
226 FILES=$(ls $ORIG_WD/data/*_manifest.txt)
227
228 for FILE in $FILES ; do
229 echo $FILE
230 cat $FILE >> $BUNDLEDIR/MANIFEST.txt
231 done
232
233 # Plugins Shared libraries -------------------------------------------------------------------
234
235 echo -e "\n---------- Qt plugins"
236
237 if [[ $DK_QTVERSION = 6 ]] ; then
238
239 cp -r $VCPKG_INSTALL_PREFIX/Qt6/plugins $BUNDLEDIR/ 2>/dev/null
240
241 else
242
243 cp -r $VCPKG_INSTALL_PREFIX/plugins $BUNDLEDIR/ 2>/dev/null
244
245 fi
246
247 echo -e "\n---------- OpenGl Software for Qt6"
248 # Taken from https://download.qt.io/development_releases/prebuilt/llvmpipe/windows/
249 # See bug #479148
250 cp -r $ORIG_WD/data/opengl32sw.dll $BUNDLEDIR/ 2>/dev/null
251
252 echo -e "\n---------- ImageMagick"
253
254 cp -r "$MAGICK_PREFIX"/CORE_RL_*.dll $BUNDLEDIR/ 2>/dev/null
255 cp -r "$MAGICK_PREFIX"/modules/coders/*.dll $BUNDLEDIR/ 2>/dev/null
256 cp -r "$MAGICK_PREFIX"/modules/filters/*.dll $BUNDLEDIR/ 2>/dev/null
257
258 # Black-list of ImageMagick coders to not host in the bundles.
259 # Prior digiKam/Qt image loaders first which provides the same type-mimes.
260
261 IM_CODERS_BL="\
262 $BUNDLEDIR/IM_MOD_RL_dng_.dll \
263 $BUNDLEDIR/IM_MOD_RL_exr_.dll \
264 $BUNDLEDIR/IM_MOD_RL_gif_.dll \
265 $BUNDLEDIR/IM_MOD_RL_hdr_.dll \
266 $BUNDLEDIR/IM_MOD_RL_heic_.dll \
267 $BUNDLEDIR/IM_MOD_RL_jp2_.dll \
268 $BUNDLEDIR/IM_MOD_RL_jpeg_.dll \
269 $BUNDLEDIR/IM_MOD_RL_jxl_.dll \
270 $BUNDLEDIR/IM_MOD_RL_ora_.dll \
271 $BUNDLEDIR/IM_MOD_RL_pcx_.dll \
272 $BUNDLEDIR/IM_MOD_RL_pdf_.dll \
273 $BUNDLEDIR/IM_MOD_RL_png_.dll \
274 $BUNDLEDIR/IM_MOD_RL_psd_.dll \
275 $BUNDLEDIR/IM_MOD_RL_raw_.dll \
276 $BUNDLEDIR/IM_MOD_RL_svg_.dll \
277 $BUNDLEDIR/IM_MOD_RL_tga_.dll \
278 $BUNDLEDIR/IM_MOD_RL_tiff_.dll \
279 $BUNDLEDIR/IM_MOD_RL_video_.dll \
280 $BUNDLEDIR/IM_MOD_RL_wbmp_.dll \
281 $BUNDLEDIR/IM_MOD_RL_webp_.dll \
282 $BUNDLEDIR/IM_MOD_RL_xcf_.dll \
283 "
284
285 for coder in $IM_CODERS_BL ; do
286
287 rm -rf "$coder"
288
289 done
290
291 # See bug #476290
292 rm -fr $BUNDLEDIR/plugins/imageformats/qjp2.dll
293 rm -fr $BUNDLEDIR/plugins/imageformats/qjp2.pdb
294
295 #################################################################################################
296 # Add debug symbols for few binary files to optimize space.
297 # NOTE: NSIS only support < 2Gb of file to package in the same installer. If size is bigger, a bus error exception is generated.
298 # Only the digiKam shared libraries debug symbols are preserved. All digiKam plugins are not present.
299
300 # First drop all existing pdb files from the bundles if any.
301
302 echo -e "\n---------- Clean up debug symbols in the bundle"
303
304 PDB_FILES="`find "$BUNDLEDIR"/plugins -name "*.pdb" -type f`"
305
306 for pdb in $PDB_FILES ; do
307
308 if [ "$DK_DEBUG" = 0 ] ; then
309
310 # In non debug clean all
311
312 echo " (ND del) ==> $pdb"
313 rm -rf "$pdb"
314
315 # NOTE: due to size limitation of NSIS archive to 2Gb,
316 # the number of extra debug symbols must be limited.
317 #
318 # elif [[ "$pdb" = *"plugins/digikam"* ]] ; then
319 #
320 # # In debug mode preserve digiKam Plugins
321 #
322 # echo " (Skip) ==> $pdb"
323 #
324 # # Enable this condition only to hack.
325 #
326 # elif [[ "$pdb" = *"Qt${DK_QTVERSION}Core.pdb"* ]] ; then
327 #
328 # # In debug mode preserve Qt debug symbols
329 #
330 # echo " (Skip) ==> $pdb"
331
332 else
333
334 echo " (DB del) ==> $pdb"
335 rm -rf "$pdb"
336
337 fi
338
339 done
340
341 # Second add only wanted pdb files in the bundles
342
343 if [ "$DK_DEBUG" = 1 ] ; then
344
345 echo -e "\n---------- Add necessary debug symbols in the bundle"
346
347 # digikam libs
348 cp -rv "$VCPKG_INSTALL_PREFIX"/bin/digikam*.pdb $BUNDLEDIR/ 2>/dev/null
349
350 # if [ -f "$VCPKG_INSTALL_PREFIX"/bin/Qt${DK_QTVERSION}Core.pdb ] ; then
351 #
352 # cp -rv "$VCPKG_INSTALL_PREFIX"/bin/Qt${DK_QTVERSION}Core.pdb $BUNDLEDIR/ 2>/dev/null
353 #
354 # fi
355
356 fi
357
358 echo -e "\n---------- Apply manifest file to enable UTF-8 support for file paths\n"
359
360 "$MT_BIN" \
361 -manifest $VCPKG_INSTALL_PREFIX/bin/digikam.exe.manifest \
362 -outputresource:$VCPKG_INSTALL_PREFIX/bin/digikam.exe;#1
363
364 "$MT_BIN" \
365 -manifest $VCPKG_INSTALL_PREFIX/bin/showfoto.exe.manifest \
366 -outputresource:$VCPKG_INSTALL_PREFIX/bin/showfoto.exe;#1
367
368 echo -e "\n---------- Copy executables with recursive dependencies in bundle directory\n"
369
370 # Executables and plugins shared libraries dependencies scan ---------------------------------
371
372 EXE_FILES="\
373 $VCPKG_INSTALL_PREFIX/bin/digikam.exe \
374 $VCPKG_INSTALL_PREFIX/bin/showfoto.exe \
375 $VCPKG_INSTALL_PREFIX/tools/libsnoretoast/snoretoast.exe \
376 $VCPKG_INSTALL_PREFIX/tools/ffmpeg/ffmpeg.exe \
377 "
378
379 if [[ $DK_QTVERSION = 6 ]] ; then
380
381 EXE_FILES+="\
382 $VCPKG_INSTALL_PREFIX/tools/Qt6/bin/QtWebEngineProcess.exe \
383 $VCPKG_INSTALL_PREFIX/bin/kbuildsycoca6.exe \
384 "
385
386 else
387
388 EXE_FILES+="\
389 $VCPKG_INSTALL_PREFIX/tools/Qt5/QtWebEngineProcess.exe \
390 $VCPKG_INSTALL_PREFIX/bin/kbuildsycoca5.exe \
391 "
392
393 fi
394
395 for app in $EXE_FILES ; do
396
397 cp $app $BUNDLEDIR/
398 CopyReccursiveDependencies "$DUMP_BIN" "$app" "$BUNDLEDIR/" "$VCPKG_INSTALL_PREFIX/bin"
399
400 done
401
402 if [[ $DK_QTVERSION = 6 ]] ; then
403
404 DLL_FILES="\
405 `find $VCPKG_INSTALL_PREFIX/Qt6/plugins -name "*.dll" -type f | sed 's|$VCPKG_INSTALL_PREFIX/Qt6/plugins||'` \
406 "
407
408 else
409
410 DLL_FILES="\
411 `find $VCPKG_INSTALL_PREFIX/plugins -name "*.dll" -type f | sed 's|$VCPKG_INSTALL_PREFIX/plugins||'` \
412 "
413
414 fi
415
416 for app in $DLL_FILES ; do
417
418 CopyReccursiveDependencies "$DUMP_BIN" "$app" "$BUNDLEDIR/" "$VCPKG_INSTALL_PREFIX/bin"
419
420 done
421
422 FFMPEG_DLL_FILES="\
423 `find $VCPKG_INSTALL_PREFIX/tools/ffmpeg -name "*.dll" -type f | sed 's|$VCPKG_INSTALL_PREFIX/tools/ffmpeg||'` \
424 `find $VCPKG_INSTALL_PREFIX/tools/ffmpeg -name "*.DLL" -type f | sed 's|$VCPKG_INSTALL_PREFIX/tools/ffmpeg||'` \
425 `find $VCPKG_INSTALL_PREFIX/tools/x264/bin -name "libx264*.dll" -type f | sed 's|$VCPKG_INSTALL_PREFIX/tools/x264/bin||'` \
426 "
427
428 for ffmpegdll in $FFMPEG_DLL_FILES ; do
429
430 cp $ffmpegdll $BUNDLEDIR/
431 CopyReccursiveDependencies "$DUMP_BIN" "$ffmpegdll" "$BUNDLEDIR/" "$VCPKG_INSTALL_PREFIX/bin"
432
433 done
434
435 echo -e "\n---------- Copy redistributable VSCommunity compatibility dlls"
436
437 VS_DLL_VERSION=140
438
439 VS_DLL_FILES="\
440 $VCPKG_INSTALL_PREFIX/bin/msvcp${VS_DLL_VERSION}.dll \
441 $VCPKG_INSTALL_PREFIX/bin/msvcp${VS_DLL_VERSION}_1.dll \
442 $VCPKG_INSTALL_PREFIX/bin/msvcp${VS_DLL_VERSION}_2.dll \
443 $VCPKG_INSTALL_PREFIX/bin/msvcp${VS_DLL_VERSION}_atomic_wait.dll \
444 $VCPKG_INSTALL_PREFIX/bin/msvcp${VS_DLL_VERSION}_codecvt_ids.dll \
445 $VCPKG_INSTALL_PREFIX/bin/vcruntime${VS_DLL_VERSION}_1.dll \
446 $VCPKG_INSTALL_PREFIX/bin/vcruntime${VS_DLL_VERSION}.dll \
447 $VCPKG_INSTALL_PREFIX/bin/concrt${VS_DLL_VERSION}.dll \
448 "
449
450 for vsdll in $VS_DLL_FILES ; do
451
452 echo -e " => $vsdll"
453 cp -r "$vsdll" $BUNDLEDIR/ 2>/dev/null
454
455 done
456
457 # Copy also the vcomp dlls for Windows 11 support
458
459 # To prevent broken array parsing of paths with spaces.
460 IFS=$'\n'
461
462 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'`"
463
464 for vscompdll in $VS_DLL_COMP ; do
465
466 echo -e " => $vscompdll"
467 cp -r "$vscompdll" $BUNDLEDIR/ 2>/dev/null
468
469 done
470
471 if [[ $DK_QTVERSION = 6 ]] ; then
472
473 # Group icon-engine plugins at the same place
474 mv -f $BUNDLEDIR/plugins/kiconthemes6/iconengines/*.dll $BUNDLEDIR/plugins/iconengines/
475 rm -fr $BUNDLEDIR/plugins/kiconthemes6
476
477 fi
478
479 #################################################################################################
480 # Install ExifTool binary.
481
482 echo -e "\n---------- Copy ExifTool executable"
483
484 cd $DOWNLOAD_DIR
485 curl -LO https://mirrors.xtom.de/kde-application/digikam/exiftool/exiftool.zip
486 unzip -o $DOWNLOAD_DIR/exiftool.zip -d $BUNDLEDIR
487 mv "$BUNDLEDIR/exiftool(-k).exe" "$BUNDLEDIR/exiftool.exe"
488
489 #################################################################################################
490
491 if [ "$DK_DEBUG" = 1 ] ; then
492
493 DEBUG_SUF="-debug"
494
495 fi
496
497 if [[ "$DK_VERSION" != "v"* ]] ; then
498
499 # with non-official release version, use build time-stamp as sub-version string.
500 DK_SUBVER="-`cat $ORIG_WD/data/BUILDDATE.txt`"
501
502 else
503
504 # with official release version, disable upload to KDE server, as this break check for new version function.
505 echo -e "Official release version detected, upload is disabled.\n"
506 DK_UPLOAD=0
507
508 fi
509
510 if [[ $DK_QTVERSION == 5 ]] ; then
511
512 QT_SUF="-Qt5"
513
514 else
515
516 QT_SUF="-Qt6"
517
518 fi
519
520 TARGET_INSTALLER=digiKam-$DK_RELEASEID$DK_SUBVER$QT_SUF-Win64$DEBUG_SUF.exe
521 PORTABLE_FILE=digiKam-$DK_RELEASEID$DK_SUBVER$QT_SUF-Win64$DEBUG_SUF.tar.xz
522 CHECKSUM_FILE=digiKam-$DK_RELEASEID$DK_SUBVER$QT_SUF-Win64$DEBUG_SUF.sum
523
524 #################################################################################################
525 # Build NSIS installer and Portable archive.
526
527 echo -e "\n---------- Build NSIS installer and Portable archive\n"
528
529 mkdir -p $ORIG_WD/bundle
530
531 rm -f $ORIG_WD/bundle/*Win64$DEBUG_SUF* || true
532
533 cd $ORIG_WD/installer
534
535 if [ "$DK_DEBUG" = 1 ] ; then
536
537 DEBUG_SYMB="-DDEBUG_SYMB"
538
539 fi
540
541 "/c/Program Files (x86)/NSIS/Bin/makensis" \
542 -DVERSION=$DK_RELEASEID \
543 -DBUNDLEPATH=$BUNDLEDIR \
544 $DEBUG_SYMB \
545 -DOUTPUT=$ORIG_WD/bundle/$TARGET_INSTALLER \
546 ./digikam.nsi
547
548 cd $ORIG_WD
549 tar cf - `basename $BUNDLEDIR` --transform s/temp/digiKam/ | xz -4e > $ORIG_WD/bundle/$PORTABLE_FILE
550
551 #################################################################################################
552 # Show resume information and future instructions to host target files on remote server
553
554 echo -e "\n---------- Compute installer checksums for digiKam $DK_RELEASEID\n" > $ORIG_WD/bundle/$TARGET_INSTALLER.sum
555 echo "File : $TARGET_INSTALLER" >> $ORIG_WD/bundle/$TARGET_INSTALLER.sum
556 echo -n "Size : " >> $ORIG_WD/bundle/$TARGET_INSTALLER.sum
557 du -h "$ORIG_WD/bundle/$TARGET_INSTALLER" | { read first rest ; echo $first ; } >> $ORIG_WD/bundle/$TARGET_INSTALLER.sum
558 echo -n "SHA256 sum : " >> $ORIG_WD/bundle/$TARGET_INSTALLER.sum
559 shasum -a256 "$ORIG_WD/bundle/$TARGET_INSTALLER" | { read first rest ; echo $first ; } >> $ORIG_WD/bundle/$TARGET_INSTALLER.sum
560
561 # Checksums to post on Phabricator at release time.
562 shasum -a256 "$ORIG_WD/bundle/$TARGET_INSTALLER" > $ORIG_WD/bundle/$CHECKSUM_FILE
563
564 echo -e "\n---------- Compute Portable archive checksums for digiKam $DK_RELEASEID\n" > $ORIG_WD/bundle/$PORTABLE_FILE.sum
565 echo "File : $PORTABLE_FILE" >> $ORIG_WD/bundle/$PORTABLE_FILE.sum
566 echo -n "Size : " >> $ORIG_WD/bundle/$PORTABLE_FILE.sum
567 du -h "$ORIG_WD/bundle/$PORTABLE_FILE" | { read first rest ; echo $first ; } >> $ORIG_WD/bundle/$PORTABLE_FILE.sum
568 echo -n "SHA256 sum : " >> $ORIG_WD/bundle/$PORTABLE_FILE.sum
569 shasum -a256 "$ORIG_WD/bundle/$PORTABLE_FILE" | { read first rest ; echo $first ; } >> $ORIG_WD/bundle/$PORTABLE_FILE.sum
570
571 # Checksums to post on Phabricator at release time.
572 shasum -a256 "$ORIG_WD/bundle/$PORTABLE_FILE" >> $ORIG_WD/bundle/$CHECKSUM_FILE
573
574 if [ "$DK_SIGN" = 1 ] ; then
575
576 echo -e "\n---------- Compute Signature checksums for digiKam installer $DK_RELEASEID\n" > $ORIG_WD/bundle/$TARGET_INSTALLER.sum
577
578 cat ~/.gnupg/dkorg-gpg-pwd.txt | gpg --batch --yes --passphrase-fd 0 -sabv "$ORIG_WD/bundle/$TARGET_INSTALLER"
579 mv -f $ORIG_WD/bundle/$TARGET_INSTALLER.asc $ORIG_WD/bundle/$TARGET_INSTALLER.sig
580
581 echo "File : $TARGET_INSTALLER.sig" >> $ORIG_WD/bundle/$TARGET_INSTALLER.sum
582 echo -n "Size : " >> $ORIG_WD/bundle/$TARGET_INSTALLER.sum
583 du -h "$ORIG_WD/bundle/$TARGET_INSTALLER.sig" | { read first rest ; echo $first ; } >> $ORIG_WD/bundle/$TARGET_INSTALLER.sum
584 echo -n "SHA256 sum : " >> $ORIG_WD/bundle/$TARGET_INSTALLER.sum
585 shasum -a256 "$ORIG_WD/bundle/$TARGET_INSTALLER.sig" | { read first rest ; echo $first ; } >> $ORIG_WD/bundle/$TARGET_INSTALLER.sum
586
587 # Checksums to post on Phabricator at release time.
588 shasum -a256 "$ORIG_WD/bundle/$TARGET_INSTALLER.sig" >> $ORIG_WD/bundle/$CHECKSUM_FILE
589
590 echo -e "\n---------- Compute Signature checksums for digiKam Portable $DK_RELEASEID\n" > $ORIG_WD/bundle/$PORTABLE_FILE.sum
591
592 cat ~/.gnupg/dkorg-gpg-pwd.txt | gpg --batch --yes --passphrase-fd 0 -sabv "$ORIG_WD/bundle/$PORTABLE_FILE"
593 mv -f $ORIG_WD/bundle/$PORTABLE_FILE.asc $ORIG_WD/bundle/$PORTABLE_FILE.sig
594
595 echo "File : $PORTABLE_FILE.sig" >> $ORIG_WD/bundle/$PORTABLE_FILE.sum
596 echo -n "Size : " >> $ORIG_WD/bundle/$PORTABLE_FILE.sum
597 du -h "$ORIG_WD/bundle/$PORTABLE_FILE.sig" | { read first rest ; echo $first ; } >> $ORIG_WD/bundle/$PORTABLE_FILE.sum
598 echo -n "SHA256 sum : " >> $ORIG_WD/bundle/$PORTABLE_FILE.sum
599 shasum -a256 "$ORIG_WD/bundle/$PORTABLE_FILE.sig" | { read first rest ; echo $first ; } >> $ORIG_WD/bundle/$PORTABLE_FILE.sum
600
601 # Checksums to post on Phabricator at release time.
602 shasum -a256 "$ORIG_WD/bundle/$PORTABLE_FILE.sig" >> $ORIG_WD/bundle/$CHECKSUM_FILE
603
604 fi
605
606 cat $ORIG_WD/bundle/$TARGET_INSTALLER.sum
607 cat $ORIG_WD/bundle/$PORTABLE_FILE.sum
608
609 if [ "$DK_UPLOAD" = 1 ] ; then
610
611 echo -e "---------- Cleanup older Windows bundle files from files.kde.org repository \n"
612
613 sftp -q $DK_UPLOADURL:$DK_UPLOADDIR <<< "rm *$QT_SUF-Win64$DEBUG_SUF.exe*"
614 sftp -q $DK_UPLOADURL:$DK_UPLOADDIR <<< "rm *$QT_SUF-Win64$DEBUG_SUF.tar.xz*"
615
616 echo -e "---------- Upload new Windows bundle files to files.kde.org repository \n"
617
618 UploadWithRetry $ORIG_WD/bundle/$TARGET_INSTALLER $DK_UPLOADURL $DK_UPLOADDIR 10
619 UploadWithRetry $ORIG_WD/bundle/$PORTABLE_FILE $DK_UPLOADURL $DK_UPLOADDIR 10
620
621 if [[ $DK_SIGN = 1 ]] ; then
622 scp $ORIG_WD/bundle/$TARGET_INSTALLER.sig $DK_UPLOADURL:$DK_UPLOADDIR
623 scp $ORIG_WD/bundle/$PORTABLE_FILE.sig $DK_UPLOADURL:$DK_UPLOADDIR
624 fi
625
626 # update remote files list
627
628 sftp -q $DK_UPLOADURL:$DK_UPLOADDIR <<< "ls digi*" > $ORIG_WD/bundle/ls.txt
629 tail -n +2 $ORIG_WD/bundle/ls.txt > $ORIG_WD/bundle/ls.tmp
630 cat $ORIG_WD/bundle/ls.tmp | grep -E '(.pkg |.appimage |.exe )' | grep -Ev '(debug)' > $ORIG_WD/bundle/FILES
631 rm $ORIG_WD/bundle/ls.tmp
632 rm $ORIG_WD/bundle/ls.txt
633 sftp -q $DK_UPLOADURL:$DK_UPLOADDIR <<< "rm FILES"
634
635 UploadWithRetry $BUILDDIR/bundle/FILES $DK_UPLOADURL $DK_UPLOADDIR 10
636
637 else
638
639 echo -e "\n------------------------------------------------------------------"
640 curl https://download.kde.org/README_UPLOAD
641 echo -e "------------------------------------------------------------------\n"
642
643 fi
644
645 #################################################################################################
646
647 TerminateScript