bibisect/buildWinReleasesRepository.sh |  154 +++++++++++++++++++++++++++++++++
 1 file changed, 154 insertions(+)

New commits:
commit b7f4b60aa94cd1be4ca456e5b6ab93c093824bcd
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Thu Mar 30 16:17:04 2023 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Mar 30 16:17:04 2023 +0200

    Add script for building win-86-releases
    
    Change-Id: Ic08cdceb78086d6832fdd834a8b87e32760888a5

diff --git a/bibisect/buildWinReleasesRepository.sh 
b/bibisect/buildWinReleasesRepository.sh
new file mode 100755
index 00000000..301f560a
--- /dev/null
+++ b/bibisect/buildWinReleasesRepository.sh
@@ -0,0 +1,154 @@
+#!/bin/bash
+
+#Sample: ./buildWinReleasesRepository.sh 6.3.0.0.alpha1 6.3.0.0.beta1 
6.3.0.0.beta2 6.3.0.1 6.3.0.2 6.3.0.3 6.3.0.4
+
+#Path to the folder where the msi/exe files are downloaded
+rootDir=
+
+#Path to the folder where 'win-86-releases' is
+targetDir=
+
+removeOriginFolders () {
+    echo "*** Removing files in origin"
+    rm -rf $rootDir/instdir
+    rm -rf  $rootDir/output
+}
+
+for var in "$@"
+do
+    isExeFile=0
+    date
+    cd $rootDir
+    input=$var
+    if [[ $input = *"alpha"* ||  $input = *"beta"* ]]; then
+        if [[ $input = "4.0."* ]]; then
+            file="LibreOfficeDev_${input}_Win_x86_install_multi.msi"
+        else
+            file="LibreOfficeDev_${input}_Win_x86.msi"
+        fi
+    else
+        if [[ $input = "3.3."* ]]; then
+            file="LibO_${input::-2}_Win_x86_install_all_lang.exe"
+            isExeFile=1
+        elif [[ $input = "3.4."* ]]; then
+            file="LibO_${input::-2}_Win_x86_install_multi.exe"
+            isExeFile=1
+        elif [[ $input = "3.5"* ]]; then
+            file="LibO_${input::-2}_Win_x86_install_multi.msi"
+        elif [[ $input = "3."* ]]; then
+            file="LibO_${input}_Win_x86_install_multi.msi"
+        else
+            file="LibreOffice_${input}_Win_x86.msi"
+        fi
+    fi
+    if [ ! -f $rootDir/$file ]; then
+        echo "File $rootDir/$file not found!"
+        
url="https://downloadarchive.documentfoundation.org/libreoffice/old/${input}/win/x86/${file}";
+        echo "*** Downloading "
+        if wget -c ${url} -O $rootDir/${file}.tmp; then
+            mv $rootDir/${file}.tmp $rootDir/${file}
+        else
+            if [ $isExeFile -eq 1 ]; then
+                extension=".exe"
+            else
+                extension=".msi"
+            fi
+            # try harder
+            # In the past, some files used rcX. e.g: LibO_3.4.0rc1
+            file="LibO_${input::-2}rc${input: 
-1}_Win_x86_install_multi${extension}"
+            
url="https://downloadarchive.documentfoundation.org/libreoffice/old/${input}/win/x86/${file}";
+            if wget -c ${url} -O $rootDir/${file}.tmp; then
+                mv $rootDir/${file}.tmp $rootDir/${file}
+            else
+                echo "$url doesn\'t exists"
+                break
+            fi
+        fi
+    else
+        echo "File $rootDir/$file found!"
+    fi
+
+    if [ $isExeFile -eq 1 ]; then
+        echo "*** Uncompressing exe file"
+        7z x $rootDir/${file} -o$rootDir/exeData
+        echo "*** Extracting msi"
+        msiextract $rootDir/exeData/libreoffice3*.msi -C $rootDir/output 
&>/dev/null
+        echo "*** Cleaning exe folder"
+        rm -rf $rootDir/exeData/
+    else
+        echo "*** Extracting msi"
+        msiextract $rootDir/${file} -C $rootDir/output &>/dev/null
+    fi
+
+    if [[ ! -d $rootDir/output/Program\ Files/ ]]; then
+        echo "$rootDir/output/Program\ Files doesn't exists"
+        removeOriginFolders
+        break
+    fi
+
+    echo "*** Moving files to instdir folder"
+    mv $rootDir/output/Program\ Files/* $rootDir/instdir
+
+    echo "*** Moving files to program"
+    if [[ ! -d $rootDir/instdir/URE/bin/ ]]; then
+        echo "$rootDir/instdir/URE/bin/ doesn't exists"
+        removeOriginFolders
+        break
+    fi
+    mv $rootDir/instdir/URE/bin/*.dll $rootDir/instdir/program/
+
+    if [[ ! -d $rootDir/instdir/URE/misc/ ]]; then
+        echo "$rootDir/instdir/URE/misc/ doesn't exists"
+        removeOriginFolders
+        break
+    fi
+    mv $rootDir/instdir/URE/misc/*.rdb $rootDir/instdir/program/
+
+    # msvcp* and msvcr libraries
+    mv $rootDir/output/Win/System/*.dll $rootDir/instdir/program/
+
+    echo "*** Writing to uno.ini"
+    echo "[Bootstrap]
+URE_INTERNAL_LIB_DIR=\${ORIGIN}
+URE_INTERNAL_JAVA_DIR=\${ORIGIN}/classes
+URE_INTERNAL_JAVA_CLASSPATH=\${URE_MORE_JAVA_TYPES}
+UNO_TYPES=\${ORIGIN}/types.rdb \${URE_MORE_TYPES}
+UNO_SERVICES=\${ORIGIN}/services.rdb \${URE_MORE_SERVICES}" >>  
$rootDir/instdir/program/uno.ini
+
+    echo "*** Changing bootstrap.ini"
+    sed -i '/UserInstallation/d' $rootDir/instdir/program/bootstrap.ini
+    echo "UserInstallation=\$ORIGIN/.." >> 
$rootDir/instdir/program/bootstrap.ini
+
+    echo "*** Cleaning destination"
+    rm -rf ${targetDir}/instdir/
+    mkdir ${targetDir}/instdir/
+    echo "*** Moving files to destination"
+    mv $rootDir/instdir/program ${targetDir}/instdir/program
+    if [ $isExeFile -eq 1 ]; then
+        mv $rootDir/instdir/Basis ${targetDir}/instdir/Basis
+        mv $rootDir/instdir/basis-link ${targetDir}/instdir/basis-link
+    else
+        mv $rootDir/instdir/share ${targetDir}/instdir/share
+        mv $rootDir/instdir/presets ${targetDir}/instdir/presets
+
+        # it makes .exe files to work
+        touch ${targetDir}/instdir/ure-link
+
+        echo "*** Removing extensions"
+        rm -rf ${targetDir}/instdir/share/extensions/
+    fi
+    removeOriginFolders
+
+    cd ${targetDir}
+    par1=libreoffice-$input
+    echo "*** Creating commit $par1"
+    git add -A instdir/
+    git commit . -m $par1 -m $file
+    git clean -ffxd
+    git tag -d $par1
+    git tag -a $par1 -m $par1
+done
+
+cd ${targetDir}
+git gc
+

Reply via email to