overcomplicate it

This commit is contained in:
Neil Hanlon 2024-03-28 21:54:08 -04:00 committed by Neil Hanlon
parent e2db47ec4b
commit 5f9946d79d
Signed by: neil
GPG Key ID: 705BC21EC3C70F34
3 changed files with 46 additions and 2 deletions

13
lexiserver.service Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=Lexiserver
After=network.target
[Service]
ExecStart=/usr/bin/lexiserver
WorkingDirectory=/opt/lexiserver
Restart=always
User=lexiserver
Group=lexiserver
[Install]
WantedBy=multi-user.target

View File

@ -1,3 +1,7 @@
%global commit 8acdf9773c022b84b02bfee9f70c486b5572411d
%global gittag GIT-TAG
%global shortcommit %(c=%{commit}; echo ${c:0:7})
Name: lexiserver Name: lexiserver
Version: 1.1.0 Version: 1.1.0
Release: 1%{dist} Release: 1%{dist}
@ -6,24 +10,43 @@ Summary: A webserver written in C that tries to keep it simple
License: GPL-3.0-only License: GPL-3.0-only
URL: https://github.com/alexiarstein/simple-webserver URL: https://github.com/alexiarstein/simple-webserver
Source: lexiserver-%{version}.tar.gz Source: https://github.com/alexiarstein/simple-webserver/archive/%{commit}/%{name}-%{shortcommit}.tar.gz
Source: lexiserver.service
Source: lexiserver.sysusers
BuildRequires: annobin-plugin-gcc BuildRequires: annobin-plugin-gcc
BuildRequires: cmake BuildRequires: cmake
BuildRequires: gcc BuildRequires: gcc
BuildRequires: file BuildRequires: file
BuildRequires: openssl-devel BuildRequires: openssl-devel
BuildRequires: systemd-rpm-macros
%description %description
LexiServer is a webserver written in C that tries to keep it simple. It supports TLS and executing CGI scripts. LexiServer is a webserver written in C that tries to keep it simple. It supports TLS and executing CGI scripts.
%pre
%sysusers_create_compat %{SOURCE2}
%post
%systemd_post lexiserver.service
%preun
%systemd_preun lexiserver.service
%postun
%systemd_postun lexiserver.service
%package devel %package devel
Summary: Development files for lexiserver Summary: Development files for lexiserver
%description devel %description devel
The development files for compiling against lexiserver The development files for compiling against lexiserver
%prep %prep
%autosetup %autosetup -n simple-webserver-%{commit}
#remove precompiled binaries
rm lexiserver-arm64{,-ssl}
%build %build
%cmake %cmake
@ -32,6 +55,9 @@ The development files for compiling against lexiserver
%install %install
%cmake_install %cmake_install
install -p -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/lexiserver.service
install -p -D -m 0644 %{SOURCE2} %{buildroot}%{_sysusersdir}/lexiserver.conf
pushd redhat-linux-build pushd redhat-linux-build
install -p -D -m 0755 lexiserver %{buildroot}%{_bindir}/lexiserver install -p -D -m 0755 lexiserver %{buildroot}%{_bindir}/lexiserver
popd popd
@ -56,6 +82,8 @@ popd
/opt/lexiserver/404.html /opt/lexiserver/404.html
%config(noreplace) /opt/lexiserver/lexiserver.conf %config(noreplace) /opt/lexiserver/lexiserver.conf
%{_bindir}/lexiserver %{_bindir}/lexiserver
%{_sysusersdir}/lexiserver.conf
%{_unitdir}/lexiserver.service
%files devel %files devel
%{_includedir}/lexiserver*.c %{_includedir}/lexiserver*.c

3
lexiserver.sysusers Normal file
View File

@ -0,0 +1,3 @@
g lexiserver 96
u lexiserver 96 "LexiServer" /opt/lexiserver /sbin/nologin