summaryrefslogtreecommitdiff
path: root/bibisect/buildReleasesRepository.sh
blob: b0d7705188bdeb41aa36ca55dd046d200a3b02f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash

#Sample: ./buildReleasesRepository.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 tar.gz files are downloaded
rootDir=

#Path to the folder where 'bibisect-linux-64-releases' is
targetDir=

for var in "$@"
do
    date
    cd $rootDir
    input=$var
    if [[ $input = *"alpha"* ||  $input = *"beta"* ]]; then
        name="LibreOfficeDev_${input}_Linux_x86-64_deb"
        folder="libreofficedev"${input::3}
    else
        name="LibreOffice_${input}_Linux_x86-64_deb"
        folder="libreoffice"${input::3}
    fi
    file=${name}.tar.gz
    if [ ! -f $rootDir/$file ]; then
        echo "File $rootDir/$file not found!"
        url="https://downloadarchive.documentfoundation.org/libreoffice/old/${input}/deb/x86_64/${file}"
        echo "*** Downloading "
        wget -c ${url} -O $rootDir/${file}.tmp
        mv $rootDir/${file}.tmp $rootDir/${file}
    fi
    echo "*** Uncompressing file"
    tar -xvzf $rootDir/${file}
    echo "*** Uncompressing debs"
    for i in $rootDir/$name/DEBS/*.deb; do dpkg-deb -x $i $rootDir/$name/DEBS/ ; done
    echo "*** Moving files to opt/"
    mv $rootDir/$name/DEBS/opt/$folder/* $rootDir/$name/DEBS/opt/
    rm -r $rootDir/$name/DEBS/opt/$folder
    rm $rootDir/$name/DEBS/*.deb
    echo "*** Cleaning destination"
    rm -rf ${targetDir}/opt/
    echo "*** Moving files to destination"
    cp -rf $rootDir/$name/DEBS/* ${targetDir}/
    echo "*** Removing files in origin"
    rm -rf $name
    cd ${targetDir}
    par1=libreoffice-$input
    echo "*** Creating commit $par1"
    git add -A opt/
    git commit . -m $par1 -m $file
    git clean -ffxd
    git tag -d $par1
    git tag -a $par1 -m $par1
done

git gc