You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
4.3 KiB
118 lines
4.3 KiB
## |
|
## ethereum-bootnode.spec -- OpenPKG RPM Package Specification |
|
## Copyright (c) 2000-2021 OpenPKG Project <http://openpkg.org/> |
|
## |
|
## Permission to use, copy, modify, and distribute this software for |
|
## any purpose with or without fee is hereby granted, provided that |
|
## the above copyright notice and this permission notice appear in all |
|
## copies. |
|
## |
|
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
|
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
|
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
|
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
|
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
## SUCH DAMAGE. |
|
## |
|
|
|
# package information |
|
Name: ethereum-bootnode |
|
Summary: Ethereum Blockchain Service (P2P Network Boot Node) |
|
URL: https://geth.ethereum.org/ |
|
Vendor: Ethereum Community |
|
Packager: OpenPKG Project |
|
Distribution: OpenPKG Community |
|
Class: EVAL |
|
Group: P2P |
|
License: LGPL |
|
Version: 1.8.27 |
|
Release: 20190418 |
|
|
|
# list of sources |
|
Source0: https://github.com/ethereum/go-ethereum/archive/v%{version}.tar.gz |
|
Source1: rc.ethereum-bootnode |
|
Patch0: ethereum-bootnode.patch |
|
|
|
# build information |
|
BuildPreReq: OpenPKG, openpkg >= 20160101, go |
|
PreReq: OpenPKG, openpkg >= 20160101 |
|
|
|
%description |
|
Ethereum is a decentralized platform that runs smart contracts, |
|
applications that run exactly as programmed without possibility of |
|
downtime, censorship, fraud or third party interference. Go Ethereum |
|
(aka Geth) is one of the three original implementations of the |
|
Ethereum protocol. This is just the Ethereum P2P network Boot Node |
|
service. |
|
|
|
%track |
|
prog ethereum-bootnode = { |
|
version = %{version} |
|
url = https://github.com/ethereum/go-ethereum/releases |
|
regex = v(__VER__)\.tar\.gz |
|
} |
|
|
|
%prep |
|
%setup -q -n go-ethereum-%{version} |
|
%patch -p0 |
|
|
|
%build |
|
# build program |
|
./build/env.sh go run build/ci.go install ./cmd/bootnode |
|
|
|
%install |
|
# create installation hierarchy |
|
%{l_shtool} mkdir -f -p -m 755 \ |
|
$RPM_BUILD_ROOT%{l_prefix}/bin \ |
|
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ |
|
$RPM_BUILD_ROOT%{l_prefix}/etc/ethereum-bootnode \ |
|
$RPM_BUILD_ROOT%{l_prefix}/var/ethereum-bootnode/log \ |
|
$RPM_BUILD_ROOT%{l_prefix}/var/ethereum-bootnode/run |
|
|
|
# install program |
|
%{l_shtool} install -c -s -m 775 \ |
|
build/bin/bootnode $RPM_BUILD_ROOT%{l_prefix}/bin/ethereum-bootnode |
|
|
|
# install run-command script |
|
%{l_shtool} install -c -m 755 %{l_value -s -a} \ |
|
%{SOURCE rc.ethereum-bootnode} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
|
|
|
# determine installation files |
|
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
|
%{l_files_std} \ |
|
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/ethereum-bootnode' \ |
|
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/ethereum-bootnode/*' |
|
|
|
%files -f files |
|
|
|
%clean |
|
|
|
%post |
|
if [ $1 -eq 1 ]; then |
|
# on initial installation, generate the private key |
|
su - %{l_rusr} -c \ |
|
"$RPM_INSTALL_PREFIX/bin/ethereum-bootnode \ |
|
-genkey $RPM_INSTALL_PREFIX/etc/ethereum-bootnode/ethereum-bootnode.key" |
|
elif [ $1 -eq 2 ]; then |
|
# after upgrade, restart service |
|
eval `%{l_rc} ethereum-bootnode status 2>/dev/null` |
|
[ ".$ethereum_bootnode_active" = .yes ] && %{l_rc} ethereum-bootnode restart |
|
fi |
|
exit 0 |
|
|
|
%preun |
|
if [ $1 -eq 0 ]; then |
|
# before erase, stop service and remove log files |
|
%{l_rc} ethereum-bootnode stop 2>/dev/null |
|
rm -f $RPM_INSTALL_PREFIX/etc/ethereum-bootnode/* >/dev/null 2>&1 || true |
|
rm -rf $RPM_INSTALL_PREFIX/var/ethereum-bootnode/log/* >/dev/null 2>&1 || true |
|
rm -rf $RPM_INSTALL_PREFIX/var/ethereum-bootnode/run/* >/dev/null 2>&1 || true |
|
fi |
|
exit 0 |
|
|
|
|