summaryrefslogtreecommitdiff
path: root/bibisect
diff options
context:
space:
mode:
Diffstat (limited to 'bibisect')
-rwxr-xr-xbibisect/buildWinReleasesRepository.sh148
1 files changed, 148 insertions, 0 deletions
diff --git a/bibisect/buildWinReleasesRepository.sh b/bibisect/buildWinReleasesRepository.sh
new file mode 100755
index 00000000..c984da0c
--- /dev/null
+++ b/bibisect/buildWinReleasesRepository.sh
@@ -0,0 +1,148 @@
+#!/bin/bash
+# This script uses msiextract.
+# If you want to run it on Windows, use msiexec
+# 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=
+
+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"
+ rm -rf $rootDir/output
+ break
+ fi
+
+ echo "*** Moving files to instdir folder"
+ mv $rootDir/output/Program\ Files/* $rootDir/instdir
+
+ if [ $isExeFile -eq 0 ]; then
+ # msvcp* and msvcr libraries
+ echo "*** Copying MSVC libraries"
+ if [[ $input = "3."* || $input = "4."* ]]; then
+ mv $rootDir/output/Win/System/*.dll $rootDir/instdir/program/
+ else
+ mv $rootDir/output/System/*.dll $rootDir/instdir/program/
+ fi
+ fi
+ rm -rf $rootDir/output
+
+ # Change user profile folder
+ echo "*** Changing bootstrap.ini"
+ sed -i '/UserInstallation/d' $rootDir/instdir/program/bootstrap.ini
+ echo "UserInstallation=\$ORIGIN/.." >> $rootDir/instdir/program/bootstrap.ini
+
+ echo "*** Removing unneeded dictionaries"
+ dictionaries=$(find $rootDir/instdir/share/extensions/ -type d -name dict-*)
+ for dict in $dictionaries
+ do
+ if [[ ${dict} != *"dict-en" ]];then
+ rm -r $dict
+ fi
+ done
+
+ echo "*** Removing unneeded languages"
+ # Use zh-TW/zh_TW to find the location of other languages not needed
+ for string in zh-TW zh_TW;
+ do
+ findOutput=$(find $rootDir/instdir/ -name *$string*)
+ for path in $findOutput
+ do
+ generalPath="${path/$string/"*"}"
+ lsOutput=$(ls -d $generalPath)
+ for filePath in $lsOutput
+ do
+ if [[ ${filePath} != *"US"* ]];then
+ rm -r $filePath
+ fi
+ done
+ done
+ done
+
+ echo "*** Cleaning destination"
+ rm -rf ${targetDir}/instdir/
+
+ echo "*** Moving files to destination"
+ mv $rootDir/instdir/ ${targetDir}/instdir/
+
+ 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
+