-
Notifications
You must be signed in to change notification settings - Fork 791
/
nanocurrency-beta.spec.in
63 lines (55 loc) · 2.34 KB
/
nanocurrency-beta.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
Name: nanocurrency-beta
Version: @VERSION@
Release: @RELEASE@%{?dist}
Summary: Nanocurrency Beta 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 -DACTIVE_NETWORK=nano_beta_network -DCMAKE_BUILD_TYPE=RelWithDebInfo .
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-beta
cp nano_rpc %{buildroot}/usr/bin/nano_rpc-beta
cp etc/systemd/nanocurrency-beta.service %{buildroot}/etc/systemd/system/nanocurrency-beta.service
sed -i "s/nano_node/nano_node-beta/g" %{buildroot}/etc/systemd/system/nanocurrency-beta.service
%clean
if [ ! %{buildroot} = "/" ]; then %{__rm} -rf %{buildroot}; fi
%files
%defattr(755,root,root)
%{_bindir}/nano_node-beta
%{_bindir}/nano_rpc-beta
%attr(644,root,root) /etc/systemd/system/nanocurrency-beta.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 || :