-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsystemd-lock-handler.spec
More file actions
199 lines (146 loc) · 6.22 KB
/
Copy pathsystemd-lock-handler.spec
File metadata and controls
199 lines (146 loc) · 6.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
%global debug_package %{nil}
%global _find_debuginfo_dwz_opts %{nil}
%global _build_id_links none
%global target_go_ver 1.27.1
Name: systemd-lock-handler
Version: 20
Release: %autorelease
Summary: Systemd user service for lock/unlock events
License: ISC
URL: https://github.com/Infiniti151/%{name}
BugURL: https://github.com/Infiniti151/%{name}/issues
Source0: %{url}/archive/v%{version}.tar.gz
BuildRequires: systemd-rpm-macros
BuildRequires: curl
%description
A systemd user service to handle lock/unlock events.
%prep
%autosetup
echo "=== Extracted Source Tarball ==="
%ifarch x86_64
echo "=== Fetching Pre-built x64 Binary from GitHub Releases ==="
curl -sL "%{url}/releases/download/v%{version}/%{name}" -o %{name}
if ! file %{name} | grep -q "ELF.*x86-64"; then
echo "ERROR: Downloaded file is not a valid x86_64 ELF binary!"
cat %{name}
exit 1
fi
chmod +x %{name}
%else
echo "=== Fetching Go version %{target_go_ver} for ARM64 ==="
mkdir -p ./go-home
curl -sL "https://go.dev/dl/go%{target_go_ver}.linux-arm64.tar.gz" -o go-arm64.tar.gz
tar -C ./go-home -xf go-arm64.tar.gz
echo "=== Extracted Go Tarball ==="
%endif
%build
echo "=*=*=*> Running Build Phase <*=*=*="
%ifarch x86_64
echo "=== Skipping Compilation for x86_64 (Using GitHub Release Asset) ==="
%else
echo "=== Compiling from Source for %{_arch} ==="
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
echo "=== Go version: $($GO_BIN version) ==="
export GOTOOLCHAIN=local
export CGO_ENABLED=0
echo "=== Go environment ==="
$GO_BIN env
echo "=== Building %{name} ==="
$GO_BIN build -ldflags '-s -w' -o %{name} main.go
%endif
sed "s|{{BIN_PATH}}|%{_bindir}/%{name}|g" dist/%{name}.service > dist/%{name}.service.ready
%check
echo "=*=*=*> Running Check Phase <*=*=*="
%ifarch x86_64
echo "=== Verifying downloaded x86_64 binary execution ==="
./%{name} --help || true
%else
GO_BIN=$(pwd)/go-home/go/bin/go
export GOTOOLCHAIN=local
export CGO_ENABLED=0
echo "=== Package List ==="
$GO_BIN list .
echo "=== Running Tests ==="
$GO_BIN test -v .
%endif
%install
echo "=*=*=*> Running Install Phase <*=*=*="
echo "Working directory: $(pwd)"
echo "Buildroot: %{buildroot}"
if [ ! -f %{name} ]; then
echo "ERROR: Binary '%{name}' not found in $(pwd)!"
ls -lh
exit 1
fi
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_userunitdir}
echo "=== Installing binary to %{buildroot}%{_bindir}/ ==="
install -m 755 %{name} %{buildroot}%{_bindir}/
echo "=== Installing systemd units to %{buildroot}%{_userunitdir}/ ==="
install -m 644 dist/%{name}.service.ready %{buildroot}%{_userunitdir}/%{name}.service
install -m 644 dist/*.target %{buildroot}%{_userunitdir}/
echo "=== Final Buildroot Contents ==="
find %{buildroot} -maxdepth 4 -not -path '*/.*'
echo "=*=*=*> Finished Install Phase - Moving to File Manifest <*=*=*="
%files
%license LICENCE
%doc README.md
%{_bindir}/%{name}
%{_userunitdir}/*.service
%{_userunitdir}/*.target
%post
%systemd_user_post %{name}.service
%preun
%systemd_user_preun %{name}.service
%postun
%systemd_user_postun %{name}.service
%changelog
* Wed Sep 02 2026 Infiniti151 <43163551+Infiniti151@users.noreply.github.com> - 20-1
- Upgraded Go compiler environment from 1.27.0 to 1.27.1
* Thu Aug 20 2026 Infiniti151 <43163551+Infiniti151@users.noreply.github.com> - 19-1
- Upgraded Go compiler environment from 1.26.6 to 1.27.0
* Fri Aug 14 2026 Infiniti151 <43163551+Infiniti151@users.noreply.github.com> - 18-1
- Upgraded Go compiler environment from 1.26.5 to 1.26.6
* Thu Jul 30 2026 Infiniti151 <43163551+Infiniti151@users.noreply.github.com> - 17-1
- Added `wake.target` for handling post-resume tasks
- Refactored target state transitions to use exclusive target switching
- Updated release workflow to extract notes from `CHANGELOG.md` and trigger COPR builds
* Thu Jul 09 2026 Infiniti151 <43163551+Infiniti151@users.noreply.github.com> - 16-1
- Updated `x/sys` from v0.46.0 to v0.47.0
* Wed Jul 08 2026 Infiniti151 <43163551+Infiniti151@users.noreply.github.com> - 15-1
- Upgraded Go compiler environment from 1.26.4 to 1.26.5
* Tue Jun 09 2026 Infiniti151 <43163551+Infiniti151@users.noreply.github.com> - 14-1
- Updated `x/sys` from 0.45.0 to 0.46.0
* Wed Jun 03 2026 Infiniti151 <43163551+Infiniti151@users.noreply.github.com> - 13-1
- Upgraded Go compiler environment from 1.26.3 to 1.26.4
* Fri May 22 2026 Infiniti151 <43163551+Infiniti151@users.noreply.github.com> - 12-1
- Updated `x/sys` from 0.44.0 to 0.45.0
* Tue May 19 2026 Infiniti151 <43163551+Infiniti151@users.noreply.github.com> - 11-1
- Updated to use a config file instead of a systemd drop-in file for setting flags
* Sat May 09 2026 Infiniti151 <43163551+Infiniti151@users.noreply.github.com> - 10-1
- Updated `x/sys` from 0.43.0 to 0.44.0
* Fri May 08 2026 Infiniti151 <43163551+Infiniti151@users.noreply.github.com> - 9-1
- Upgraded Go compiler environment from 1.26.2 to 1.26.3
* Thu Apr 09 2026 Infiniti151 <43163551+Infiniti151@users.noreply.github.com> - 8-1
- Updated `x/sys` from 0.42.0 to 0.43.0
* Wed Apr 08 2026 Infiniti151 <43163551+Infiniti151@users.noreply.github.com> - 7-1
- Upgraded Go compiler environment from 1.26.1 to 1.26.2
* Mon Apr 06 2026 Infiniti151 <43163551+Infiniti151@users.noreply.github.com> - 6-1
- Added block-sleep-lock flag to filter out lock/unlock events from suspend/resume.
- Decoupled sleep.target from lock.target
* Wed Mar 11 2026 Infiniti151 <43163551+Infiniti151@users.noreply.github.com> - 5-1
- Replaced D-Bus Lock signals with LockedHint property for more reliable detection
- Added command-line flags to toggle detection for events
- Added logic to debounce duplicate signals (especially duplicate lock signals during sleep event)
* Mon Mar 09 2026 Infiniti151 <43163551+Infiniti151@users.noreply.github.com> - 4-1
- Updated `x/sys` from 0.41.0 to 0.42.0
* Sat Mar 07 2026 Infiniti151 <43163551+Infiniti151@users.noreply.github.com> - 3-1
- Upgraded Go compiler environment from 1.26.0 to 1.26.1
* Tue Mar 03 2026 Infiniti151 <43163551+Infiniti151@users.noreply.github.com> - 2-1
- Updated `x/sys` from 0.27.0 to 0.41.0
* Sun Mar 01 2026 Infiniti151 <43163551+Infiniti151@users.noreply.github.com> - 1-1
- Initial release