Index: .gitmodules
===================================================================
--- .gitmodules	(revision 1d41a9f0f8d1fe0281700463dd1824eaa039eb88)
+++ .gitmodules	(revision 1d41a9f0f8d1fe0281700463dd1824eaa039eb88)
@@ -0,0 +1,4 @@
+[submodule "externals/epaper-driver/repaper"]
+	path = externals/epaper-driver/repaper
+	url = https://github.com/repaper/gratis.git
+	branch = master
Index: externals/epaper-driver/debian/changelog
===================================================================
--- externals/epaper-driver/debian/changelog	(revision 1d41a9f0f8d1fe0281700463dd1824eaa039eb88)
+++ externals/epaper-driver/debian/changelog	(revision 1d41a9f0f8d1fe0281700463dd1824eaa039eb88)
@@ -0,0 +1,5 @@
+epd-fuse-v231-g2 (0.1-0) unstable; urgency=low
+
+  * Initial release
+
+ -- EngSaS - Joachim Langenbach <info@engsas.de>  Wed, 13 Jul 2016 18:18:56 +0000
Index: externals/epaper-driver/debian/compat
===================================================================
--- externals/epaper-driver/debian/compat	(revision 1d41a9f0f8d1fe0281700463dd1824eaa039eb88)
+++ externals/epaper-driver/debian/compat	(revision 1d41a9f0f8d1fe0281700463dd1824eaa039eb88)
@@ -0,0 +1,1 @@
+9
Index: externals/epaper-driver/debian/control
===================================================================
--- externals/epaper-driver/debian/control	(revision 1d41a9f0f8d1fe0281700463dd1824eaa039eb88)
+++ externals/epaper-driver/debian/control	(revision 1d41a9f0f8d1fe0281700463dd1824eaa039eb88)
@@ -0,0 +1,15 @@
+Source: epd-fuse-v231-g2
+Section: unknown
+Priority: optional
+Maintainer: EngSaS - Joachim Langenbach <info@engsas.de>
+Build-Depends: debhelper (>= 9)
+Standards-Version: 3.9.5
+Homepage: https://github.com/repaper/gratis
+#Vcs-Git: git://anonscm.debian.org/collab-maint/epd-fuse.git
+#Vcs-Browser: http://anonscm.debian.org/?p=collab-maint/epd-fuse.git;a=summary
+
+Package: epd-fuse-v231-g2
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, libfuse-dev
+Description: EPD driver for repaper display
+ This is the EPD driver for the repaper display with PANEL_VERSION V231_G2
Index: externals/epaper-driver/debian/copyright
===================================================================
--- externals/epaper-driver/debian/copyright	(revision 1d41a9f0f8d1fe0281700463dd1824eaa039eb88)
+++ externals/epaper-driver/debian/copyright	(revision 1d41a9f0f8d1fe0281700463dd1824eaa039eb88)
@@ -0,0 +1,38 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: epd-fuse
+Source: <url://example.com>
+
+Files: *
+Copyright: <years> <put author's name and email here>
+           <years> <likewise for another author>
+License: <special license>
+ <Put the license of the package here indented by 1 space>
+ <This follows the format of Description: lines in control file>
+ .
+ <Including paragraphs>
+
+# If you want to use GPL v2 or later for the /debian/* files use 
+# the following clauses, or change it to suit. Delete these two lines
+Files: debian/*
+Copyright: 2016 EngSaS - Joachim Langenbach <info@engsas.de>
+License: GPL-2+
+ This package is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+ .
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>
+ .
+ On Debian systems, the complete text of the GNU General
+ Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
+
+# Please also look if there are files or directories which have a
+# different copyright/license attached and list them here.
+# Please avoid to pick license terms that are more restrictive than the
+# packaged work, as it may make Debian's contributions unacceptable upstream.
Index: externals/epaper-driver/debian/patches/fix-make-destdir.diff
===================================================================
--- externals/epaper-driver/debian/patches/fix-make-destdir.diff	(revision 1d41a9f0f8d1fe0281700463dd1824eaa039eb88)
+++ externals/epaper-driver/debian/patches/fix-make-destdir.diff	(revision 1d41a9f0f8d1fe0281700463dd1824eaa039eb88)
@@ -0,0 +1,113 @@
+Index: epd-fuse-v231-g2-0.1/Makefile
+===================================================================
+--- epd-fuse-v231-g2-0.1.orig/Makefile
++++ epd-fuse-v231-g2-0.1/Makefile
+@@ -1,5 +1,7 @@
+ # Makefile
+ 
++DESTDIR=/usr/local
++
+ PANEL_VERSION ?= NOT-SET
+ EPD_IO ?= epd_io.h
+ 
+@@ -22,12 +24,12 @@ help:
+ 	@echo
+ 	@echo Raspberry Pi:
+ 	@echo '   $(MAKE) rpi            = build all targets'
+-	@echo '   $(MAKE) rpi-install    = install fuse driver in PREFIX'
++	@echo '   $(MAKE) rpi-install    = install fuse driver in DESTDIR'
+ 	@echo '   $(MAKE) rpi-T          = build only target T'
+ 	@echo
+ 	@echo BeagleBone
+ 	@echo '   $(MAKE) bb             = build all targets'
+-	@echo '   $(MAKE) bb-install     = install fuse driver in PREFIX'
++	@echo '   $(MAKE) bb-install     = install fuse driver in DESTDIR'
+ 	@echo '   $(MAKE) bb-T           = build only target T'
+ 	@echo
+ 	@echo Where T is one of:
+@@ -35,7 +37,7 @@ help:
+ 	@echo '    epd_test gpio_test epd_fuse'
+ 	@echo
+ 	@echo Notes:
+-	@echo 1. the default install PREFIX=/usr
++	@echo 1. the default install DESTDIR=/usr/local
+ 	@echo 2. if not root must use sudo when installing
+ 	@echo
+ 
+@@ -74,10 +76,10 @@ version-check:
+ 
+ .PHONY: rpi raspberrypi
+ rpi raspberrypi: version-check
+-	$(MAKE) PLATFORM=../RaspberryPi PANEL_VERSION="${PANEL_VERSION}" EPD_IO="${EPD_IO}" -C driver-common
++	$(MAKE) DESTDIR="../${DESTDIR}" PLATFORM=../RaspberryPi PANEL_VERSION="${PANEL_VERSION}" EPD_IO="${EPD_IO}" -C driver-common
+ 
+ rpi-%: version-check
+-	$(MAKE) PLATFORM=../RaspberryPi PANEL_VERSION="${PANEL_VERSION}" EPD_IO="${EPD_IO}" -C driver-common $*
++	$(MAKE) DESTDIR="../${DESTDIR}" PLATFORM=../RaspberryPi PANEL_VERSION="${PANEL_VERSION}" EPD_IO="${EPD_IO}" -C driver-common $*
+ 
+ 
+ # BeagleBone Black targets
+Index: epd-fuse-v231-g2-0.1/driver-common/Makefile
+===================================================================
+--- epd-fuse-v231-g2-0.1.orig/driver-common/Makefile
++++ epd-fuse-v231-g2-0.1/driver-common/Makefile
+@@ -1,6 +1,10 @@
+ # Makefile
+ 
+-PREFIX ?= /usr
++DIR_SBIN=${DESTDIR}/sbin
++DIR_ETC_DEFAULT=${DESTDIR}/etc/default
++DIR_SYSTEMD=${DESTDIR}/lib/systemd/system
++DIR_ETC_INIT=${DESTDIR}/etc/init
++DIR_ETC_INITD=${DESTDIR}/etc/init.d
+ 
+ PLATFORM ?= ../RasberryPi
+ PANEL_VERSION ?= v231_g2
+@@ -50,33 +54,37 @@ check-compiled:
+ # install binary driver ans associated config/startup or service files
+ .PHONY: install
+ install: check-compiled
+-	install --group=root --mode=750 --owner=root epd_fuse "${PREFIX}/sbin"
+-	[ -e /etc/default/epd-fuse ] || install --group=root --mode=644 --owner=root epd-fuse.default /etc/default/epd-fuse
++	test ! -d ${DIR_SBIN} && mkdir -p ${DIR_SBIN}
++	install --group=root --mode=750 --owner=root epd_fuse "${DIR_SBIN}"
++	if [ -e ${DIR_ETC_DEFAULT}/epd-fuse ] ; then \
++		test ! -d ${DIR_ETC_DEFAULT} && mkdir -p ${DIR_ETC_DEFAULT} ; \
++		install --group=root --mode=644 --owner=root epd-fuse.default ${DIR_ETC_DEFAULT}/epd-fuse ; \
++	fi
+ ifeq (YES,${IS_ARCH})
+-	install --group=root --mode=644 --owner=root epd-fuse.service "${PREFIX}/lib/systemd/system/epd-fuse.service"
+-	-systemctl daemon-reload
+-	-systemctl enable epd-fuse
++	test ! -d ${DIR_SYSTEMD} && mkdir -p ${DIR_SYSTEMD}
++	install --group=root --mode=644 --owner=root epd-fuse.service "${DIR_SYSTEMD}/epd-fuse.service"
+ else # otherwise Debian
+ 	if [ -e "${EPD_FUSE_CONF}" ] ; \
+ 	then \
+-	  install --group=root --mode=644 --owner=root "${EPD_FUSE_CONF}" /etc/init ; \
++	  test ! -d ${DIR_ETC_INIT} && mkdir -p ${DIR_ETC_INIT} ; \
++	  install --group=root --mode=644 --owner=root "${EPD_FUSE_CONF}" ${DIR_ETC_INIT} ; \
+ 	fi
+ 	if [ -e "${EPD_FUSE_SH}" ] ; \
+ 	then \
+-	  install --group=root --mode=755 --owner=root "${EPD_FUSE_SH}" /etc/init.d/epd-fuse ; \
+-	  update-rc.d epd-fuse defaults ; \
++	  test ! -d ${DIR_ETC_INITD} && mkdir -p ${DIR_ETC_INITD} ; \
++	  install --group=root --mode=755 --owner=root "${EPD_FUSE_SH}" ${DIR_ETC_INITD}/epd-fuse ; \
+ 	fi
+ endif
+ 
+ .PHONY: remove
+ remove:
+ 	[ -x /etc/init.d/epd-fuse ] && /etc/init.d/epd-fuse stop
+-	rm -f "${PREFIX}/sbin/epd_fuse"
++	rm -f "${DESTDIR}/sbin/epd_fuse"
+ ifeq (YES,${IS_ARCH})
+ 	-systemctl stop epd-fuse
+ 	-systemctl disable epd-fuse
+ 	-systemctl daemon-reload
+-	rm -f "${PREFIX}/lib/systemd/system/epd-fuse.service"
++	rm -f "${DESTDIR}/lib/systemd/system/epd-fuse.service"
+ else # otherwise Debian
+ 	rm -f /etc/init/epd-fuse.conf
+ 	rm -f /etc/init.d/epd-fuse
Index: externals/epaper-driver/debian/patches/series
===================================================================
--- externals/epaper-driver/debian/patches/series	(revision 1d41a9f0f8d1fe0281700463dd1824eaa039eb88)
+++ externals/epaper-driver/debian/patches/series	(revision 1d41a9f0f8d1fe0281700463dd1824eaa039eb88)
@@ -0,0 +1,1 @@
+fix-make-destdir.diff
Index: externals/epaper-driver/debian/rules
===================================================================
--- externals/epaper-driver/debian/rules	(revision 1d41a9f0f8d1fe0281700463dd1824eaa039eb88)
+++ externals/epaper-driver/debian/rules	(revision 1d41a9f0f8d1fe0281700463dd1824eaa039eb88)
@@ -0,0 +1,12 @@
+#!/usr/bin/make -f
+
+#export DH_VERBOSE=1
+
+%:
+	dh $@ 
+
+override_dh_auto_build:
+	$(MAKE) PANEL_VERSION='V231_G2' rpi-epd_fuse
+
+override_dh_auto_install:
+	$(MAKE) PANEL_VERSION='V231_G2' PREFIX=../debian/BUILD rpi-install
Index: externals/epaper-driver/debian/source/format
===================================================================
--- externals/epaper-driver/debian/source/format	(revision 1d41a9f0f8d1fe0281700463dd1824eaa039eb88)
+++ externals/epaper-driver/debian/source/format	(revision 1d41a9f0f8d1fe0281700463dd1824eaa039eb88)
@@ -0,0 +1,1 @@
+3.0 (quilt)
Index: externals/epaper-driver/epaper-package
===================================================================
--- externals/epaper-driver/epaper-package	(revision 1d41a9f0f8d1fe0281700463dd1824eaa039eb88)
+++ externals/epaper-driver/epaper-package	(revision 1d41a9f0f8d1fe0281700463dd1824eaa039eb88)
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+BUILD_DIR=/tmp/epd
+VERSION="0.1"
+
+
+NAME="epd-fuse-v231-g2"
+PACKAGE_NAME="${NAME}-${VERSION}"
+ORIG_TARBALL="${NAME}_${VERSION}.orig.tar.gz"
+SCRIPT_ROOT=$(dirname `dirname $0`)
+
+set -e
+
+if [ -d "${BUILD_DIR}" ]; then
+	rm -R "${BUILD_DIR}"
+fi
+
+echo "Preparebuild environment"
+mkdir "${BUILD_DIR}"
+cp -a "${SCRIPT_ROOT}/repaper/PlatformWithOS" "${BUILD_DIR}/${PACKAGE_NAME}"
+echo "  Create source tarball"
+tar -czf "${BUILD_DIR}/${ORIG_TARBALL}" -C "${BUILD_DIR}" "${PACKAGE_NAME}"
+echo "  Copy debian folder into sources"
+cp -a "${SCRIPT_ROOT}/debian" "${BUILD_DIR}/${PACKAGE_NAME}/"
+mkdir "${BUILD_DIR}/${PACKAGE_NAME}/debian/BUILD"
+mkdir "${BUILD_DIR}/${PACKAGE_NAME}/debian/BUILD/sbin"
+
+
+echo "Building the package"
+cd "${BUILD_DIR}/${PACKAGE_NAME}"
+dpkg-buildpackage
+
+exit 0
