Created
August 13, 2015 17:20
-
-
Save liquidgecka/c03fb64b1dc309995d2d to your computer and use it in GitHub Desktop.
A script for uploading diamond to a ppa.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
PPA=orchestrate/standard | |
# Change to a temp directory. | |
TMPDIR="$(mktemp -d /tmp/make_diamond.XXXXXXX)" | |
cd "$TMPDIR" | |
trap 'rm -rf "${TMPDIR}"' EXIT | |
# Export some useful stuff for package maintenance. | |
export [email protected] | |
export DEBFULLNAME='Brady Catherman' | |
if ! dpkg -l ubuntu-dev-tools > /dev/null 2>&1 ; then | |
echo "Please install ubuntu-dev-tools first." | |
fi | |
DISTRO="$( lsb_release -c | awk '{print $2}' )" | |
DISTROS="$( distro-info --supported )" | |
RELEASE="${1}" | |
if [ -z "${RELEASE}" ] ; then | |
RELEASE="liquidgecka1" | |
fi | |
# Clone the repo. | |
git clone https://github.com/BrightcoveOS/Diamond | |
# Get the version.. remove the first two -'s from the git date timestamp. | |
V=$(git --git-dir=Diamond/.git log -n1 --date=short --format=format:%ad+%h) | |
V=${V//-/} | |
if [ ! -d "diamond-${V}" ] ; then | |
DBUILD_ARGS="-sa" | |
# Nuke the .git directory since its not useful. | |
rm -rf Diamond/.git* | |
# Rename the directory to something more meaningful. | |
mv Diamond "diamond-${V}" | |
# tar the whole thing up into an orig file. | |
tar -cv "diamond-${V}" | gzip > "diamond_${V}.orig.tar.gz" | |
else | |
DEBUILD_ARGS="" | |
# Remove the sources, they are not needed. | |
rm -rf Diamond | |
fi | |
# Add an item to the changelog file. | |
date="$(date +"%a, %-d %b %Y %H:%M:%S %z")" | |
( | |
echo "diamond (${V}-${RELEASE}) ${DISTRO}; urgency=low" | |
echo " * Pulled from upstream." | |
echo " -- Brady Catherman <[email protected]> $date" | |
echo "" | |
cat "diamond-${V}/debian/changelog" | |
) > "diamond-${V}/debian/changelog.new" | |
mv -f "diamond-${V}/debian/changelog.new" "diamond-${V}/debian/changelog" | |
# Actually perform the build. | |
( cd "diamond-${V}" && debuild -S "${DEBUILD_ARGS}" ) | |
# Upload the package. | |
dput ppa:"$PPA" "diamond_${V}-${RELEASE}_source.changes" | |
# Upload backported packages. | |
for i in $DISTROS ; do | |
if [ "$i" == "$DISTRO" ] ; then | |
continue | |
fi | |
backportpackage \ | |
-d "${i}" \ | |
--upload ppa:"$PPA" \ | |
"diamond_${V}-${RELEASE}.dsc" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment