Name: systemd-lock-handler Version: 7 Release: %autorelease Summary: Systemd user service for lock/unlock events License: ISC URL: https://github.com/Infiniti151/systemd-lock-handler Source0: systemd-lock-handler.tar.gz Source1: go-toolchain.tar.gz BuildRequires: systemd-rpm-macros BuildRequires: go-rpm-macros BuildRequires: compiler(go-compiler) %description A systemd user service to handle lock/unlock events. %prep %setup -q -c -T tar -xf %{SOURCE0} --strip-components=1 mkdir -p ./go-home tar -C ./go-home -xf %{SOURCE1} %build GO_BIN=$(pwd)/go-home/go/bin/go if [ ! -x "$GO_BIN" ]; then echo "ERROR: Custom Go compiler not found at $GO_BIN" exit 1 fi $GO_BIN version export GOTOOLCHAIN=local $GO_BIN build -ldflags '-s -w' -o systemd-lock-handler main.go %check GO_BIN=$(pwd)/go-home/go/bin/go export GOTOOLCHAIN=local $GO_BIN test -v ./... %install mkdir -p %{buildroot}%{_bindir} mkdir -p %{buildroot}%{_userunitdir} install -m 755 systemd-lock-handler %{buildroot}%{_bindir}/ install -m 644 dist/systemd-lock-handler.service.ready %{buildroot}%{_userunitdir}/systemd-lock-handler.service install -m 644 dist/*.target %{buildroot}%{_userunitdir}/ %files %license LICENCE %{_bindir}/systemd-lock-handler %{_userunitdir}/*.service %{_userunitdir}/*.target %post %systemd_user_post systemd-lock-handler.service %preun %systemd_user_preun systemd-lock-handler.service %postun %systemd_user_postun_with_restart systemd-lock-handler.service %changelog %autochangelog