forked from nanocurrency/nano-node
-
Notifications
You must be signed in to change notification settings - Fork 1
/
nanocurrency.spec.in
66 lines (58 loc) · 2.28 KB
/
nanocurrency.spec.in
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
Name: nanocurrency
Version: @VERSION@
Release: @RELEASE@%{?dist}
Summary: Nanocurrency Daemon
License: BSD-2-Clause
URL: https://bitcoinnano.org/
Requires(pre): /usr/sbin/useradd, /usr/bin/getent
Requires(postun): /usr/sbin/userdel
BuildRequires: make, libstdc++-static, 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 devtoolset-7 'rpmbuild ...'" >&2
exit 1
fi
if cc --std=c++14 --version 2>&1 >/dev/null | grep '^' >/dev/null; then
echo "Unsupported C++ compiler, try:" >&2
echo " scl enable devtoolset-7 'rpmbuild ...'" >&2
exit 1
fi
if test ! -d /usr/local/boost; then
echo "Boost should be in /usr/local/boost" >&2
exit 1
fi
%autosetup -n nano-%{version}
%build
cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DBOOST_ROOT=/usr/local/boost .
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 || :