<NME> build.sh
<BEF> #!/bin/bash


VERSION="$(awk -F\" '/LOGSTASH_VERSION/ {print $2}' $(dirname $0)/../lib/logstash/version.rb)"

if [ "$#" -ne 2 ] ; then
  echo "Usage: $0 <os> <release>"
  echo
  echo "Example: $0 ubuntu 12.10"
fi

silent() {
  "$@" > /dev/null 2>&1
}
log() {
  echo "$@" >&2
}

os=$1
osver=$2

_fpm() {
  target=$1
  fpm -s dir -n logstash-kafka \
    -a noarch --url "https://github.com/joekiller/logstash-kafka.git" \
    --description "Logstash Kafka" \
    --vendor "na" \
    --license "Apache 2.0" \
    "$@"
}

case $os in
  centos|fedora|redhat|sl)
        _fpm -s dir -t rpm -n "logstash-kafka" -a all -v 1.2.1 --prefix /opt/logstash lib/ vendor/
    ;;
  ubuntu|debian)
    if ! echo $RELEASE | grep -q '\.(dev\|rc.*)'; then
      # This is a dev or RC version... So change the upstream version
      # example: 1.2.2.dev => 1.2.2~dev
      # This ensures a clean upgrade path.
      RELEASE="$(echo $RELEASE | sed 's/\.\(dev\|rc.*\)/~\1/')"
    fi

    _fpm -t deb --deb-user root --deb-group root \
      --iteration "1-$REVISION" --deb-ignore-iteration-in-dependencies \
      -d "logstash = $RELEASE" -v "$RELEASE" \
      -f -C $workdir/tarball --prefix /opt/logstash $(cat $workdir/files)
    ;;
esac
    ;;
  ubuntu|debian) 
    fpm -s dir -t deb -n logstash -v "$VERSION" \
      -a all --iteration 1-$os \
      -d "java6-runtime" \
      --deb-user root --deb-group root \
      --before-install $os/before-install.sh \
      --before-remove $os/before-remove.sh \

<MSG> pkg/debian: Make the package better

 * Append date, time and git commithash to the local revision for non-releases
 * Add a url and short description to the package
 * Depend on 'default-jre' instead of a specific java version

<DFF> @@ -2,6 +2,10 @@
 
 
 VERSION="$(awk -F\" '/LOGSTASH_VERSION/ {print $2}' $(dirname $0)/../lib/logstash/version.rb)"
+if ! git show-ref --tags | grep -q "$(git rev-parse HEAD)"; then
+	# HEAD is not tagged, add the date, time and commit hash to the revision
+	REVISION="+$(date +%Y%m%d%H%M)~$(git rev-parse --short HEAD)"
+fi
 
 if [ "$#" -ne 2 ] ; then
   echo "Usage: $0 <os> <release>"
@@ -95,8 +99,10 @@ case $os in
     ;;
   ubuntu|debian) 
     fpm -s dir -t deb -n logstash -v "$VERSION" \
-      -a all --iteration 1-$os \
-      -d "java6-runtime" \
+      -a all --iteration "${os}1${REVISION}" \
+      --url "http://logstash.net" \
+      --description "An extensible logging pipeline" \
+      -d "default-jre" \
       --deb-user root --deb-group root \
       --before-install $os/before-install.sh \
       --before-remove $os/before-remove.sh \

pkg/debian: Make the package better