62 lines
2.1 KiB
RPMSpec
62 lines
2.1 KiB
RPMSpec
Name: nanocurrency
|
|
Version: @VERSION@
|
|
Release: @RELEASE@%{?dist}
|
|
Summary: Nanocurrency Daemon
|
|
License: BSD-2-Clause
|
|
URL: https://nano.org/
|
|
Requires(pre): /usr/sbin/useradd, /usr/bin/getent
|
|
Requires(postun): /usr/sbin/userdel
|
|
BuildRequires: make, glibc-devel, glibc-headers
|
|
Source: nano-%{version}.tar.gz
|
|
|
|
%description
|
|
This is nanocurrency daemon. Nano is a digital currency that is
|
|
peer-to-peer, decentralized, and trustless. This package includes
|
|
the nano daemon, and a service.
|
|
|
|
%prep
|
|
if [ ! -x "$(which cmake)" ]; then
|
|
echo "cmake must exist, try:" >&2
|
|
echo " scl enable gcc-toolset-12 'rpmbuild ...'" >&2
|
|
exit 1
|
|
fi
|
|
if cc --std=c++20 --version 2>&1 >/dev/null | grep '^' >/dev/null; then
|
|
echo "Unsupported C++ compiler, try:" >&2
|
|
echo " scl enable gcc-toolset-12 'rpmbuild ...'" >&2
|
|
exit 1
|
|
fi
|
|
%autosetup -n nano-%{version}
|
|
|
|
%build
|
|
cmake -DCMAKE_VERBOSE_MAKEFILE=ON .
|
|
make nano_node %{?_smp_mflags}
|
|
make nano_rpc %{?_smp_mflags}
|
|
|
|
%install
|
|
if [ ! %{buildroot} = "/" ]; then %{__rm} -rf %{buildroot}; fi
|
|
mkdir -p %{buildroot}/usr/bin
|
|
mkdir -p %{buildroot}/etc/systemd/system/
|
|
cp nano_node %{buildroot}/usr/bin/nano_node
|
|
cp nano_rpc %{buildroot}/usr/bin/nano_rpc
|
|
cp etc/systemd/nanocurrency.service %{buildroot}/etc/systemd/system/nanocurrency.service
|
|
|
|
%clean
|
|
if [ ! %{buildroot} = "/" ]; then %{__rm} -rf %{buildroot}; fi
|
|
|
|
%files
|
|
%defattr(755,root,root)
|
|
%{_bindir}/nano_node
|
|
%{_bindir}/nano_rpc
|
|
%attr(644,root,root) /etc/systemd/system/nanocurrency.service
|
|
|
|
%pre
|
|
PATH="/usr/bin:/usr/sbin:/bin:/sbin:${PATH}"; export PATH
|
|
mkdir -p /var/nanocurrency/Nano
|
|
getent group nanocurrency >/dev/null || groupadd --system nanocurrency || exit 1
|
|
getent passwd nanocurrency >/dev/null || useradd --system --create-home --home-dir /var/nanocurrency --shell /bin/bash --comment "Nanocurrency Daemon user" --gid nanocurrency nanocurrency || exit 1
|
|
chown -R nanocurrency:nanocurrency /var/nanocurrency
|
|
chmod 700 /var/nanocurrency
|
|
|
|
%postun
|
|
PATH="/usr/bin:/usr/sbin:/bin:/sbin:${PATH}"; export PATH
|
|
userdel nanocurrency >/dev/null 2>/dev/null || :
|