%global commit f7cd8ecb4584e27d9d7594ddd0f9ee0d83138703 %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global commitdate 20210901 %global debug_package %{nil} %global base_name radicle-seed Name: radicle-seed-usdt Epoch: 1 Version: 0 Release: 10.%{commitdate}git%{shortcommit}%{?dist} Summary: Radicle seed License: GPLv3 URL: https://radicle.xyz Source0: https://github.com/viraptor/radicle-bins/archive/%{commit}.zip Source1: %{base_name}.service Source2: %{base_name}.defaults BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires(pre): shadow-utils Requires: git BuildRequires: systemd-rpm-macros BuildRequires: gcc nodejs systemtap-sdt-devel %if 08 != 0%{?centos} BuildRequires: yarnpkg %endif %description Radicle seed binaries and website static files %prep %setup -q -n radicle-bins-%{commit} curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain $(cat rust-toolchain) %build %if 08 == 0%{?centos} npm install yarn (cd seed/ui && ../../node_modules/.bin/yarnpkg && ../../node_modules/.bin/yarnpkg build) %else (cd seed/ui && yarnpkg && yarnpkg build) %endif ~/.cargo/bin/cargo build --release %install rm -rf %{buildroot} mkdir -p %{buildroot}%{_bindir} install -m 0755 target/release/radicle-seed-node %{buildroot}%{_bindir}/radicle-seed-node install -m 0755 target/release/radicle-keyutil %{buildroot}%{_bindir}/radicle-keyutil install -d -m 0755 %{buildroot}%{_datadir}/%{base_name} cp -r seed/ui/public %{buildroot}%{_datadir}/%{base_name} install -D -m 0644 %{SOURCE1} %{buildroot}/usr/lib/systemd/system/%{base_name}.service install -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/default/%{base_name} install -d -m 0755 %{buildroot}/var/lib/%{base_name} %clean rm -rf %{buildroot} %files %defattr(-,root,root,-) %{_bindir}/radicle-seed-node %{_bindir}/radicle-keyutil %{_datadir}/%{base_name} %config %{_sysconfdir}/default/%{base_name} /usr/lib/systemd/system/%{base_name}.service %attr(0755, radicle, radicle) %dir /var/lib/%{base_name} %doc README.md %license LICENSE %post %systemd_post %{base_name}.service %preun %systemd_preun %{base_name}.service %postun %systemd_postun_with_restart %{base_name}.service %pre getent group radicle >/dev/null || groupadd -r radicle getent passwd radicle >/dev/null || \ useradd -r -g radicle -d /var/lib/%{base_name} -s /sbin/nologin \ -c "Radicle seed service owner" radicle exit 0 %changelog * Wed May 19 2021 Vi - 0.0.0-4 - initial