rpm and deb

This commit is contained in:
Shlomi Noach 2018-05-27 20:49:08 +03:00
parent d20903e260
commit 460b15d827

View File

@ -3,6 +3,17 @@
#
RELEASE_VERSION=
buildpath=
builddir=
function setuptree() {
mkdir -p $buildpath
rm -rf ${buildpath:?}/*
b=$( mktemp -d $buildpath/gh-ostXXXXXX ) || return 1
mkdir -p $b/gh-ost
mkdir -p $b/gh-ost/usr/bin
echo $b
}
function build {
osname=$1
@ -10,6 +21,9 @@ function build {
GOOS=$3
GOARCH=$4
builddir=$(setuptree)
if ! go version | egrep -q 'go(1[.]9|1[.]1[0-9])' ; then
echo "go version is too low. Must use 1.9 or above"
exit 1
@ -26,6 +40,13 @@ function build {
fi
(cd $buildpath && tar cfz ./gh-ost-binary-${osshort}-${timestamp}.tar.gz $target)
if [ "$GOOS" == "linux" ] ; then
echo "Creating Distro full packages"
cp $buildpath/$target $builddir/gh-ost/usr/bin
fpm -v "${RELEASE_VERSION}" --epoch 1 -f -s dir -n gh-ost -m shlomi-noach --description "GitHub's Online Schema Migrations for MySQL " --url "https://github.com/github/gh-ost" --vendor "GitHub" --license "Apache 2.0" -C $builddir/gh-ost --prefix=/ -t rpm .
fpm -v "${RELEASE_VERSION}" --epoch 1 -f -s dir -n gh-ost -m shlomi-noach --description "GitHub's Online Schema Migrations for MySQL " --url "https://github.com/github/gh-ost" --vendor "GitHub" --license "Apache 2.0" -C $builddir/gh-ost --prefix=/ -t deb --deb-no-default-config-files .
fi
}
main() {