summaryrefslogtreecommitdiff
path: root/autogen.sh
blob: 03f5e0ccaa192cbd44fdcfd204ba450bbbfb1e90 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash

package="iRony"

chwala_dir="../kolab-chwala.git/"
roundcube_dir="../roundcubemail.git/"
roundcube_plugins_dir="../roundcubemail-plugins-kolab.git/"

if [ $# -ne 1 ]; then
    echo "Usage: $0 <version>"
    exit 1
fi

version=$1

if [ ! -z "$(git tag -l | grep -E '${package}-${version}$')" ]; then
    echo "Version ${version} already exists"
    exit 1
fi

if [ ! -d "${chwala_dir}/lib" ]; then
    echo "No directory ${chwala_dir}/lib/"
    exit 1
fi

if [ ! -d "${roundcube_dir}/program/lib/Roundcube/" ]; then
    echo "No directory ${roundcube_dir}/program/lib/Roundcube/"
    exit 1
fi

if [ ! -d "${roundcube_plugins_dir}/plugins/" ]; then
    echo "No directory ${roundcube_plugins_dir}/plugins/"
    exit 1
fi

if [ -f "./composer.phar" ]; then
    git clean -d -f -x
    rm -rf vendor/
fi

cp -a ${chwala_dir}/lib lib/FileAPI

pushd lib/FileAPI/ext/
rm -rf \
    Auth/ \
    HTTP/ \
    Mail/ \
    Net/  \
    PEAR5.php \
    PEAR.php \
    Roundcube/

popd

cp -a ${roundcube_dir}/program/lib/Roundcube/ lib/Roundcube
cp -a ${roundcube_plugins_dir}/plugins/ lib/plugins

curl -sS https://getcomposer.org/installer | php

if [ $? -ne 0 ]; then
    echo "Getting composer failed... Bye!"
    exit 1
fi

./composer.phar install --no-dev

if [ $? -ne 0 ]; then
    echo "Running ./composer.phar install failed... Bye!"
    exit 1
fi

if [ -d "../${package}-${version}/" ]; then
    rm -rf ../${package}-${version}/
fi

mkdir -p ../${package}-${version}/
cp -a * ../${package}-${version}/.
find ../${package}-${version}/ -type d -name ".git" -exec rm -rf {} \; 2>/dev/null

pwd=$(pwd)
pushd ..
tar czvf ${pwd}/${package}-${version}+dep.tar.gz ${package}-${version}/
popd
git archive --prefix=${package}-${version}/ HEAD | gzip -c > ${package}-${version}.tar.gz