Skip to content

Instantly share code, notes, and snippets.

@shuhaowu
Created March 27, 2016 04:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shuhaowu/6eeda480f6c6b3cb920b to your computer and use it in GitHub Desktop.
Save shuhaowu/6eeda480f6c6b3cb920b to your computer and use it in GitHub Desktop.
For releasing packages to PPA.
#!/bin/bash
set -e
PROJECT=$1
PPA_ID=$2
if [ -z $PROJECT ] || [ -z $PPA_ID ]; then
>&2 echo "usage: ./release.sh directory ppa_id"
exit 1
fi
if [ ! -d $PROJECT ]; then
>&2 echo "ERROR: $PROJECT does not exist"
exit 1
fi
VERSION=`head -n1 $PROJECT/debian/changelog | cut -f 2 -d " " | cut -f 2 -d ":" | cut -f 1 -d "-"`
PROJECT_VERSION="${PROJECT}_${VERSION}"
echo "doing release of $PROJECT_VERSION"
set -x
rm -rf _build/$PROJECT
mkdir -p _build/$PROJECT/$PROJECT_VERSION
pushd $PROJECT >/dev/null
git checkout-index -a -f --prefix="../_build/$PROJECT/$PROJECT_VERSION/"
popd >/dev/null
pushd _build/$PROJECT >/dev/null
tar czf ${PROJECT_VERSION}.orig.tar.gz $PROJECT_VERSION
pushd $PROJECT_VERSION >/dev/null
debuild -S -sa
popd >/dev/null
dput ppa:$PPA_ID ${PROJECT}*.changes
popd >/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment