2017-09-19 00:32:03 +02:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
readonly THISSCRIPT=$0
|
|
|
|
|
readonly BRANCH="testing"
|
|
|
|
|
readonly DISTRIB="stretch"
|
|
|
|
|
readonly DEBIAN_BRANCH="testing"
|
|
|
|
|
readonly BUILD_MESSAGE="YunoHost custom build."
|
|
|
|
|
|
|
|
|
|
source /home/vinaigrette/config/config
|
|
|
|
|
|
|
|
|
|
function main()
|
|
|
|
|
{
|
|
|
|
|
build_metronome
|
|
|
|
|
build_rspamd
|
2018-05-03 02:03:29 +02:00
|
|
|
|
build_unscd
|
2017-09-19 00:32:03 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function build_metronome()
|
|
|
|
|
{
|
2018-05-03 02:03:29 +02:00
|
|
|
|
|
2017-09-19 00:32:03 +02:00
|
|
|
|
local PACKAGE="metronome"
|
2018-05-03 02:03:29 +02:00
|
|
|
|
|
|
|
|
|
cd $GIT_REPOS/$PACKAGE
|
|
|
|
|
|
2017-09-19 00:32:03 +02:00
|
|
|
|
# For some reason metronome version must include a revision ("-x")
|
2018-05-03 02:03:29 +02:00
|
|
|
|
local VERSION="$(dpkg-parsechangelog -S Version 2>/dev/null)+yunohost-1"
|
2017-09-19 00:32:03 +02:00
|
|
|
|
|
|
|
|
|
build $PACKAGE $VERSION
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-03 02:03:29 +02:00
|
|
|
|
function build_unscd()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
local PACKAGE="unscd"
|
|
|
|
|
|
|
|
|
|
cd $GIT_REPOS/$PACKAGE
|
|
|
|
|
|
|
|
|
|
local VERSION="$(dpkg-parsechangelog -S Version 2>/dev/null)+yunohost"
|
|
|
|
|
|
|
|
|
|
build $PACKAGE $VERSION
|
|
|
|
|
}
|
2017-09-19 00:32:03 +02:00
|
|
|
|
|
|
|
|
|
function build_rspamd()
|
|
|
|
|
{
|
|
|
|
|
local PACKAGE="rspamd"
|
|
|
|
|
|
|
|
|
|
cd $GIT_REPOS/$PACKAGE
|
|
|
|
|
git checkout master
|
|
|
|
|
git pull origin master
|
|
|
|
|
|
|
|
|
|
# Get last tag and deduce version number to user...
|
|
|
|
|
local LASTTAG=$(git tag --list | grep "^1." | sort -n | tail -n1)
|
2018-05-03 02:03:29 +02:00
|
|
|
|
local VERSION="${LASTTAG}+yunohost"
|
2017-09-19 00:32:03 +02:00
|
|
|
|
git checkout $LASTTAG
|
|
|
|
|
|
|
|
|
|
build $PACKAGE $VERSION
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function build()
|
|
|
|
|
{
|
|
|
|
|
local PACKAGE=$1
|
|
|
|
|
local VERSION=$2
|
|
|
|
|
|
|
|
|
|
# SVERSION is VERSION without the -1 at the end ...
|
|
|
|
|
local SVERSION=$(echo $VERSION | tr '-' ' ' | awk '{print $1}')
|
2018-05-03 02:03:29 +02:00
|
|
|
|
|
2017-09-19 00:32:03 +02:00
|
|
|
|
cd $GIT_REPOS/$PACKAGE
|
|
|
|
|
|
|
|
|
|
# Tweak the changelog temporarily
|
|
|
|
|
echo "> Setting version in changelog to ${VERSION}"
|
|
|
|
|
rm -f debian/changelog.dch
|
|
|
|
|
cp debian/changelog debian/changelog.old
|
|
|
|
|
dch --package "${PACKAGE}" \
|
|
|
|
|
--force-bad-version \
|
|
|
|
|
-v "${VERSION}" \
|
|
|
|
|
-D "${DEBIAN_BRANCH}" \
|
|
|
|
|
--force-distribution \
|
2018-05-03 02:03:29 +02:00
|
|
|
|
$BUILD_MESSAGE \
|
2017-09-19 00:32:03 +02:00
|
|
|
|
> /dev/null 2>&1
|
|
|
|
|
|
|
|
|
|
# Create temporary folder
|
|
|
|
|
TMP_FOLDER=$(mktemp -d)
|
|
|
|
|
|
|
|
|
|
# Extract git archive a desired tag
|
|
|
|
|
echo "> Exporting in $TMP_FOLDER ... "
|
2018-05-03 02:03:29 +02:00
|
|
|
|
git ls-files | xargs tar -czf archive.tar.gz
|
2017-09-19 00:32:03 +02:00
|
|
|
|
cat archive.tar.gz | tar -xz -C $TMP_FOLDER
|
2018-05-03 02:03:29 +02:00
|
|
|
|
# For some reason, these wants archive named
|
2017-09-19 00:32:03 +02:00
|
|
|
|
# e.g. metronome_x.y.z+stuff.orig.tar.gz
|
|
|
|
|
# in the parent folder...
|
|
|
|
|
mv archive.tar.gz $TMP_FOLDER/../${PACKAGE}_${SVERSION}.orig.tar.gz
|
|
|
|
|
|
|
|
|
|
# Build Debian package
|
|
|
|
|
echo "> Starting build ..."
|
|
|
|
|
cd $TMP_FOLDER
|
|
|
|
|
$BUILD_DEB -d $BRANCH -c $DISTRIB . # Restore changelog
|
|
|
|
|
|
|
|
|
|
echo "> Restoring previous changelog"
|
|
|
|
|
cd $GIT_REPOS/$PACKAGE
|
|
|
|
|
cp debian/changelog.old debian/changelog
|
|
|
|
|
rm debian/changelog.old
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
main
|