diff --git a/debian/rules b/debian/rules
index cfd5752dbc1a4d99fb74cf997d80e5cdaefbb3d5..f8ebc5ce1ba3419a2c8a51003691a8391f2ad6d3 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,5 +1,12 @@
 #!/usr/bin/make -f
 
+
+PKD  = $(abspath $(dir $(MAKEFILE_LIST)))
+#PKG  = $(word 2,$(shell dpkg-parsechangelog -l$(PKD)/changelog --show-field=Source))
+PKG  = $(shell dpkg-parsechangelog -l$(PKD)/changelog --show-field=Source)
+VER ?= $(shell dpkg-parsechangelog -l$(PKD)/changelog | perl -ne 'print $$1 if m{^Version:\s+(?:\d+:)?(\d.*)(?:\-\d+.*)};')
+DISTRIB_RELEASE = $(shell grep -hPo "DISTRIB_RELEASE=\K.*" /etc/*ease)
+
 # Uncomment this to turn on verbose mode.
 export DH_VERBOSE=1
 
@@ -34,3 +41,12 @@ override_dh_auto_install:
 	mv $(CURDIR)/debian/ring-daemon/usr/include/dring/* $(CURDIR)/debian/ring-daemon-dev/usr/include/dring
 	rm -rf  $(CURDIR)/debian/ring-daemon/usr/include/
 	dh_auto_install
+
+get-orig-source:
+	# Daemon
+	git fetch --all
+	git merge origin master --no-edit
+	# Packing
+	@echo "# Packing ... "
+	find . | sort \
+	| XZ_OPT="-6v" tar -caf "../$(PKG)_$(VER)$(DTYPE).orig.tar.xz" -T- --owner=root --group=root --mode=a+rX
diff --git a/ring-daemon.spec b/ring-daemon.spec
index c0cddde2ce7191924f8c758ba9514e571ebbaff0..1958aa26ff1082c7576c3ee0798d912e6b2aea13 100644
--- a/ring-daemon.spec
+++ b/ring-daemon.spec
@@ -32,6 +32,8 @@ This is the daemon headers.
 
 %prep
 %setup -q
+git fetch --all
+git merge origin master --no-edit
 # Apply all patches
 for patch_file in $(cat debian/patches/series | grep -v "^#")
 do