File indexing completed on 2025-01-19 03:59:49

0001 #!/bin/bash
0002 
0003 # Script to update Linux AppImage bundles.
0004 #
0005 # SPDX-FileCopyrightText: 2015-2024 by Gilles Caulier  <caulier dot gilles at gmail dot com>
0006 #
0007 # SPDX-License-Identifier: BSD-3-Clause
0008 #
0009 
0010 ########################################################################
0011 # Function to upload bundle log files
0012 BundleUploadLogFiles()
0013 {
0014 
0015 if [[ $DK_UPLOAD = 1 ]] ; then
0016 
0017     echo -e "---------- Cleanup older bundle logs from files.kde.org repository \n"
0018 
0019     sftp -q $DK_UPLOADURL:$DK_UPLOADDIR/build.logs/lin64 <<< "rm build-digikam.full.log.gz"
0020     sftp -q $DK_UPLOADURL:$DK_UPLOADDIR/build.logs/lin64 <<< "rm build-appimage.full.log.gz"
0021 
0022     echo -e "---------- Compress bundle log files \n"
0023 
0024     gzip -k $ORIG_WD/logs/build-digikam.full.log $ORIG_WD/logs/build-digikam.full.log.gz     || true
0025     gzip -k $ORIG_WD/logs/build-appimage.full.log $ORIG_WD/logs/build-appimage.full.log.gz || true
0026 
0027     echo -e "---------- Upload new bundle logs to files.kde.org repository \n"
0028 
0029     rsync -r -v --progress -e ssh $ORIG_WD/logs/build-digikam.full.log.gz $DK_UPLOADURL:$DK_UPLOADDIR/build.logs/lin64   || true
0030     rsync -r -v --progress -e ssh $ORIG_WD/logs/build-appimage.full.log.gz $DK_UPLOADURL:$DK_UPLOADDIR/build.logs/lin64 || true
0031 
0032     echo -e "---------- Cleanup local bundle log file archives \n"
0033 
0034     rm -f $ORIG_WD/logs/build-digikam.full.log.gz   || true
0035     rm -f $ORIG_WD/logs/build-appimage.full.log.gz || true
0036 
0037 fi
0038 
0039 }
0040 
0041 # Halt and catch errors
0042 set -eE
0043 trap 'PREVIOUS_COMMAND=$THIS_COMMAND; THIS_COMMAND=$BASH_COMMAND' DEBUG
0044 trap 'echo "FAILED COMMAND: $PREVIOUS_COMMAND"' ERR
0045 trap BundleUploadLogFiles ERR exit
0046 
0047 ORIG_WD="`pwd`"
0048 
0049 #################################################################################################
0050 # Pre-processing checks
0051 
0052 . ./common.sh
0053 . ./config.sh
0054 StartScript
0055 ChecksRunAsRoot
0056 ChecksCPUCores
0057 HostAdjustments
0058 
0059 echo "+++++++++++++++++++++++ Update Linux AppImage bundle ++++++++++++++++++++++++++++++"
0060 echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
0061 
0062 ./03-build-digikam.sh
0063 
0064 sed -e "s/DK_DEBUG=1/DK_DEBUG=0/g"           ./config.sh > ./tmp.sh ; mv -f ./tmp.sh ./config.sh
0065 
0066 ./04-build-appimage.sh
0067 
0068 sed -e "s/DK_DEBUG=0/DK_DEBUG=1/g"           ./config.sh > ./tmp.sh ; mv -f ./tmp.sh ./config.sh
0069 
0070 ./04-build-appimage.sh
0071 
0072 sed -e "s/DK_DEBUG=1/DK_DEBUG=0/g"           ./config.sh > ./tmp.sh ; mv -f ./tmp.sh ./config.sh
0073 
0074 echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
0075 
0076 TerminateScript