forked from HenriWahl/dhcpy6d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·61 lines (47 loc) · 1.39 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
#!/bin/sh
#
#
# simple build script for dhcpy6d
#
#
if [ -f /etc/debian_version ]
then
echo "Building .deb package"
cd installer
ln -s ../etc
ln -s ../dhcpy6d
ln -s ../dhcpy6
ln -s ../doc
ln -s ../var
ln -s ../setup.py
cp etc/default/dhcpy6d debian/dhcpy6d.default
cp etc/logrotate.d/dhcpy6d debian/dhcpy6d.logrotate
cp etc/init.d/dhcpy6d debian/dhcpy6d.init
chmod 755 debian/rules
dh clean --with python2
debuild binary-indep
elif [ -f /etc/redhat-release ]
then
echo "Building .rpm package"
TOPDIR=$HOME/dhcpy6d.$$
SPEC=installer/redhat/dhcpy6d.spec
# create source folder for rpmbuild
mkdir -p $TOPDIR/SOURCES
# init needed in TOPDIR/SOURCES
cp -pf installer/redhat/init.d/dhcpy6d $TOPDIR/SOURCES
# use setup.py sdist build output to get package name
FILE=`python setup.py sdist --dist-dir $TOPDIR/SOURCES | grep "creating dhcpy6d-" | head -n1 | cut -d" " -f2`
echo Source file: $FILE.tar.gz
# version
VERSION=`echo $FILE | cut -d"-" -f 2`
# replace version in the spec file
sed -i "s|Version:.*|Version: $VERSION|" $SPEC
# finally build binary rpm
rpmbuild -bb --define "_topdir $TOPDIR" $SPEC
# get rpm file
cp -f `find $TOPDIR/RPMS -name "$FILE-1.*noarch.rpm"` .
# clean
rm -rf $TOPDIR
else
echo "Package creation is only supported on Debian and RedHat derivatives."
fi