Merge branch 'master' into development
diff --git a/.gitignore b/.gitignore
index 9cef6bd..321fa74 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,4 +5,4 @@
 *.pyc
 *.pyo
 .unittests
-
+build/
diff --git a/PACKAGING.md b/PACKAGING.md
new file mode 100644
index 0000000..75914db
--- /dev/null
+++ b/PACKAGING.md
@@ -0,0 +1,4 @@
+# Packaging gr-gsm
+## This is a work in progress...
+
+* Run the build.sh script!
diff --git a/apps/grgsm_decode b/apps/grgsm_decode
index 698cf80..4be199d 100755
--- a/apps/grgsm_decode
+++ b/apps/grgsm_decode
@@ -39,7 +39,8 @@
                  cfile=None, fc=939.4e6, samp_rate=2e6, 
                  a5=1, a5_kc=None,
                  speech_file=None, speech_codec=None,
-                 verbose=False):
+                 verbose=False,
+                 print_bursts=False):
 
         gr.top_block.__init__(self, "Gr-gsm Decode")
 
@@ -60,6 +61,7 @@
         self.speech_file = speech_file
         self.speech_codec = speech_codec
         self.verbose = verbose
+        self.print_bursts = print_bursts
 
         ##################################################
         # Blocks
@@ -113,6 +115,10 @@
         if self.verbose:
             self.message_printer = grgsm.message_printer(pmt.intern(""), True, True, False)
 
+        if self.print_bursts:
+            self.bursts_printer = grgsm.bursts_printer(pmt.intern(""), True, True, True, True)
+
+
 
         ##################################################
         # Asynch Message Connections
@@ -129,6 +135,8 @@
             self.msg_connect(self.receiver, "C0", self.dummy_burst_filter, "in")
 
         self.msg_connect(self.dummy_burst_filter, "out", self.timeslot_filter, "in")
+        if self.print_bursts:
+            self.msg_connect(self.timeslot_filter, "out", self.bursts_printer, 'bursts')
 
         if (self.chan_mode == 'BCCH_SDCCH4' or self.chan_mode == 'SDCCH8') and self.subslot_filter is not None:
             self.msg_connect(self.timeslot_filter, "out", self.subslot_filter, "in")
@@ -262,6 +270,8 @@
     parser.add_option("-c", "--cfile", dest="cfile", help="Input file (cfile)")
     parser.add_option("-v", "--verbose", action="store_true",
                       help="If set, the decoded messages (with frame number and count) are printed to stdout")
+    parser.add_option("-p", "--print-bursts", action="store_true",
+                      help="If set, the raw bursts (with frame number and count) are printed to stdout")
 
     # group cfile options together
     cfile_options = OptionGroup(
@@ -367,7 +377,8 @@
                           cfile=options.cfile, fc=fc, samp_rate=options.samp_rate,
                           a5=options.a5, a5_kc=kc,
                           speech_file=options.speech_output_file, speech_codec=tch_codecs.get(options.speech_codec),
-                          verbose=options.verbose)
+                          verbose=options.verbose,
+                          print_bursts=options.print_bursts)
 
     # run
     tb.start()
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..8383aaf
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# First, get into the right directory
+THISPATH=$(dirname "$BASH_SOURCE")
+cd $THISPATH
+
+# Now, we check to see that the version env var is set
+${CPACK_PACKAGE_VERSION:?"Need to set CPACK_PACKAGE_VERSION env var!"}
+export $CPACK_DEBIAN_PACKAGE_ARCHITECTURE=`dpkg --print-architecture`
+
+# OK, now we get down to the business of building...
+rm -rf ./build
+mkdir build
+cd build
+cmake ..
+make package
+cpack -G DEB
+mv ./*.deb ../installer-packages
+echo "If you've gotten to this point, the package has been built"
+echo "and exists at "$THISPATH"/installer-packages"
+echo "Don't forget to add and commit the new package, and tag the commit!"
diff --git a/installer-packages/.placeholder b/installer-packages/.placeholder
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/installer-packages/.placeholder
diff --git a/tests/dockerfiles/Debian_Jessie.docker b/tests/dockerfiles/Debian_Jessie.docker
index 15ead21..a359648 100644
--- a/tests/dockerfiles/Debian_Jessie.docker
+++ b/tests/dockerfiles/Debian_Jessie.docker
@@ -1,44 +1,25 @@
-FROM ashmastaflash/gradio37_debjessie
-
-ENV OSMOCORE_GIT=git://git.osmocom.org/libosmocore.git
-ENV OSMOCORE_TAG=0.6.3
-ENV GR_OSMOSDR_GIT=git://git.osmocom.org/gr-osmosdr
+FROM debian:testing
 
 # We know it's going to foul up, so we run this install separately and then ...fix... dpkg status
-#RUN apt-get update && apt-get install -y uhd-host || \
-#     sed -i "s/Status: install ok half-configured/Status: install ok installed/g" /var/lib/dpkg/status
+RUN apt-get update && apt-get install -y uhd-host || \
+     sed -i "s/Status: install ok half-configured/Status: install ok installed/g" /var/lib/dpkg/status
 
-RUN apt-get update && apt-get install -y \
+RUN apt-get install -y \
     git \
     vim \
     cmake \
     autoconf \
     libtool \
-    python-talloc-dev \
-    libtalloc2 \
-    libtalloc-dev \
-    libpcsclite-dev \
     build-essential \
     libboost-all-dev \
     libcppunit-dev swig \
     doxygen \
     liblog4cpp5-dev \
     python-scipy \
-    librtlsdr-dev \
-    librtlsdr0 \
-    rtl-sdr \
-    wget \
-    libxi-dev
-
-
-RUN /usr/bin/git clone $OSMOCORE_GIT && \
-    cd libosmocore && \
-    git checkout tags/$OSMOCORE_TAG && \
-    autoreconf -i && \
-    ./configure && \
-    make && \
-    make install && \
-    ldconfig -i
+    gnuradio \
+    gnuradio-dev \
+    gr-osmosdr \
+    libosmogsm5
 
 COPY ./ /src/
 RUN ls /src
@@ -47,7 +28,6 @@
     cd /src/build && \
     cmake .. && \
     make && \
-    # make test && \
+    make test && \
     make install && \
     ldconfig
-
diff --git a/tests/dockerfiles/Debian_testing.docker b/tests/dockerfiles/Debian_testing.docker
index 24dde82..4b3bced 100644
--- a/tests/dockerfiles/Debian_testing.docker
+++ b/tests/dockerfiles/Debian_testing.docker
@@ -1,7 +1,7 @@
 FROM debian:testing
+MAINTAINER Ash Wilson
 
 RUN apt-get update && apt-get install -y \
-    uhd-host \
     cmake \
     autoconf \
     libtool \
@@ -18,9 +18,9 @@
 COPY ./ /src/
 RUN ls /src
 
-RUN mkdir /src/build && \
-    cd /src/build && \
-    cmake .. && \
+RUN mkdir /src/build
+WORKDIR /src/build
+RUN cmake .. && \
     make && \
     make install && \
     ldconfig
diff --git a/tests/dockerfiles/Ubuntu_15_04.docker b/tests/dockerfiles/Ubuntu_15_04.docker
index 74304bd..58ef22c 100644
--- a/tests/dockerfiles/Ubuntu_15_04.docker
+++ b/tests/dockerfiles/Ubuntu_15_04.docker
@@ -9,7 +9,7 @@
      sed -i "s/Status: install ok half-configured/Status: install ok installed/g" /var/lib/dpkg/status
 
 
-RUN apt-get install -y \
+RUN apt-get update && apt-get install -y \
     git \
     python \
     python-scipy \
@@ -55,9 +55,9 @@
     unzip
 
 # Build libosmosdr
- RUN git clone $OSMOSDR_GIT && \
-    cd libosmocore && \
-    git checkout tags/$OSMOCORE_TAG && \
+RUN git clone $OSMOSDR_GIT
+WORKDIR libosmocore
+RUN git checkout tags/$OSMOCORE_TAG && \
     autoreconf -i && \
     ./configure && \
     make && \
@@ -70,10 +70,10 @@
 RUN echo "[grc]\nlocal_blocks_path=/usr/local/share/gnuradio/grc/blocks" > \
     /root/.gnuradio/config.conf
 
-RUN mkdir /src/build && \
-    cd /src/build && \
-    cmake .. && \
+RUN mkdir /src/build
+WORKDIR /src/build
+RUN cmake .. && \
     make && \
-    # make test && \
+    make test && \
     make install && \
     ldconfig
diff --git a/tests/dockerfiles/Ubuntu_16_04.docker b/tests/dockerfiles/Ubuntu_16_04.docker
index de0b215..ac3e549 100644
--- a/tests/dockerfiles/Ubuntu_16_04.docker
+++ b/tests/dockerfiles/Ubuntu_16_04.docker
@@ -2,7 +2,6 @@
 MAINTAINER Ash Wilson
 
 RUN apt-get update && apt-get install -y \
-    uhd-host \
     cmake \
     autoconf \
     libtool \
@@ -19,9 +18,9 @@
 COPY ./ /src/
 RUN ls /src
 
-RUN mkdir /src/build && \
-    cd /src/build && \
-    cmake .. && \
+RUN mkdir /src/build
+WORKDIR /src/build
+RUN cmake .. && \
     make && \
     make install && \
     ldconfig
diff --git a/tests/dockerfiles/Ubuntu_16_04_debbuild.docker b/tests/dockerfiles/Ubuntu_16_04_debbuild.docker
new file mode 100644
index 0000000..030ece8
--- /dev/null
+++ b/tests/dockerfiles/Ubuntu_16_04_debbuild.docker
@@ -0,0 +1,27 @@
+FROM ubuntu:16.04
+MAINTAINER Ash Wilson
+
+RUN apt-get update && apt-get install -y \
+    cmake \
+    autoconf \
+    libtool \
+    build-essential \
+    libcppunit-dev \
+    swig \
+    doxygen \
+    liblog4cpp5-dev \
+    python-scipy \
+    gnuradio-dev \
+    gr-osmosdr \
+    libosmocore-dev
+
+COPY ./ /src/
+RUN ls /src
+
+RUN mkdir /src/build
+WORKDIR /src/build
+RUN cmake .. && \
+    make package && \
+    cpack -G DEB && \
+    ls
+