forked from nanocurrency/nano-node
-
Notifications
You must be signed in to change notification settings - Fork 52
/
nanocurrency.spec.in
62 lines (54 loc) · 2.11 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
Name: bananocoin
Version: @VERSION@
Release: @RELEASE@%{?dist}
Summary: Bananocurrency 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 bananocoin daemon. Banano 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 bananode %{?_smp_mflags}
make banano_rpc %{?_smp_mflags}
%install
if [ ! %{buildroot} = "/" ]; then %{__rm} -rf %{buildroot}; fi
mkdir -p %{buildroot}/usr/bin
mkdir -p %{buildroot}/etc/systemd/system/
cp bananode %{buildroot}/usr/bin/bananode
cp banano_rpc %{buildroot}/usr/bin/banano_rpc
cp etc/systemd/bananocoin.service %{buildroot}/etc/systemd/system/bananocoin.service
%clean
if [ ! %{buildroot} = "/" ]; then %{__rm} -rf %{buildroot}; fi
%files
%defattr(755,root,root)
%{_bindir}/bananode
%{_bindir}/banano_rpc
%attr(644,root,root) /etc/systemd/system/bananocoin.service
%pre
PATH="/usr/bin:/usr/sbin:/bin:/sbin:${PATH}"; export PATH
mkdir -p /var/bananocoin/Banano
getent group bananocoin >/dev/null || groupadd --system bananocoin || exit 1
getent passwd bananocoin >/dev/null || useradd --system --create-home --home-dir /var/bananocoin --shell /bin/bash --comment "Bananocurrency Daemon user" --gid bananocoin bananocoin || exit 1
chown -R bananocoin:bananocoin /var/bananocoin
chmod 700 /var/bananocoin
%postun
PATH="/usr/bin:/usr/sbin:/bin:/sbin:${PATH}"; export PATH
userdel bananocoin >/dev/null 2>/dev/null || :