diff --git a/debian/control b/debian/control
index 3128a10e633731b9111186c8a2271a2c2e6d1583..3a4c8c817180ea10ed48e2bd12489ba4c0cf4584 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: audit
 Section: net
 Priority: extra
 Maintainer: ale <ale@incal.net>
-Build-Depends: debhelper (>= 8.0.0), libleveldb-dev, golang, git
+Build-Depends: debhelper (>= 8.0.0), libleveldb-dev, git
 Standards-Version: 3.9.4
 Homepage: https://git.autistici.org/ai/audit
 
diff --git a/debian/install-golang b/debian/install-golang
new file mode 100644
index 0000000000000000000000000000000000000000..63fc7411f5d25975c44937954a3be12afdbbd553
--- /dev/null
+++ b/debian/install-golang
@@ -0,0 +1,27 @@
+#!/bin/bash
+#
+# Install Go.
+#
+
+get_arch() {
+  case $(uname -m) in
+  i686) echo 386 ;;
+  x86_64) echo amd64 ;;
+  esac
+}
+
+ROOT="${1}"
+VERSION="${2}"
+ARCH=$(get_arch)
+DL_URL=https://go.googlecode.com/files/go${VERSION}.linux-${ARCH}.tar.gz
+
+mkdir -p ${ROOT}
+wget -O - ${DL_URL} \
+  | tar -C ${ROOT} --strip-components 1 -x -z
+
+echo
+echo "Go ${VERSION} installed in ${ROOT}"
+
+exit 0
+
+
diff --git a/debian/localauditd.postinst b/debian/localauditd.postinst
new file mode 100755
index 0000000000000000000000000000000000000000..e7a9ca5b0abf19a818296ddb5349f930592ef005
--- /dev/null
+++ b/debian/localauditd.postinst
@@ -0,0 +1,36 @@
+#!/bin/sh
+# postinstall script for localauditd.
+
+case "$1" in
+configure)
+
+	if ! getent group audit >/dev/null; then
+		addgroup --system audit
+	fi
+
+        if ! getent user localaudit >/dev/null; then
+		adduser --system --home /var/spool/audit --no-create-home \
+			--ingroup audit localaudit
+	fi
+
+	mkdir -p /var/spool/audit/incoming
+	chown -R localaudit:audit /var/spool/audit
+        chmod 0755 /var/spool/audit
+        chmod 0775 /var/spool/audit/incoming
+
+	;;
+abort-upgrade|abort-remove|abort-deconfigure)
+	;;
+*)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+	;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
diff --git a/debian/rules b/debian/rules
index a7de79cc7acbaaac58acae071f4e7513f25eef18..52d5c4b1bfd3cfeed10d07484a16ccd5cc3aca2e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -8,26 +8,29 @@
 export DH_OPTIONS
 
 GOPKG = git.autistici.org/ai/audit
+GO_VERSION = 1.2.1
 
 DEBDIR = $(CURDIR)/debian
 BUILDDIR = $(CURDIR)/debian/build
-SVCDIR = $(DESTDIR)/etc/svc
+GOROOT = $(CURDIR)/debian/build-go
 
 %:
 	dh $@ 
 
 override_dh_install:
-	# Build the sources
+	# Build the sources using a locally downloaded Go version.
+	# This is crazy, clearly, but it's a temporary workaround for wheezy.
+	# Also, we redefine 'leveldb_free' to 'free' because the LevelDB
+	# version in wheezy does not have that symbol.
 	install -m 755 -o root -g root -d $(DEBDIR)/auditd/usr/sbin
 	install -m 755 -o root -g root -d $(DEBDIR)/localauditd/usr/sbin
-	(tmpdir=`mktemp -d` ; \
-	 tmpdir=`cd $$tmpdir && pwd` ; \
-	 export GOPATH=$$tmpdir ; unset GOBIN ; \
-	 mkdir -p $$tmpdir/src/$(dir $(GOPKG)) ; \
-	 ln -s $(CURDIR) $$tmpdir/src/$(GOPKG) ; \
-	 cd $$tmpdir/src && \
-	 go get -d -v ./$(GOPKG)/... && go install -v ./$(GOPKG)/... && \
-	 install -m 755 -o root -g root $$tmpdir/bin/auditd $(DEBDIR)/auditd/usr/sbin/auditd && \
-	 install -m 755 -o root -g root $$tmpdir/bin/localauditd $(DEBDIR)/localauditd/usr/sbin/localauditd && \
-	 rm -fr $$tmpdir)
+	(export GOPATH=$(BUILDDIR) GOROOT=$(GOROOT) ; \
+	 mkdir -p $(GOROOT) $(BUILDDIR)/src/$(GOPKG) ; \
+	 $(CURDIR)/debian/install-golang $(GOROOT) $(GO_VERSION) ; \
+	 rsync -a --exclude=debian --exclude=.git $(CURDIR)/ $(BUILDDIR)/src/$(GOPKG)/ ; \
+	 cd $(BUILDDIR)/src && \
+	 $(GOROOT)/bin/go get -d -v ./$(GOPKG)/... && \
+	 CGO_CFLAGS=-Dleveldb_free=free $(GOROOT)/bin/go install -v ./$(GOPKG)/... && \
+	 install -m 755 -o root -g root $(BUILDDIR)/bin/auditd $(DEBDIR)/auditd/usr/sbin/auditd && \
+	 install -m 755 -o root -g root $(BUILDDIR)/bin/localauditd $(DEBDIR)/localauditd/usr/sbin/localauditd)