complete setup as systemd service [release 2020.2-2mamba;Wed Sep 30 2020]

This commit is contained in:
Silvan Calarco 2024-01-05 21:54:31 +01:00
parent ddceb74199
commit 3459680e40
6 changed files with 145 additions and 0 deletions

View File

@ -1,2 +1,4 @@
# domoticz
Domoticz is a Home Automation System that lets you monitor and configure various devices like: Lights, Switches, various sensors/meters like Temperature, Rain, Wind, UV, Electra, Gas, Water and much more. Notifications/Alerts can be sent to any mobile device.

11
domoticz.conf Normal file
View File

@ -0,0 +1,11 @@
WWW_PORT=8080
SSL_PORT=8443
SSLCERT="/var/lib/domoticz/domoticz.pem"
SSLPASS=""
SSLMETHOD=""
SSLOPTIONS=""
SSLDHPARAM=""
APP_ROOT="/usr/share/domoticz"
DBASE="/var/lib/domoticz/domoticz.db"
USERDATA="/var/lib/domoticz/"
LOGLEVEL="1"

14
domoticz.service Normal file
View File

@ -0,0 +1,14 @@
[Unit]
Description=Domoticz daemon
After=network.target
[Service]
User=domoticz
Group=domoticz
EnvironmentFile=/etc/sysconfig/domoticz
ExecStart=/usr/share/domoticz/domoticz -www $WWW_PORT -sslwww $SSL_PORT -sslcert $SSLCERT -sslpass $SSLPASS -sslmethod $SSLMETHOD -ssloptions $SSLOPTIONS -ssldhparam $SSLDHPARAM -approot $APP_ROOT -dbase $DBASE -userdata $USERDATA -loglevel $LOGLEVEL -pidfile /run/domoticz/domoticz.pid
PIDFile=/run/domoticz/domoticz.pid
WorkingDirectory=/usr/share/domoticz
[Install]
WantedBy=multi-user.target

113
domoticz.spec Normal file
View File

@ -0,0 +1,113 @@
Name: domoticz
Version: 2020.2
Release: 2mamba
Summary: A Home Automation System that lets you monitor and configure various devices
Group: System/Kernel and Hardware
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://www.domoticz.com/
Source: https://github.com/domoticz/domoticz.git/%{version}/domoticz-%{version}.tar.bz2
Source1: domoticz.service
Source2: domoticz.tmpfiles
Source3: domoticz.sysusers
Source4: domoticz.conf
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: ldconfig
BuildRequires: libcurl-devel
BuildRequires: libjsoncpp-devel
BuildRequires: liblua-devel
BuildRequires: libminizip-devel
BuildRequires: libmosquitto-devel
BuildRequires: libopenssl-devel
BuildRequires: libsqlite-devel
BuildRequires: libusb-compat-devel
BuildRequires: libz-devel
## AUTOBUILDREQ-END
BuildRequires: libcereal-devel
BuildRequires: cmake
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
Domoticz is a Home Automation System that lets you monitor and configure various devices like: Lights, Switches, various sensors/meters like Temperature, Rain, Wind, UV, Electra, Gas, Water and much more. Notifications/Alerts can be sent to any mobile device.
%debug_package
%prep
%setup -q
%build
%cmake -d build \
-DCMAKE_INSTALL_PREFIX=%{_datadir}/domoticz \
-DUSE_BUILTIN_SQLITE=NO \
-DUSE_BUILTIN_MQTT=NO \
-DUSE_BUILTIN_JSONCPP=NO \
-DUSE_BUILTIN_MINIZIP=NO \
-DGIT_SUBMODULE=OFF
%make
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%makeinstall -C build
install -D -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/domoticz.service
install -D -m0644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/domoticz.conf
install -D -m0644 %{SOURCE3} %{buildroot}%{_sysusersdir}/domoticz.conf
install -D -m0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/sysconfig/domoticz
install -d -m0755 %{buildroot}/var/lib/domoticz
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%pre
%sysusers_create_package domoticz %{SOURCE3}
%tmpfiles_create_package domoticz %{SOURCE2}
:
%post
%systemd_post domoticz
:
%preun
%systemd_preun domoticz
:
%postun
%systemd_postun_with_restart domoticz
:
%files
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/sysconfig/domoticz
%{_unitdir}/domoticz.service
%{_sysusersdir}/domoticz.conf
%{_tmpfilesdir}/domoticz.conf
%dir %{_datadir}/domoticz
%{_datadir}/domoticz/History.txt
%{_datadir}/domoticz/License.txt
%{_datadir}/domoticz/domoticz
%{_datadir}/domoticz/server_cert.pem
%{_datadir}/domoticz/updatedomo
%dir %{_datadir}/domoticz/Config
%{_datadir}/domoticz/Config/*
%dir %{_datadir}/domoticz/dzVents
%{_datadir}/domoticz/dzVents/*
%{_datadir}/domoticz/dzVents/.gitignore
%dir %{_datadir}/domoticz/plugins
%{_datadir}/domoticz/plugins/*
%dir %{_datadir}/domoticz/scripts
%{_datadir}/domoticz/scripts/*
%dir %{_datadir}/domoticz/www
%{_datadir}/domoticz/www/*
%attr(0750,domoticz,domoticz) /var/lib/domoticz
%doc License.txt
%changelog
* Wed Sep 30 2020 Silvan Calarco <silvan.calarco@mambasoft.it> 2020.2-2mamba
- complete setup as systemd service
* Tue Sep 29 2020 Silvan Calarco <silvan.calarco@mambasoft.it> 2020.2-1mamba
- package created using the webbuild interface

4
domoticz.sysusers Normal file
View File

@ -0,0 +1,4 @@
#Type Name ID GECOS Home directory Shell
g domoticz -
u domoticz - "Domoticz daemon user"
m domoticz domoticz

1
domoticz.tmpfiles Normal file
View File

@ -0,0 +1 @@
d /run/domoticz 755 domoticz domoticz