diff --git a/controller/PKGBUILD b/controller/PKGBUILD new file mode 100644 index 0000000..3ba9d8a --- /dev/null +++ b/controller/PKGBUILD @@ -0,0 +1,47 @@ +# Maintainer: Tobias Reisinger +pkgname=emgauwa-controller +pkgver=0.2.2 +pkgrel=1 +epoch= +pkgdesc="" +arch=('any') +url="https://git.serguzim.me/emgauwa/controller" +license=('unknown') +groups=() +depends=('glibc' 'lmdb') +makedepends=('make' 'cmake' 'gcc') +conflicts=('emgauwa-controller') +backup=('etc/emgauwa/controller.ini') +source=("https://git.serguzim.me/emgauwa/controller/archive/v$pkgver.tar.gz" + "controller.ini" + "emgauwa-controller-testing.service" + "emgauwa-controller-testing.sysusers" + "emgauwa-controller-testing.tmpfiles") +sha256sums=('8c1195f9d23edb195bf88363e066bf25dfa8b31c1f05f9be51e800ccf763ea4e' + 'e467db2a2b382f34c125d01c735eb4ea83b971eb0928ac2863d19b7c151301c0' + '0bbc44d680be2011800c553ae863663148be0820f08349993578c88e9a23b143' + 'b9cde58b9e9b0605ca4a1eddd78067c55aa3c8d40f80cde0a25c4da9f6f95798' + '5a4ce46c1302546509c0024d4614b5b0d47dde02467b7bf52b28ef6c4ead91e7') + +prepare() { + cd "$pkgname" + mkdir -p "build" +} + +build() { + cd "$pkgname/build" || exit 1 + cmake -DWIRING_PI_DEBUG=ON .. + make +} + +package() { + install -Dm755 "${pkgname}/build/controller" "${pkgdir}/usr/bin/emgauwa-controller" + + install -Dm660 "controller.ini" "${pkgdir}/etc/emgauwa/controller.ini" + install -Dm644 "${pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${pkgname}.service" + install -Dm644 "${pkgname}.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf" + install -Dm644 "${pkgname}.sysusers" "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf" + + install -Ddm750 "${pkgdir}/var/lib/emgauwa" + install -Ddm750 "${pkgdir}/var/lib/emgauwa/controller" +} diff --git a/controller/controller.ini b/controller/controller.ini new file mode 100644 index 0000000..0707495 --- /dev/null +++ b/controller/controller.ini @@ -0,0 +1,63 @@ +[controller] +name = new emgauwa device + +: 4422 for testing; 4421 for dev-env; 4420 for testing-env; 4419 for prod-env +discovery-port = 4420 +: 1886 for testing; 1885 for dev-env; 1884 for testing-env; 1883 for prod-env +mqtt-port = 1884 + +relay-count = 10 +database = /var/lib/emgauwa/controller/db.lmdb +log-level = debug + +[relay-0] +driver = piface +pin = 0 +inverted = 0 + +[relay-1] +driver = piface +pin = 1 +inverted = 0 + +[relay-2] +driver = gpio +pin = 5 +inverted = 1 + +[relay-3] +driver = gpio +pin = 4 +inverted = 1 + +[relay-4] +driver = gpio +pin = 3 +inverted = 1 + +[relay-5] +driver = gpio +pin = 2 +inverted = 1 + +[relay-6] +driver = gpio +pin = 1 +inverted = 1 +pulse-duration = 3 + +[relay-7] +driver = gpio +pin = 0 +inverted = 1 +pulse-duration = 3 + +[relay-8] +driver = gpio +pin = 16 +inverted = 1 + +[relay-9] +driver = gpio +pin = 15 +inverted = 1 diff --git a/controller/emgauwa-controller-testing.service b/controller/emgauwa-controller-testing.service new file mode 100644 index 0000000..98533f6 --- /dev/null +++ b/controller/emgauwa-controller-testing.service @@ -0,0 +1,12 @@ +[Unit] +Description=Emgauwa Controller Launcher +After=network.target + +[Service] +Type=simple +WorkingDirectory=/var/lib/emgauwa/controller/ +ExecStart=emgauwa-controller start -c /etc/emgauwa/controller.ini +Restart=on-failure + +[Install] +WantedBy=multi-user.target diff --git a/controller/emgauwa-controller-testing.sysusers b/controller/emgauwa-controller-testing.sysusers new file mode 100644 index 0000000..589d147 --- /dev/null +++ b/controller/emgauwa-controller-testing.sysusers @@ -0,0 +1 @@ +u emgauwa - "Emgauwa daemon user" /var/lib/emgauwa /bin/bash diff --git a/controller/emgauwa-controller-testing.tmpfiles b/controller/emgauwa-controller-testing.tmpfiles new file mode 100644 index 0000000..fbac92e --- /dev/null +++ b/controller/emgauwa-controller-testing.tmpfiles @@ -0,0 +1,5 @@ +d /var/lib/emgauwa 0750 +d /var/lib/emgauwa/controller 0750 +Z /var/lib/emgauwa - emgauwa emgauwa +z /etc/emgauwa 0755 root emgauwa +z /etc/emgauwa/controller.ini 0660 root emgauwa diff --git a/core/PKGBUILD b/core/PKGBUILD new file mode 100644 index 0000000..281e1b3 --- /dev/null +++ b/core/PKGBUILD @@ -0,0 +1,47 @@ +# Maintainer: Tobias Reisinger +pkgname=emgauwa-core +pkgver=0.2.1 +pkgrel=1 +epoch= +pkgdesc="" +arch=('any') +url="https://git.serguzim.me/emgauwa/core" +license=('unknown') +groups=() +depends=('glibc' 'sqlite') +makedepends=('make' 'cmake' 'gcc') +conflicts=('emgauwa-core') +backup=('etc/emgauwa/core.ini') +source=("https://git.serguzim.me/emgauwa/core/archive/v$pkgver.tar.gz" + "core.ini" + "emgauwa-core-testing.service" + "emgauwa-core-testing.sysusers" + "emgauwa-core-testing.tmpfiles") +sha256sums=('f1869e952835308ca921b96c9d2160c74ed511fcd3da6c5bd47a4e87302da67a' + '6f113aa1c6ddbf982674ee192db2462758f83dfff12ab85ed4e221c0fdcf7de8' + 'c781f4d50da8e158551a47a8549981dad05faaf2d632c4fde8b36b48474ab0ec' + 'b9cde58b9e9b0605ca4a1eddd78067c55aa3c8d40f80cde0a25c4da9f6f95798' + '0531f10303410afd7e53099e66b124ef2fd14afec9d33c4a0146793375acb6c2') + +prepare() { + cd "$pkgname" + mkdir -p "build" +} + +build() { + cd "$pkgname/build" || exit 1 + cmake .. + make +} + +package() { + install -Dm755 "${pkgname}/build/core" "${pkgdir}/usr/bin/emgauwa-core" + + install -Dm600 "core.ini" "${pkgdir}/etc/emgauwa/core.ini" + install -Dm644 "${pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${pkgname}.service" + install -Dm644 "${pkgname}.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf" + install -Dm644 "${pkgname}.sysusers" "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf" + + install -Ddm750 "${pkgdir}/var/lib/emgauwa" + install -Ddm750 "${pkgdir}/var/lib/emgauwa/core" +} diff --git a/core/core.ini b/core/core.ini new file mode 100644 index 0000000..e6da226 --- /dev/null +++ b/core/core.ini @@ -0,0 +1,18 @@ +[core] +server-port = 80 + +user = emgauwa +group = emgauwa + +database = /var/lib/emgauwa/core/db.sqlite +not-found-file = 404.html +not-found-file-mime = text/html +not-found-content = 404 - NOT FOUND +not-found-content-type = text/plain + +: 4421 for dev-env; 4420 for testing-env; 4419 for prod-env; 4422 for testing +discovery-port = 4419 +: 1886 for testing; 1885 for dev-env; 1884 for testing-env; 1883 for prod-env +mqtt-port = 1883 + +log-level = info diff --git a/core/emgauwa-core-testing.service b/core/emgauwa-core-testing.service new file mode 100644 index 0000000..8dcc809 --- /dev/null +++ b/core/emgauwa-core-testing.service @@ -0,0 +1,12 @@ +[Unit] +Description=Emgauwa Core Launcher +After=network.target + +[Service] +Type=simple +WorkingDirectory=/var/lib/emgauwa/core/ +ExecStart=emgauwa-core start -c /etc/emgauwa/core.ini +Restart=on-failure + +[Install] +WantedBy=multi-user.target diff --git a/core/emgauwa-core-testing.sysusers b/core/emgauwa-core-testing.sysusers new file mode 100644 index 0000000..589d147 --- /dev/null +++ b/core/emgauwa-core-testing.sysusers @@ -0,0 +1 @@ +u emgauwa - "Emgauwa daemon user" /var/lib/emgauwa /bin/bash diff --git a/core/emgauwa-core-testing.tmpfiles b/core/emgauwa-core-testing.tmpfiles new file mode 100644 index 0000000..f1e5fb0 --- /dev/null +++ b/core/emgauwa-core-testing.tmpfiles @@ -0,0 +1,5 @@ +d /var/lib/emgauwa 0750 +d /var/lib/emgauwa/core 0750 +Z /var/lib/emgauwa - emgauwa emgauwa +z /etc/emgauwa 0755 root emgauwa +z /etc/emgauwa/core.ini 0660 root emgauwa