diff options
author | Changcheng Liu <changcheng.liu@aliyun.com> | 2019-11-14 22:59:40 +0800 |
---|---|---|
committer | Changcheng Liu <changcheng.liu@aliyun.com> | 2019-11-21 10:09:24 +0800 |
commit | bea6a7cb6200074219ce4e21916f818be5620355 (patch) | |
tree | 368e2078b4995fb0f8764c5b3bb749aeb3954656 /make-debs.sh | |
parent | ac907d7e5a36e8ed5a7f2d395b9888b181950c30 (diff) | |
download | liburing-bea6a7cb6200074219ce4e21916f818be5620355.tar.gz liburing-bea6a7cb6200074219ce4e21916f818be5620355.tar.bz2 |
script to build liburing into debian package
Signed-off-by: Changcheng Liu <changcheng.liu@aliyun.com>
Diffstat (limited to 'make-debs.sh')
-rwxr-xr-x | make-debs.sh | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/make-debs.sh b/make-debs.sh new file mode 100755 index 0000000..01d563c --- /dev/null +++ b/make-debs.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +# Copyright (C) 2019 Liu Changcheng <changcheng.liu@aliyun.com> +# Author: Liu Changcheng <changcheng.liu@aliyun.com> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +set -xe + +# Create dir for build +base=${1:-/tmp/release} +codename=$(lsb_release -sc) +releasedir=$base/$(lsb_release -si)/liburing +rm -rf $releasedir +mkdir -p $releasedir + +src_dir=$(readlink -e `basename $0`) +liburing_dir=$(dirname $src_dir) +basename=$(basename $liburing_dir) +dirname=$(dirname $liburing_dir) +version=$(git describe --match "lib*" | cut -d '-' -f 2) +outfile="liburing-$version" +orgfile=$(echo $outfile | tr '-' '_') + +# Prepare source code +cp -arf ${dirname}/${basename} ${releasedir}/${outfile} +cd ${releasedir}/${outfile} +git clean -dxf + +# Change changelog if it's needed +cur_ver=`head -l debian/changelog | sed -n -e 's/.* (\(.*\)) .*/\1/p'` +if [ "$cur_ver" != "$version-1" ]; then + dch -D $codename --force-distribution -b -v "$version-1" "new version" +fi + +# Create tar archieve +cd ../ +tar cvzf ${outfile}.tar.gz ${outfile} +ln -s ${outfile}.tar.gz ${orgfile}.orig.tar.gz + +# Build debian package +cd - +debuild |