2020-05-06 18:45:11 -04:00
|
|
|
#! /bin/bash
|
|
|
|
|
|
|
|
# define parameters used in this deb package build
|
|
|
|
# enter comments as an argument string quoted. If you do not want comments to be added (ie. you have updated in git repo) type None
|
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
changelog_comments="This is a new source build generated from the deb_build_source.sh script"
|
|
|
|
else
|
|
|
|
changelog_comments=$1
|
|
|
|
fi
|
|
|
|
echo $changelog_comments
|
|
|
|
build=1 #change if updated build number required. Default is 1 as convention for keydb is to update minor version
|
2020-05-24 22:58:19 -04:00
|
|
|
version=$(grep KEYDB_REAL_VERSION ../../src/version.h | awk '{ printf $3 }' | tr -d \")
|
2020-05-06 18:45:11 -04:00
|
|
|
majorv="${version:0:1}"
|
|
|
|
distributor=$(lsb_release --id --short)
|
|
|
|
if [ "$distributor" == "Debian" ]; then
|
|
|
|
distname=+deb$(lsb_release --release --short | cut -d. -f1)u1
|
|
|
|
elif [ "$distributor" == "Ubuntu" ]; then
|
|
|
|
distname=~$(lsb_release --codename --short)1
|
|
|
|
fi
|
|
|
|
codename=$(lsb_release --codename --short)
|
|
|
|
date=$(date +%a," "%d" "%b" "%Y" "%T)
|
2020-05-26 12:44:25 -04:00
|
|
|
pkg_name=keydb-pro-$majorv:$version$distname
|
2020-05-06 18:45:11 -04:00
|
|
|
|
|
|
|
# create build tree
|
|
|
|
cd ../../../
|
2020-05-23 17:35:55 -04:00
|
|
|
tar -czvf keydb-pro_$version.orig.tar.gz --force-local KeyDB-Pro
|
|
|
|
cd KeyDB-Pro/pkg/deb/
|
2020-05-06 18:45:11 -04:00
|
|
|
mkdir -p $pkg_name/tmp
|
2020-05-31 11:50:06 -04:00
|
|
|
if [ "$codename" == "xenial" ]; then
|
|
|
|
cp -r debian_dh9 $pkg_name/tmp/debian
|
|
|
|
else
|
|
|
|
cp -r debian $pkg_name/tmp
|
|
|
|
fi
|
2020-05-06 18:45:11 -04:00
|
|
|
cp master_changelog $pkg_name/tmp/debian/changelog
|
2020-05-23 17:35:55 -04:00
|
|
|
mv ../../../keydb-pro_$version.orig.tar.gz ./$pkg_name
|
2020-05-06 18:45:11 -04:00
|
|
|
cd $pkg_name/tmp
|
2020-05-26 12:44:25 -04:00
|
|
|
changelog_str="keydb-pro ($majorv:$version-$build$distname) $codename; urgency=medium\n\n * $version $changelog_comments \n\n -- Ben Schermel <ben@eqalpha.com> $date +0000\n\n"
|
2020-05-06 18:45:11 -04:00
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
sed -i "1s/^/$changelog_str\n/" debian/changelog
|
|
|
|
elif [ $# -eq 1 ] && [ "$1" != "None" ]; then
|
|
|
|
sed -i "1s/^/$changelog_str\n/" debian/changelog
|
|
|
|
fi
|
|
|
|
sed -i "s/distribution_placeholder/$distname/g" debian/changelog
|
|
|
|
sed -i "s/codename_placeholder/$codename/g" debian/changelog
|
|
|
|
|
|
|
|
# generate required files and structure for pbuilder including .dsc file
|
|
|
|
debuild -S -sa
|
|
|
|
cd ../
|
|
|
|
|
|
|
|
# create pbuilder chrooted environment and build the deb package
|
2020-05-24 00:03:01 -04:00
|
|
|
if [ "$codename" == "xenial" ]; then
|
|
|
|
sudo pbuilder create --distribution $codename --othermirror "deb http://archive.ubuntu.com/ubuntu $codename universe multiverse"
|
|
|
|
else
|
|
|
|
sudo pbuilder create --distribution $codename
|
|
|
|
fi
|
|
|
|
|
2020-05-06 18:45:11 -04:00
|
|
|
sudo pbuilder --update
|
2020-05-23 17:35:55 -04:00
|
|
|
sudo pbuilder --build *.dsc --logfile /mnt/pbuilderlog.log
|
2020-05-06 18:45:11 -04:00
|
|
|
|
|
|
|
# move new packages to deb_files_generated and clean up
|
|
|
|
cp /var/cache/pbuilder/result/*$version*.deb ../deb_files_generated
|
2020-05-26 12:44:25 -04:00
|
|
|
sudo pbuilder clean
|
2020-05-06 18:45:11 -04:00
|
|
|
cd ../
|
|
|
|
rm -rf $pkg_name
|