forked from larskanis/greensql-fw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·132 lines (114 loc) · 3.09 KB
/
build.sh
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#/bin/sh
if `which flex >/dev/null 2>&1`
then
echo "flex ok"
else
echo "flex not found. This application is used during compilation."
exit
fi
if `which bison >/dev/null 2>&1`
then
echo "bison ok"
else
echo "bison not found. This application is used during compilation."
exit
fi
build_deb()
{
make clean >/dev/null 2>&1
cd debian
debuild -us -uc
rm -rf debian/greensql-fw
cd ../../
echo
echo "package created ../ directory"
exit
}
build_bsd()
{
make clean >/dev/null 2>&1
make
cd freebsd
VIRTDIR=./usr/local
CURDIR=`pwd`
rm -rf $VIRTDIR
mkdir -p $VIRTDIR/sbin
cp ../greensql-fw $VIRTDIR/sbin/
cp ../scripts/greensql-create-db.sh $VIRTDIR/sbin/
mkdir -p $VIRTDIR/etc/greensql
cp ../conf/*.conf $VIRTDIR/etc/greensql/
mkdir -p $VIRTDIR/etc/rc.d
cp greensql-fw.sh $VIRTDIR/etc/rc.d/greensql-fw
mkdir -p $VIRTDIR/share/doc/greensql-fw
cp ../docs/greensql-mysql-db.txt $VIRTDIR/share/doc/greensql-fw/
cp ../docs/tautology.txt $VIRTDIR/share/doc/greensql-fw/
cp ../install.txt $VIRTDIR/share/doc/greensql-fw/
cp ../license.txt $VIRTDIR/share/doc/greensql-fw/
# mkdir -p $VIRTDIR/www/greensql-fw/
# cp -R ../../greensql-console/* $VIRTDIR/www/greensql-fw/
pkg_create -v -d pkg-descr -f pkg-plist -i pkg-install -S $CURDIR -p /usr/local greensql-fw.tbz
rm -rf ./usr
mv greensql-fw.tbz ../../
cd ../../
echo
echo "Package created in ../ directory !!!"
echo "Package file name is ../greensql-fw.tbz"
exit
}
build_rpm()
{
if `which rpmbuild >/dev/null 2>&1`
then
echo "rpmbuild ok"
else
echo "rpmbuild not found. This application is used during package creation."
exit
fi
GREEN_VER=`grep Version rpm/greensql-fw.spec | sed -e "s/^[a-zA-Z]*:\s*//"`
if [ -d "../greensql-console" ] && [ ! -d "greensql-console" ]; then
cp -R ../greensql-console .
fi
if [ ! -d "../greensql-fw-$GREEN_VER" ]; then
mkdir ../greensql-fw-$GREEN_VER
fi
cp -r ./ ../greensql-fw-$GREEN_VER
cd ..
rm -rf greensql-fw-$GREEN_VER.tar.gz
tar -czf greensql-fw-$GREEN_VER.tar.gz greensql-fw-$GREEN_VER/
rpmbuild -ta greensql-fw-$GREEN_VER.tar.gz
echo ""
#echo "Look for packages in the following directory /usr/src/packages"
exit
}
if `grep -i ubuntu /etc/issue >/dev/null 2>&1`
then
echo "Building Ubuntu package"
build_deb
fi
if `grep -i debian /etc/issue >/dev/null 2>&1`
then
echo "Building Debian package"
build_deb
fi
if `grep -i -E "suse|fedora|redhat|centos" /etc/issue >/dev/null 2>&1`
then
echo "Building rpm package (for SuSe/Fedora/Redhat/Centos)"
build_rpm
fi
if `grep -i -E "suse|fedora|redhat|centos" /etc/rpm/platform >/dev/null 2>&1`
then
echo "Building rpm package (for SuSe/Fedora/Redhat/Centos)"
build_rpm
fi
if `uname | grep -i freebsd >/dev/null 2>&1`
then
echo "Building FreeBSD package"
build_bsd
fi
echo "This script could be used to build greensql-fw package for:"
echo "Debian/Ubuntu/FreeBSD/RedHat/CentOS/Fedora/Suse"
echo "For other systems you have to do some hacking"
echo
echo "You can start by running: make"
echo
exit