make-deb 2.62 KB
Newer Older
Bernd Schubert's avatar
Bernd Schubert committed
1 2 3 4
#!/bin/bash 

set -e

5
NAME="beegfs-utils"
Bernd Schubert's avatar
Bernd Schubert committed
6

7
source ../../beegfs-version
Bernd Schubert's avatar
Bernd Schubert committed
8

9 10
CONCURRENCY=${MAKE_CONCURRENCY:-4}

11 12 13
BEEGFS_OPENTK_PATH=${BEEGFS_OPENTK_PATH:-`readlink -f ../../beegfs_opentk_lib`}
BEEGFS_COMMON_PATH=${BEEGFS_COMMON_PATH:-`readlink -f ../../beegfs_common`}
BEEGFS_THIRDPARTY_PATH=${BEEGFS_THIRDPARTY_PATH:-`readlink -f ../../beegfs_thirdparty`}
14
BEEGFS_ONLINE_CFG_PATH=${BEEGFS_ONLINE_CFG_PATH:-`readlink -f ../../beegfs_ctl`}
15
BEEGFS_FSCK_PATH=${BEEGFS_FSCK_PATH:-`readlink -f ../../beegfs_fsck`}
Bernd Schubert's avatar
Bernd Schubert committed
16 17 18

CHANGELOG="debian/changelog"
RULES="debian/rules"
19
CONTROL="debian/control"
Bernd Schubert's avatar
Bernd Schubert committed
20

21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
CURRENT_TIME=`date "+%a, %d %b %Y %H:%M:%S %z"`

# parse BeeGFS version for debian versioning
BEEGFS_DEB_MAJOR=`echo ${BEEGFS_VERSION} | cut -d . -f 1`
BEEGFS_DEB_MINOR=`echo ${BEEGFS_VERSION} | cut -d - -f 1 | cut -d . -f 2`
BEEGFS_DEB_REL_SUFFIX=`echo ${BEEGFS_VERSION}- | cut -d - -f 2`
EPOCH=${BEEGFS_DEB_MAJOR}

if [ ! -z ${BEEGFS_DEB_REL_SUFFIX} ]; then
   # prepend "~" to the suffix, so final version will look like this:
   # "beegfs-XXX-6.0-debian8~beta1"
   BEEGFS_DEB_REL_SUFFIX="~${BEEGFS_DEB_REL_SUFFIX}"
fi

BEEGFS_DEB_FULLVERSION=${EPOCH}:${BEEGFS_DEB_MAJOR}.${BEEGFS_DEB_MINOR}${BEEGFS_DEB_REL_SUFFIX}-debian${DEBIAN_VERSION}

Bernd Schubert's avatar
Bernd Schubert committed
37
sed \
38 39 40
	-e "s/__NAME__/$NAME/g" 			              \
	-e "s/__BEEGFS_DEB_FULLVERSION__/${BEEGFS_DEB_FULLVERSION}/g" \
	-e "s/__CURRENT_TIME__/${CURRENT_TIME}/g"                     \
Bernd Schubert's avatar
Bernd Schubert committed
41 42 43
	${CHANGELOG}.in > ${CHANGELOG}

sed \
44 45 46 47
	-e "s#__BEEGFS_COMMON_PATH__#$BEEGFS_COMMON_PATH#g" 		\
	-e "s#__BEEGFS_OPENTK_PATH__#$BEEGFS_OPENTK_PATH#g" 		\
	-e "s#__BEEGFS_THIRDPARTY_PATH__#$BEEGFS_THIRDPARTY_PATH#g"	\
	-e "s#__BEEGFS_ONLINE_CFG_PATH__#$BEEGFS_ONLINE_CFG_PATH#g" 	\
48
	-e "s#__BEEGFS_FSCK_PATH__#$BEEGFS_FSCK_PATH#g" 		\
49
	-e "s/__BEEGFS_VERSION__/$BEEGFS_VERSION/g"   			\
50
	-e "s/__NAME__/$NAME/g" 					\
51 52
	-e "s/__USER_CXXFLAGS__/$USER_CXXFLAGS/g"			\
	-e "s/__USER_LDFLAGS__/$USER_LDFLAGS/g"				\
53
	-e "s/__BEEGFS_DEBUG__/$BEEGFS_DEBUG/g"				\
54
	-e "s/__MAKE_CONCURRENCY__/$CONCURRENCY/g"			\
Bernd Schubert's avatar
Bernd Schubert committed
55 56
	${RULES}.in > ${RULES}

57
sed \
58
	-e "s/__BEEGFS_DEB_FULLVERSION__/${BEEGFS_DEB_FULLVERSION}/g" \
59 60
	${CONTROL}.in > ${CONTROL}

Bernd Schubert's avatar
Bernd Schubert committed
61 62 63 64 65
chmod +x debian/rules

# build the package and supress lintian warnings. Lintian in Lenny cannot
# do that itself yet
# NOTE: package not signed yet! (-us -uc)
66
yes | debuild -us -uc 2>&1 | egrep -v "dir-or-file-in-opt | file-in-unusual-dir"
67
[ "${DEBIAN_VERSION}" = "9" ] && yes | debuild -- clean || debuild clean
Bernd Schubert's avatar
Bernd Schubert committed
68 69 70 71 72 73 74

if [ -z "$DEBIAN_ARCHIVE_DIR" ]; then
	DEBIAN_ARCHIVE_DIR=`mktemp -d /tmp/debian_archive.XXXXXXXXX`
fi

mv ../*.build ../*.changes ../*.deb ../*.dsc ../*.tar.gz $DEBIAN_ARCHIVE_DIR/
echo "Wrote package files to $DEBIAN_ARCHIVE_DIR"