From dde1a6a61ce33532568a9a107820a7db06940c0e Mon Sep 17 00:00:00 2001 From: NoName Date: Sun, 8 Mar 2015 14:47:59 +0100 Subject: [PATCH 1/6] Initial commit for Arch Linux PKGBUILD for ebusd --- contrib/archlinux/ebusd/PKGBUILD | 38 +++++++++++++++++++++++++++ contrib/archlinux/ebusd/ebusd.install | 24 +++++++++++++++++ contrib/archlinux/ebusd/ebusd.service | 15 +++++++++++ contrib/archlinux/ebusd/ebusd_conf.d | 5 ++++ 4 files changed, 82 insertions(+) create mode 100644 contrib/archlinux/ebusd/PKGBUILD create mode 100644 contrib/archlinux/ebusd/ebusd.install create mode 100644 contrib/archlinux/ebusd/ebusd.service create mode 100644 contrib/archlinux/ebusd/ebusd_conf.d diff --git a/contrib/archlinux/ebusd/PKGBUILD b/contrib/archlinux/ebusd/PKGBUILD new file mode 100644 index 00000000..71bf1b5e --- /dev/null +++ b/contrib/archlinux/ebusd/PKGBUILD @@ -0,0 +1,38 @@ +# Maintainer: Milan Knizek +# Contributor: Milan Knizek + +pkgname=ebusd +#_gitname=ebusd +pkgver=1.0.0 +_pkgver=1.0.0 +pkgrel=1 +pkgdesc="ebusd provides a communication interface to the energy bus (ebus)." +arch=('i686' 'x86_64' 'armv6h') +url=https://github.com/yuhu-/ebusd/ +license=('GPL3') +depends=() +optdepends=() +conflicts=('ebusd-git') +provides=('ebusd') +install=ebusd.install +options=() +backup=('etc/conf.d/ebusd') +source=("https://github.com/john30/ebusd/archive/v${_pkgver}.tar.gz" 'ebusd.service' 'ebusd') + +build() { + cd "${srcdir}"/${pkgname}-${_pkgver} + ./autogen.sh --prefix=/usr --sysconfdir=/etc + # This is corrected in master + sed -i 's@\(\[ -d \)\(\$(sysconfdir)/ebusd \] || mkdir -p \)\(\$(sysconfdir)/ebusd\)@\1\$(DESTDIR)\2\$(DESTDIR)\3@' src/ebusd/Makefile.am + make -j1 +} + +package() { + cd "${srcdir}"/${pkgname}-${_pkgver} + make DESTDIR="$pkgdir" install + + install -d "${pkgdir}"/usr/lib/systemd/system + install -m 0644 ../ebusd.service "${pkgdir}"/usr/lib/systemd/system + install -d "${pkgdir}"/etc/conf.d + install -m 0644 ../ebusd_conf.d "${pkgdir}"/etc/conf.d/ebusd +} diff --git a/contrib/archlinux/ebusd/ebusd.install b/contrib/archlinux/ebusd/ebusd.install new file mode 100644 index 00000000..9f0dd587 --- /dev/null +++ b/contrib/archlinux/ebusd/ebusd.install @@ -0,0 +1,24 @@ +pkgname=ebusd + +post_install() { + echo ">>> Put daemon options to /etc/conf.d/ebusd (especially /dev/tty????)" + echo " Copy your configuration files (csv) to /etc/ebusd" + echo " Start the daemon 'systemctl start ebusd'" +} + +pre_upgrade() { + true +} + +post_upgrade() { + true +} + +pre_remove() { + true +} + +post_remove() { + true +} + diff --git a/contrib/archlinux/ebusd/ebusd.service b/contrib/archlinux/ebusd/ebusd.service new file mode 100644 index 00000000..b3a0c685 --- /dev/null +++ b/contrib/archlinux/ebusd/ebusd.service @@ -0,0 +1,15 @@ +[Unit] +Description=Communication interface to the energy bus (ebus) +After=local-fs.target +ConditionPathExists=/var/log + +[Service] +Type=forking +EnvironmentFile=-/etc/conf.d/ebusd +ExecStart=/usr/bin/ebusd $EBUSD_ARGS +Restart=always +PIDFile=/run/ebusd.pid + +[Install] +WantedBy=multi-user.target + diff --git a/contrib/archlinux/ebusd/ebusd_conf.d b/contrib/archlinux/ebusd/ebusd_conf.d new file mode 100644 index 00000000..8ffae1a0 --- /dev/null +++ b/contrib/archlinux/ebusd/ebusd_conf.d @@ -0,0 +1,5 @@ +# /etc/conf.d/ebusd: config file for ebusd.service +# Options to pass to the ebusd. +# See the ebusd -h for more info. + +EBUSD_ARGS="" From ce3bfa85d0433dffe8f7b4b27cd18be1fb81121a Mon Sep 17 00:00:00 2001 From: NoName Date: Sun, 8 Mar 2015 14:48:54 +0100 Subject: [PATCH 2/6] Initial commit for Arch Linux PKGBUILD of ebusd-git --- contrib/archlinux/ebusd-git/PKGBUILD | 53 +++++++++++++++++++++++ contrib/archlinux/ebusd-git/ebusd.install | 24 ++++++++++ contrib/archlinux/ebusd-git/ebusd.service | 15 +++++++ contrib/archlinux/ebusd-git/ebusd_conf.d | 5 +++ 4 files changed, 97 insertions(+) create mode 100644 contrib/archlinux/ebusd-git/PKGBUILD create mode 100644 contrib/archlinux/ebusd-git/ebusd.install create mode 100644 contrib/archlinux/ebusd-git/ebusd.service create mode 100644 contrib/archlinux/ebusd-git/ebusd_conf.d diff --git a/contrib/archlinux/ebusd-git/PKGBUILD b/contrib/archlinux/ebusd-git/PKGBUILD new file mode 100644 index 00000000..8f2ce55a --- /dev/null +++ b/contrib/archlinux/ebusd-git/PKGBUILD @@ -0,0 +1,53 @@ +# Maintainer: Milan Knizek +# Contributor: Milan Knizek + +pkgname=ebusd-git +_gitname=ebusd +pkgver=2faab3f +_pkgver=1.0.0 +pkgrel=1 +pkgdesc="ebusd provides a communication interface to the energy bus (ebus)." +arch=('i686' 'x86_64' 'armv6h') +url=https://github.com/john30/ebusd/ +license=('GPL3') +depends=() +makedepends=('git') +optdepends=() +conflicts=('ebusd') +provides=('ebusd') +install=ebusd.install +options=() +backup=('etc/conf.d/ebusd') +source=('git://github.com/john30/ebusd.git' 'ebusd.service' 'ebusd_conf.d') + +# This is for -git only +pkgver() { + cd $_gitname + git describe --always | sed 's|-|.|g' +} + +build() { + local _gitdir=$srcdir/$_gitname + cd "$_gitdir" + + git clean -dfx + git reset --hard +# git apply -v --ignore-space-change --ignore-whitespace ../some.patch + + ./autogen.sh --prefix=/usr --sysconfdir=/etc + make -j1 +} + +package() { + cd "$srcdir/$_gitname" + make DESTDIR="$pkgdir" install + + install -d "${pkgdir}"/usr/lib/systemd/system + install -m 0644 ../ebusd.service "${pkgdir}"/usr/lib/systemd/system + install -d "${pkgdir}"/etc/conf.d + install -m 0644 ../ebusd_conf.d "${pkgdir}"/etc/conf.d/ebusd +} + +md5sums=('SKIP' + '15b2fdb0a219fae6feecd539e8823864' + 'a2b4d5557fd90ea30e04358da62597fb') diff --git a/contrib/archlinux/ebusd-git/ebusd.install b/contrib/archlinux/ebusd-git/ebusd.install new file mode 100644 index 00000000..9f0dd587 --- /dev/null +++ b/contrib/archlinux/ebusd-git/ebusd.install @@ -0,0 +1,24 @@ +pkgname=ebusd + +post_install() { + echo ">>> Put daemon options to /etc/conf.d/ebusd (especially /dev/tty????)" + echo " Copy your configuration files (csv) to /etc/ebusd" + echo " Start the daemon 'systemctl start ebusd'" +} + +pre_upgrade() { + true +} + +post_upgrade() { + true +} + +pre_remove() { + true +} + +post_remove() { + true +} + diff --git a/contrib/archlinux/ebusd-git/ebusd.service b/contrib/archlinux/ebusd-git/ebusd.service new file mode 100644 index 00000000..b3a0c685 --- /dev/null +++ b/contrib/archlinux/ebusd-git/ebusd.service @@ -0,0 +1,15 @@ +[Unit] +Description=Communication interface to the energy bus (ebus) +After=local-fs.target +ConditionPathExists=/var/log + +[Service] +Type=forking +EnvironmentFile=-/etc/conf.d/ebusd +ExecStart=/usr/bin/ebusd $EBUSD_ARGS +Restart=always +PIDFile=/run/ebusd.pid + +[Install] +WantedBy=multi-user.target + diff --git a/contrib/archlinux/ebusd-git/ebusd_conf.d b/contrib/archlinux/ebusd-git/ebusd_conf.d new file mode 100644 index 00000000..8ffae1a0 --- /dev/null +++ b/contrib/archlinux/ebusd-git/ebusd_conf.d @@ -0,0 +1,5 @@ +# /etc/conf.d/ebusd: config file for ebusd.service +# Options to pass to the ebusd. +# See the ebusd -h for more info. + +EBUSD_ARGS="" From 190f5d52c1464f283857d367d7d4da4511e21e38 Mon Sep 17 00:00:00 2001 From: NoName Date: Sun, 8 Mar 2015 17:10:15 +0100 Subject: [PATCH 3/6] Updated project URL in Arch Linux PKGBUILD --- contrib/archlinux/ebusd/PKGBUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/archlinux/ebusd/PKGBUILD b/contrib/archlinux/ebusd/PKGBUILD index 71bf1b5e..b65a39ec 100644 --- a/contrib/archlinux/ebusd/PKGBUILD +++ b/contrib/archlinux/ebusd/PKGBUILD @@ -8,7 +8,7 @@ _pkgver=1.0.0 pkgrel=1 pkgdesc="ebusd provides a communication interface to the energy bus (ebus)." arch=('i686' 'x86_64' 'armv6h') -url=https://github.com/yuhu-/ebusd/ +url=https://github.com/john30/ebusd/ license=('GPL3') depends=() optdepends=() From 0d44c9bacdfd637eae15bdc45ab625eecab26986 Mon Sep 17 00:00:00 2001 From: john30 Date: Wed, 11 Mar 2015 08:42:28 +0100 Subject: [PATCH 4/6] more bounds checks --- src/lib/ebus/data.cpp | 4 ++-- src/lib/ebus/data.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/ebus/data.cpp b/src/lib/ebus/data.cpp index c7113d25..488d6937 100644 --- a/src/lib/ebus/data.cpp +++ b/src/lib/ebus/data.cpp @@ -705,7 +705,7 @@ result_t StringDataField::writeSymbols(istringstream& input, if ((m_dataType.flags & BCD) != 0) output[baseOffset + offset - incr] = (unsigned char)((6+daysSinceSunday) % 7); // Sun=0x06 else - output[baseOffset + offset - incr] = (daysSinceSunday==0 ? 7 : daysSinceSunday); // Sun=0x07 + output[baseOffset + offset - incr] = (unsigned char)(daysSinceSunday==0 ? 7 : daysSinceSunday); // Sun=0x07 } if (value >= 2000) value -= 2000; @@ -891,7 +891,7 @@ NumberDataField::NumberDataField(const string name, const string comment, const unsigned char length, const unsigned char bitCount, const int divisor) : NumericDataField(name, comment, unit, dataType, partType, length, bitCount, - (dataType.bitCount % 8) == 0 ? 0 : (unsigned char)dataType.divisorOrFirstBit), + (unsigned char)((dataType.bitCount % 8) == 0 ? 0 : dataType.divisorOrFirstBit)), m_divisor(divisor), m_precision(0) { if (divisor > 1) diff --git a/src/lib/ebus/data.h b/src/lib/ebus/data.h index 948142e2..2f3320fa 100644 --- a/src/lib/ebus/data.h +++ b/src/lib/ebus/data.h @@ -305,7 +305,7 @@ public: PartType getPartType() const { return m_partType; } // @copydoc - virtual unsigned char getLength(PartType partType) { return partType == m_partType ? m_length : 0; }; + virtual unsigned char getLength(PartType partType) { return partType == m_partType ? m_length : (unsigned char)0; }; // re-use same position as previous field as not all bits of fully consumed yet /** @@ -557,7 +557,7 @@ public: const unsigned char length, const unsigned char bitCount, const map values) : NumericDataField(name, comment, unit, dataType, partType, length, bitCount, - (dataType.bitCount < 8) ? (unsigned char)dataType.divisorOrFirstBit : 0), + (unsigned char)((dataType.bitCount < 8) ? dataType.divisorOrFirstBit : 0)), m_values(values) {} /** From 74a2216966406462c97b7b54cf46794b4fb1ff43 Mon Sep 17 00:00:00 2001 From: john30 Date: Wed, 11 Mar 2015 08:43:30 +0100 Subject: [PATCH 5/6] autoconf 2.63 is fine --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index dae81d8e..da8fa335 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_PREREQ([2.65]) +AC_PREREQ([2.63]) AC_INIT([ebusd], [1.0.0], [ebusd@johnm.de], [ebusd], [https://github.com/john30/ebusd]) AC_CONFIG_AUX_DIR([build]) From 2655e570b30f6624a1545103cfa3fb847a40de65 Mon Sep 17 00:00:00 2001 From: john30 Date: Wed, 11 Mar 2015 08:54:52 +0100 Subject: [PATCH 6/6] added automake dependency --- README | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README b/README index 13bb5d43..1e1879b9 100644 --- a/README +++ b/README @@ -25,7 +25,8 @@ Installation ------------ Building ebusd from the source requires the following packages: - * autoconf (>=2.65) + * autoconf (>=2.63) + * automake (>=1.11) * g++ * make