%global debug_package %{nil} %global repo_root %{_topdir}/.. Summary: A support ticket Discord bot Name: supportchild Version: %(sed -ne '/Version/{s/.*<Version>\(.*\)<\/Version>.*/\1/p;q;}' < SupportChild.csproj) Release: 1%{?dist} License: GPLv3 URL: https://toastielab.dev/toastie-stuff/SupportChild Source: https://toastielab.dev/toastie-stuff/SupportChild/archive/main.zip Packager: Toastie_t0ast BuildRequires: systemd-rpm-macros Requires: dotnet-runtime-9.0 %{?systemd_requires} %description A support ticket Discord bot. Uses a MySQL database for storage of ticket information. Creates formatted HTML ticket transcripts when tickets are closed. %prep %setup -T -c %build dotnet publish %{repo_root}/SupportChild.csproj -p:PublishSingleFile=true -r linux-x64 -c Release --self-contained false --output %{_builddir}/out %install %{__install} -d %{buildroot}/usr/bin %{__install} %{_builddir}/out/supportchild %{buildroot}/usr/bin/supportchild # rpmbuild post-processing using the strip command breaks dotnet binaries, remove the executable bit to avoid it chmod 644 %{buildroot}/usr/bin/supportchild %{__install} -d %{buildroot}/usr/lib/systemd/system %{__install} %{repo_root}/packaging/supportchild.service %{buildroot}/usr/lib/systemd/system/ %{__install} -d %{buildroot}/etc/supportchild/ %{__install} %{repo_root}/default_config.yml %{buildroot}/etc/supportchild/config.yml %pre getent group supportchild > /dev/null || groupadd supportchild getent passwd supportchild > /dev/null || useradd -r -s /sbin/nologin -g supportchild supportchild %post %systemd_post supportchild.service %preun %systemd_preun supportchild.service %postun %systemd_postun_with_restart supportchild.service if [[ "$1" == "0" ]]; then getent passwd supportchild > /dev/null && userdel supportchild fi %files %attr(0755,root,root) /usr/bin/supportchild %attr(0644,root,root) /usr/lib/systemd/system/supportchild.service %config %attr(0600, supportchild, supportchild) /etc/supportchild/config.yml