|
| 1 | +%global goipath github.com/artalkjs/artalk/v2 |
| 2 | +Version: 2.9.1 |
| 3 | +%gometa -f |
| 4 | +Name: artalk |
| 5 | +Release: %autorelease |
| 6 | +Summary: A Self-hosted Comment System |
| 7 | +License: MIT |
| 8 | +URL: https://artalk.js.org/ |
| 9 | +Source0: %{name}-%{version}-vendored.tar.gz |
| 10 | +# track this script |
| 11 | +Source1: vendor-tarball.sh |
| 12 | +Source2: https://github.com/ArtalkJS/Artalk/releases/download/v%{version}/artalk_ui.tar.gz |
| 13 | +Source3: artalk.sysusers |
| 14 | +Source4: artalk.service |
| 15 | +Patch1: 0001-fix-go-test-ld-undefined-error-by-remove-clickhouse.patch |
| 16 | +Patch2: 0002-remove-upgrade-command.patch |
| 17 | +BuildRequires: systemd-rpm-macros |
| 18 | +%{?systemd_requires} |
| 19 | +%{?sysusers_requires_compat} |
| 20 | + |
| 21 | + |
| 22 | +%description |
| 23 | +Artalk is an intuitive yet feature-rich comment system, ready for immediate deployment into any blog, website, or web application. |
| 24 | + |
| 25 | + |
| 26 | +%gopkg |
| 27 | + |
| 28 | + |
| 29 | +%prep |
| 30 | +%autosetup -p1 |
| 31 | +tar --strip-components=1 -xzf %{SOURCE2} --directory=public |
| 32 | +%goprep -k -e |
| 33 | +chmod -Rf a+rX,u+w,g-w,o-w . |
| 34 | + |
| 35 | + |
| 36 | +%build |
| 37 | +%gobuild -o %{gobuilddir}/bin/artalk %{goipath} |
| 38 | + |
| 39 | + |
| 40 | +%install |
| 41 | +%gopkginstall |
| 42 | + |
| 43 | +# command |
| 44 | +install -m 0755 -vd %{buildroot}%{_bindir} |
| 45 | +install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/ |
| 46 | + |
| 47 | +# sysusers |
| 48 | +install -p -D -m 0644 %{SOURCE3} %{buildroot}%{_sysusersdir}/%{name}.conf |
| 49 | + |
| 50 | +# data directory (work dir) |
| 51 | +install -d -m 0750 %{buildroot}%{_sharedstatedir}/artalk |
| 52 | + |
| 53 | +# config |
| 54 | +install -D -p -m 0644 ./conf/artalk.example.yml %{buildroot}%{_sysconfdir}/artalk/artalk.yml |
| 55 | + |
| 56 | +# systemd units |
| 57 | +install -D -p -m 0644 %{SOURCE4} %{buildroot}%{_unitdir}/artalk.service |
| 58 | + |
| 59 | + |
| 60 | +%check |
| 61 | +%gocheck |
| 62 | + |
| 63 | + |
| 64 | +%pre |
| 65 | +%sysusers_create_compat %{SOURCE3} |
| 66 | + |
| 67 | + |
| 68 | +%post |
| 69 | +%systemd_post artalk.service |
| 70 | + |
| 71 | + |
| 72 | +%preun |
| 73 | +%systemd_preun artalk.service |
| 74 | + |
| 75 | + |
| 76 | +%postun |
| 77 | +%systemd_postun_with_restart artalk.service |
| 78 | + |
| 79 | + |
| 80 | +%files |
| 81 | +%doc CONTRIBUTING.md README.md |
| 82 | +%license LICENSE |
| 83 | +%{_bindir}/artalk |
| 84 | +%{_unitdir}/artalk.service |
| 85 | +%{_sysusersdir}/%{name}.conf |
| 86 | +%dir %{_sysconfdir}/artalk |
| 87 | +%config(noreplace) %{_sysconfdir}/artalk/artalk.yml |
| 88 | +%attr(0750,artalk,artalk) %dir %{_sharedstatedir}/artalk |
| 89 | + |
| 90 | + |
| 91 | +%gopkgfiles |
| 92 | + |
| 93 | + |
| 94 | +%changelog |
| 95 | +%autochangelog |
0 commit comments