summaryrefslogtreecommitdiffstats
path: root/packaging/deb_script/deb_build.sh
blob: 3fe533da69efc1baadc08286b8503ecbdd5af899 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
set -x
VERSION=$1
BUILD_ROOT=`pwd`

function download_src(){
#download the package
wget http://bits.gluster.com//pub/gluster/glusterfs/src/glusterfs-$VERSION.tar.gz
}

function make_orig()
{
#cp as orig.
cp glusterfs-$VERSION.tar.gz glusterfs-$VERSION.orig.tar.gz
cp glusterfs-$VERSION.tar.gz glusterfs_$VERSION.orig.tar.gz
}

function file_untar()
{
#untar 
tar -zxvf glusterfs-$VERSION.tar.gz
}

function create_debian_dir()
{
cd glusterfs-$VERSION
#dh_make
dh_make<<EOF
s

EOF
}


function rmfiles_debian_dir(){
#remove files
rm -rf $BUILD_ROOT/glusterfs-$VERSION/debian/copyright docs README.* *.?x
rm -rf $BUILD_ROOT/glusterfs-$VERSION/debian/docs
rm -rf $BUILD_ROOT/glusterfs-$VERSION/debian/README.*
rm -rf $BUILD_ROOT/glusterfs-$VERSION/debian/*.?x
rm -rf $BUILD_ROOT/glusterfs-$VERSION/debian/glusterfs*
}


function edfiles_debian_dir(){
cd $BUILD_ROOT
#modify
sed -i "s/3.2.3/$VERSION/g" $BUILD_ROOT/glusterfs-$VERSION/debian/changelog

#cp control
cp $BUILD_ROOT/files/control $BUILD_ROOT/glusterfs-$VERSION/debian

#cp postinst
cp $BUILD_ROOT/files/postinst $BUILD_ROOT/glusterfs-$VERSION/debian

#cp rules
cp $BUILD_ROOT/files/rules $BUILD_ROOT/glusterfs-$VERSION/debian
}

function start_debbuild(){
#move 
cd $BUILD_ROOT/glusterfs-$VERSION
apt-get -y remove libibverbs-dev libibverbs1
#start the build
DEB_BUILD_OPTIONS=noopt,nostrip debuild
}



function start_debbuild_with_rdma(){
#move 
cd $BUILD_ROOT/glusterfs-$VERSION
apt-get -y install libibverbs-dev libibverbs1

#cp control
cp $BUILD_ROOT/files/control_ib $BUILD_ROOT/glusterfs-$VERSION/debian/control

#start the build
DEB_BUILD_OPTIONS=noopt,nostrip debuild
}

function mv_files(){
mkdir  $BUILD_ROOT/glfs-$VERSION
mv $BUILD_ROOT/glusterfs_$VERSION-1_amd64.deb $BUILD_ROOT/glfs-$VERSION
}

function mv_ib_files(){
mkdir  $BUILD_ROOT/glfs-$VERSION -p
cp $BUILD_ROOT/glusterfs_$VERSION-1_amd64.deb $BUILD_ROOT/glfs-$VERSION/glusterfs_$VERSION-1_with_rdma_amd64.deb 
}

############Main part################

download_src
make_orig
file_untar
create_debian_dir
rmfiles_debian_dir
edfiles_debian_dir
start_debbuild
mv_files
start_debbuild_with_rdma
mv_ib_files
#####################