mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-04 19:25:51 +00:00
Compare commits
1 Commits
9546c52013
...
legleux/li
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f51e2d3f30 |
70
.github/workflows/on-pr.yml
vendored
70
.github/workflows/on-pr.yml
vendored
@@ -1,10 +1,13 @@
|
||||
# This workflow runs all workflows to check, build and test the project on
|
||||
# various Linux flavors, as well as on MacOS and Windows, on every push to a
|
||||
# This workflow runs all workflows to check, build, package and test the project on
|
||||
# various Linux flavors, as well as on macOS and Windows, on every push to a
|
||||
# user branch. However, it will not run if the pull request is a draft unless it
|
||||
# has the 'DraftRunCI' label.
|
||||
name: PR
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- legleux/linux_packages
|
||||
merge_group:
|
||||
types:
|
||||
- checks_requested
|
||||
@@ -62,6 +65,7 @@ jobs:
|
||||
.github/workflows/reusable-build.yml
|
||||
.github/workflows/reusable-build-test-config.yml
|
||||
.github/workflows/reusable-build-test.yml
|
||||
.github/workflows/reusable-build-pkg.yml
|
||||
.github/workflows/reusable-strategy-matrix.yml
|
||||
.github/workflows/reusable-test.yml
|
||||
.codecov.yml
|
||||
@@ -69,6 +73,7 @@ jobs:
|
||||
conan/**
|
||||
external/**
|
||||
include/**
|
||||
pkgs/**
|
||||
src/**
|
||||
tests/**
|
||||
CMakeLists.txt
|
||||
@@ -93,40 +98,57 @@ jobs:
|
||||
outputs:
|
||||
go: ${{ steps.go.outputs.go == 'true' }}
|
||||
|
||||
check-levelization:
|
||||
needs: should-run
|
||||
if: ${{ needs.should-run.outputs.go == 'true' }}
|
||||
uses: ./.github/workflows/reusable-check-levelization.yml
|
||||
# check-levelization:
|
||||
# needs: should-run
|
||||
# if: ${{ needs.should-run.outputs.go == 'true' }}
|
||||
# uses: ./.github/workflows/reusable-check-levelization.yml
|
||||
|
||||
build-test:
|
||||
# build-test:
|
||||
# needs: should-run
|
||||
# if: ${{ needs.should-run.outputs.go == 'true' }}
|
||||
# uses: ./.github/workflows/reusable-build-test.yml
|
||||
# strategy:
|
||||
# matrix:
|
||||
# os: [linux, macos, windows]
|
||||
# with:
|
||||
# os: ${{ matrix.os }}
|
||||
# secrets:
|
||||
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
build-package:
|
||||
name: Build ${{ matrix.pkg_type }}-${{ matrix.arch }} packages
|
||||
needs: should-run
|
||||
if: ${{ needs.should-run.outputs.go == 'true' }}
|
||||
uses: ./.github/workflows/reusable-build-test.yml
|
||||
uses: ./.github/workflows/reusable-build-pkg.yml
|
||||
secrets: inherit
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [linux, macos, windows]
|
||||
# pkg_type: [rpm]
|
||||
pkg_type: [deb, rpm]
|
||||
arch: [amd64]
|
||||
# arch: [amd64, arm64]
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
secrets:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
pkg_type: ${{ matrix.pkg_type }}
|
||||
arch: ${{ matrix.arch }}
|
||||
|
||||
notify-clio:
|
||||
needs:
|
||||
- should-run
|
||||
- build-test
|
||||
if: ${{ needs.should-run.outputs.go == 'true' && contains(fromJSON('["release", "master"]'), github.ref_name) }}
|
||||
uses: ./.github/workflows/reusable-notify-clio.yml
|
||||
secrets:
|
||||
clio_notify_token: ${{ secrets.CLIO_NOTIFY_TOKEN }}
|
||||
conan_remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }}
|
||||
conan_remote_password: ${{ secrets.CONAN_REMOTE_PASSWORD }}
|
||||
# notify-clio:
|
||||
# needs:
|
||||
# - should-run
|
||||
# - build-test
|
||||
# if: ${{ needs.should-run.outputs.go == 'true' && contains(fromJSON('["release", "master"]'), github.ref_name) }}
|
||||
# uses: ./.github/workflows/reusable-notify-clio.yml
|
||||
# secrets:
|
||||
# clio_notify_token: ${{ secrets.CLIO_NOTIFY_TOKEN }}
|
||||
# conan_remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }}
|
||||
# conan_remote_password: ${{ secrets.CONAN_REMOTE_PASSWORD }}
|
||||
|
||||
passed:
|
||||
if: failure() || cancelled()
|
||||
needs:
|
||||
- build-test
|
||||
- check-levelization
|
||||
# - build-test
|
||||
# - check-levelization
|
||||
- build-package
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Fail
|
||||
|
||||
37
.github/workflows/on-trigger.yml
vendored
37
.github/workflows/on-trigger.yml
vendored
@@ -12,6 +12,7 @@ on:
|
||||
- "develop"
|
||||
- "release*"
|
||||
- "master"
|
||||
- "legleux/linux_packages"
|
||||
paths:
|
||||
# These paths are unique to `on-trigger.yml`.
|
||||
- ".github/workflows/reusable-check-missing-commits.yml"
|
||||
@@ -26,6 +27,7 @@ on:
|
||||
- ".github/workflows/reusable-build.yml"
|
||||
- ".github/workflows/reusable-build-test-config.yml"
|
||||
- ".github/workflows/reusable-build-test.yml"
|
||||
- ".github/workflows/reusable-build-pkg.yml"
|
||||
- ".github/workflows/reusable-strategy-matrix.yml"
|
||||
- ".github/workflows/reusable-test.yml"
|
||||
- ".codecov.yml"
|
||||
@@ -33,6 +35,7 @@ on:
|
||||
- "conan/**"
|
||||
- "external/**"
|
||||
- "include/**"
|
||||
- "pkgs/**"
|
||||
- "src/**"
|
||||
- "tests/**"
|
||||
- "CMakeLists.txt"
|
||||
@@ -63,18 +66,32 @@ defaults:
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
check-missing-commits:
|
||||
if: ${{ github.event_name == 'push' && github.ref_type == 'branch' && contains(fromJSON('["develop", "release"]'), github.ref_name) }}
|
||||
uses: ./.github/workflows/reusable-check-missing-commits.yml
|
||||
# check-missing-commits:
|
||||
# if: ${{ github.event_name == 'push' && github.ref_type == 'branch' && contains(fromJSON('["develop", "release"]'), github.ref_name) }}
|
||||
# uses: ./.github/workflows/reusable-check-missing-commits.yml
|
||||
|
||||
build-test:
|
||||
uses: ./.github/workflows/reusable-build-test.yml
|
||||
# build-test:
|
||||
# uses: ./.github/workflows/reusable-build-test.yml
|
||||
# strategy:
|
||||
# matrix:
|
||||
# os: [linux, macos, windows]
|
||||
# with:
|
||||
# os: ${{ matrix.os }}
|
||||
# strategy_matrix: ${{ github.event_name == 'schedule' && 'all' || 'minimal' }}
|
||||
# secrets:
|
||||
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
build-package:
|
||||
name: Build ${{ matrix.pkg_type }}-${{ matrix.arch }} packages
|
||||
uses: ./.github/workflows/reusable-build-pkg.yml
|
||||
secrets: inherit
|
||||
strategy:
|
||||
fail-fast: ${{ github.event_name == 'merge_group' }}
|
||||
matrix:
|
||||
os: [linux, macos, windows]
|
||||
# pkg_type: [rpm]
|
||||
pkg_type: [deb, rpm]
|
||||
arch: [amd64]
|
||||
# arch: [amd64, arm64]
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
strategy_matrix: ${{ github.event_name == 'schedule' && 'all' || 'minimal' }}
|
||||
secrets:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
pkg_type: ${{ matrix.pkg_type }}
|
||||
arch: ${{ matrix.arch }}
|
||||
|
||||
32
.github/workflows/reusable-build-pkg.yml
vendored
Normal file
32
.github/workflows/reusable-build-pkg.yml
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
pkg_type:
|
||||
required: false
|
||||
type: string
|
||||
arch:
|
||||
required: false
|
||||
type: string
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
jobs:
|
||||
build:
|
||||
name: Build ${{ inputs.pkg_type }}-${{ inputs.arch }} package
|
||||
runs-on: heavy${{ inputs.arch == 'arm64' && '-arm64' || '' }}
|
||||
container: ghcr.io/xrplf/ci/${{ inputs.pkg_type == 'rpm' && 'rhel-9' || 'debian-bookworm' }}:gcc-12
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
||||
|
||||
- name: Build packages
|
||||
run: |
|
||||
./pkgs/build.sh
|
||||
cat build_vars >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ inputs.pkg_type }}-${{ inputs.arch }}
|
||||
path: "*${{ inputs.arch }}.${{ inputs.pkg_type }}"
|
||||
if-no-files-found: error
|
||||
167
pkgs/build.sh
Executable file
167
pkgs/build.sh
Executable file
@@ -0,0 +1,167 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o xtrace
|
||||
|
||||
. /etc/os-release
|
||||
|
||||
case "$ID $ID_LIKE" in
|
||||
*rhel*|*fedora*)
|
||||
pkg="rpm"
|
||||
;;
|
||||
*debian*|*ubuntu*)
|
||||
pkg="deb"
|
||||
;;
|
||||
esac
|
||||
|
||||
repo_dir=$PWD
|
||||
set -a
|
||||
repo_name="rippled"
|
||||
pkgs_dir="${repo_dir}/pkgs"
|
||||
shared_files="${pkgs_dir}/shared"
|
||||
pkg_files="${pkgs_dir}/${pkg}"
|
||||
build_info_src="${repo_dir}/src/libxrpl/protocol/BuildInfo.cpp"
|
||||
xrpl_version=$(grep -E -i -o "\b(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-[0-9a-z\-]+(\.[0-9a-z\-]+)*)?(\+[0-9a-z\-]+(\.[0-9a-z\-]+)*)?\b" "${build_info_src}")
|
||||
|
||||
git config --global --add safe.directory '*'
|
||||
branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
commit=$(git rev-parse HEAD)
|
||||
short_commit=$(git rev-parse --short=7 HEAD)
|
||||
date=$(git show -s --format=%cd --date=format-local:"%Y%m%d%H%M%S")
|
||||
|
||||
BUILD_TYPE=${BUILD_TYPE:-Release}
|
||||
set +a
|
||||
if [ "${branch}" = 'develop' ]; then
|
||||
# TODO: Can remove when CMake sets version
|
||||
dev_version="${date}~${short_commit}"
|
||||
xrpl_version="${xrpl_version}+${dev_version}"
|
||||
fi
|
||||
|
||||
if [ "${pkg}" = 'rpm' ]; then
|
||||
IFS='-' read -r RIPPLED_RPM_VERSION RELEASE <<< "${xrpl_version}"
|
||||
export RIPPLED_RPM_VERSION
|
||||
RPM_RELEASE=${RPM_RELEASE-1}
|
||||
# post-release version
|
||||
if [ "hf" = "$(echo "$RELEASE" | cut -c -2)" ]; then
|
||||
RPM_RELEASE="${RPM_RELEASE}.${RELEASE}"
|
||||
# pre-release version (-b or -rc)
|
||||
elif [[ $RELEASE ]]; then
|
||||
RPM_RELEASE="0.${RPM_RELEASE}.${RELEASE}"
|
||||
fi
|
||||
export RPM_RELEASE
|
||||
|
||||
if [[ $RPM_PATCH ]]; then
|
||||
RPM_PATCH=".${RPM_PATCH}"
|
||||
export RPM_PATCH
|
||||
fi
|
||||
|
||||
build_dir="build/${pkg}/packages"
|
||||
rm -rf "${build_dir}"
|
||||
mkdir -p "${build_dir}/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}"
|
||||
# cp "${pkgs_dir}/rippled.patch" "${build_dir}/rpmbuild/SOURCES/"
|
||||
git archive \
|
||||
--remote "${repo_dir}" HEAD \
|
||||
--prefix ${repo_name}/ \
|
||||
--format tar.gz \
|
||||
--output "${build_dir}/rpmbuild/SOURCES/rippled.tar.gz"
|
||||
ln --symbolic "${repo_dir}" "${build_dir}/rippled"
|
||||
cp -r "${pkg_files}/rippled.spec" "${build_dir}"
|
||||
pushd "${build_dir}" || exit
|
||||
|
||||
rpmbuild \
|
||||
--define "_topdir ${PWD}/rpmbuild" \
|
||||
--define "_smp_build_ncpus %(nproc --ignore=2 2>/dev/null || echo 1)" \
|
||||
-ba rippled.spec
|
||||
|
||||
RPM_VERSION_RELEASE=$(rpm -qp --qf='%{NAME}-%{VERSION}-%{RELEASE}' ./rpmbuild/RPMS/x86_64/rippled-[0-9]*.rpm)
|
||||
tar_file=$RPM_VERSION_RELEASE.tar.gz
|
||||
|
||||
printf '%s\n' \
|
||||
"rpm_md5sum=$(rpm -q --queryformat '%{SIGMD5}\n' -p ./rpmbuild/RPMS/x86_64/rippled-[0-9]*.rpm 2>/dev/null)" \
|
||||
"rpm_sha256=$(sha256sum ./rpmbuild/RPMS/x86_64/rippled-[0-9]*.rpm | awk '{ print $1 }')" \
|
||||
"rippled_version=${xrpl_version}" \
|
||||
"rippled_git_hash=${commit}" \
|
||||
"rpm_version=${RIPPLED_RPM_VERSION}" \
|
||||
"rpm_file_name=${tar_file}" \
|
||||
"rpm_version_release=${RPM_VERSION_RELEASE}" \
|
||||
> build_vars
|
||||
|
||||
# Rename the files arch to match the debs
|
||||
mv rpmbuild/RPMS/x86_64/* .
|
||||
for f in *x86_64.rpm; do
|
||||
new="${f/x86_64/amd64}"
|
||||
mv "$f" "$new"
|
||||
echo "Renamed $f -> $new"
|
||||
done
|
||||
rm -rf rpmbuild
|
||||
rm -f rippled rippled.tar.gz rippled.spec
|
||||
pushd -0 && dirs -c
|
||||
|
||||
mv "${build_dir}/build_vars" .
|
||||
|
||||
elif [ "${pkg}" = 'deb' ]; then
|
||||
# dpkg_version=$(echo "${xrpl_version}" | sed 's:-:~:g')
|
||||
dpkg_version=${xrpl_version//-/\~}
|
||||
full_version="${dpkg_version}"
|
||||
build_dir="build/${pkg}/packages"
|
||||
rm -rf "${build_dir}"
|
||||
mkdir -p "${build_dir}"
|
||||
|
||||
git archive \
|
||||
--remote "${repo_dir}" HEAD \
|
||||
--prefix ${repo_name}/ \
|
||||
--format tar.gz \
|
||||
--output "${build_dir}/${repo_name}_${dpkg_version}.orig.tar.gz"
|
||||
|
||||
pushd "${build_dir}" || exit
|
||||
tar -zxf "${repo_name}_${dpkg_version}.orig.tar.gz"
|
||||
|
||||
pushd ${repo_name} || exit
|
||||
|
||||
# Prepare the package metadata directory, `debian/`, within `rippled/`.
|
||||
cp -r "${pkg_files}/debian" .
|
||||
cp "${shared_files}/rippled.service" debian/
|
||||
cp "${shared_files}/update-rippled.sh" .
|
||||
cp "${shared_files}/update-rippled-cron" .
|
||||
cp "${shared_files}/rippled-logrotate" .
|
||||
|
||||
if [ "${branch}" = 'develop' ]; then
|
||||
# TODO: Can remove when CMake sets version
|
||||
sed --in-place "s/versionString = \"\([^\"]*\)\"/versionString = \"${xrpl_version}\"/" "${build_info_src}"
|
||||
fi
|
||||
|
||||
cat << CHANGELOG > ./debian/changelog
|
||||
rippled (${xrpl_version}) unstable; urgency=low
|
||||
|
||||
* see RELEASENOTES
|
||||
|
||||
-- Ripple Labs Inc. <support@ripple.com> $(TZ=UTC date -R)
|
||||
CHANGELOG
|
||||
|
||||
cat ./debian/changelog
|
||||
dpkg-buildpackage -b -d -us -uc
|
||||
|
||||
popd || exit
|
||||
rm -rf ${repo_name}
|
||||
# for f in *.ddeb; do mv -- "$f" "${f%.ddeb}.deb"; done
|
||||
popd || exit
|
||||
cp "${build_dir}/${repo_name}_${xrpl_version}_amd64.changes" .
|
||||
|
||||
awk '/Checksums-Sha256:/{hit=1;next}/Files:/{hit=0}hit' "${repo_name}_${xrpl_version}_amd64.changes" | sed -E 's!^[[:space:]]+!!' > shasums
|
||||
sha() {
|
||||
<shasums awk "/$1/ { print \$1 }"
|
||||
}
|
||||
|
||||
printf '%s\n' \
|
||||
"deb_sha256=$(sha "rippled_${full_version}_amd64.deb")" \
|
||||
"dbg_sha256=$(sha "rippled-dbgsym_${full_version}_amd64.deb")" \
|
||||
"rippled_version=${xrpl_version}" \
|
||||
"rippled_git_hash=${commit}" \
|
||||
"dpkg_version=${dpkg_version}" \
|
||||
"dpkg_full_version=${full_version}" \
|
||||
> build_vars
|
||||
|
||||
pushd -0 && dirs -c
|
||||
fi
|
||||
|
||||
cp "${build_dir}/"*.$pkg .
|
||||
3
pkgs/deb/debian/README.Debian
Normal file
3
pkgs/deb/debian/README.Debian
Normal file
@@ -0,0 +1,3 @@
|
||||
rippled daemon
|
||||
|
||||
-- Mike Ellery <mellery451@gmail.com> Tue, 04 Dec 2018 18:19:03 +0000
|
||||
20
pkgs/deb/debian/control
Normal file
20
pkgs/deb/debian/control
Normal file
@@ -0,0 +1,20 @@
|
||||
Source: rippled
|
||||
Section: net
|
||||
Priority: optional
|
||||
Maintainer: Ripple Labs Inc. <support@ripple.com>
|
||||
Build-Depends: cmake,
|
||||
debhelper (>= 13),
|
||||
debhelper-compat (= 13)
|
||||
# debhelper (>= 14),
|
||||
# debhelper-compat (= 14),
|
||||
# TODO: Let's go for 14!
|
||||
Standards-Version: 4.6.0
|
||||
Homepage: https://github.com/XRPLF/rippled.git
|
||||
Rules-Requires-Root: no
|
||||
|
||||
Package: rippled
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: XRP Ledger server (rippled)
|
||||
rippled is the core server of the XRP Ledger, providing a peer-to-peer
|
||||
network node for validating and processing transactions.
|
||||
86
pkgs/deb/debian/copyright
Normal file
86
pkgs/deb/debian/copyright
Normal file
@@ -0,0 +1,86 @@
|
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: rippled
|
||||
Source: https://github.com/ripple/rippled
|
||||
|
||||
Files: *
|
||||
Copyright: 2012-2019 Ripple Labs Inc.
|
||||
|
||||
License: __UNKNOWN__
|
||||
|
||||
The accompanying files under various copyrights.
|
||||
|
||||
Copyright (c) 2012, 2013, 2014 Ripple Labs Inc.
|
||||
|
||||
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.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
The accompanying files incorporate work covered by the following copyright
|
||||
and previous license notice:
|
||||
|
||||
Copyright (c) 2011 Arthur Britto, David Schwartz, Jed McCaleb,
|
||||
Vinnie Falco, Bob Way, Eric Lombrozo, Nikolaos D. Bougalis, Howard Hinnant
|
||||
|
||||
Some code from Raw Material Software, Ltd., provided under the terms of the
|
||||
ISC License. See the corresponding source files for more details.
|
||||
Copyright (c) 2013 - Raw Material Software Ltd.
|
||||
Please visit http://www.juce.com
|
||||
|
||||
Some code from ASIO examples:
|
||||
// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
Some code from Bitcoin:
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2011 The Bitcoin developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
Some code from Tom Wu:
|
||||
This software is covered under the following copyright:
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003-2005 Tom Wu
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
|
||||
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF
|
||||
* THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* In addition, the following condition applies:
|
||||
*
|
||||
* All redistributions must retain an intact copy of this copyright notice
|
||||
* and disclaimer.
|
||||
*/
|
||||
|
||||
Address all questions regarding this license to:
|
||||
|
||||
Tom Wu
|
||||
tjw@cs.Stanford.EDU
|
||||
3
pkgs/deb/debian/dirs
Normal file
3
pkgs/deb/debian/dirs
Normal file
@@ -0,0 +1,3 @@
|
||||
/var/log/rippled/
|
||||
/var/lib/rippled/
|
||||
/etc/systemd/system/rippled.service.d/
|
||||
2
pkgs/deb/debian/docs
Normal file
2
pkgs/deb/debian/docs
Normal file
@@ -0,0 +1,2 @@
|
||||
README.md
|
||||
LICENSE.md
|
||||
3
pkgs/deb/debian/rippled-dev.install
Normal file
3
pkgs/deb/debian/rippled-dev.install
Normal file
@@ -0,0 +1,3 @@
|
||||
opt/ripple/include
|
||||
opt/ripple/lib/*.a
|
||||
opt/ripple/lib/cmake/*
|
||||
2
pkgs/deb/debian/rippled.conffiles
Normal file
2
pkgs/deb/debian/rippled.conffiles
Normal file
@@ -0,0 +1,2 @@
|
||||
/opt/ripple/etc/rippled.cfg
|
||||
/opt/ripple/etc/validators.txt
|
||||
10
pkgs/deb/debian/rippled.install
Normal file
10
pkgs/deb/debian/rippled.install
Normal file
@@ -0,0 +1,10 @@
|
||||
etc/logrotate.d/rippled
|
||||
opt/ripple/bin/rippled
|
||||
opt/ripple/bin/update-rippled.sh
|
||||
opt/ripple/bin/validator-keys
|
||||
opt/ripple/bin/xrpld
|
||||
opt/ripple/etc/rippled.cfg
|
||||
opt/ripple/etc/update-rippled-cron
|
||||
opt/ripple/etc/validators.txt
|
||||
opt/ripple/include/*
|
||||
opt/ripple/lib/*
|
||||
4
pkgs/deb/debian/rippled.links
Normal file
4
pkgs/deb/debian/rippled.links
Normal file
@@ -0,0 +1,4 @@
|
||||
opt/ripple/etc/rippled.cfg etc/opt/ripple/rippled.cfg
|
||||
opt/ripple/etc/validators.txt etc/opt/ripple/validators.txt
|
||||
opt/ripple/bin/rippled usr/local/bin/rippled
|
||||
opt/ripple/bin/rippled opt/ripple/bin/xrpld
|
||||
39
pkgs/deb/debian/rippled.postinst
Normal file
39
pkgs/deb/debian/rippled.postinst
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
USER_NAME=rippled
|
||||
GROUP_NAME=rippled
|
||||
case "$1" in
|
||||
configure)
|
||||
id -u $USER_NAME >/dev/null 2>&1 || \
|
||||
useradd --system \
|
||||
--home-dir /nonexistent \
|
||||
--no-create-home \
|
||||
--shell /usr/sbin/nologin \
|
||||
--comment "system user for rippled" \
|
||||
--user-group \
|
||||
${USER_NAME}
|
||||
|
||||
chown -R $USER_NAME:$GROUP_NAME /var/log/rippled/
|
||||
chown -R $USER_NAME:$GROUP_NAME /var/lib/rippled/
|
||||
chown -R $USER_NAME:$GROUP_NAME /opt/ripple
|
||||
chmod 755 /var/log/rippled/
|
||||
chmod 755 /var/lib/rippled/
|
||||
chmod 644 /opt/ripple/etc/update-rippled-cron
|
||||
chmod 644 /etc/logrotate.d/rippled
|
||||
chown -R root:$GROUP_NAME /opt/ripple/etc/update-rippled-cron
|
||||
;;
|
||||
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postinst called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
||||
17
pkgs/deb/debian/rippled.postrm
Normal file
17
pkgs/deb/debian/rippled.postrm
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postrm called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
||||
20
pkgs/deb/debian/rippled.preinst
Normal file
20
pkgs/deb/debian/rippled.preinst
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
install|upgrade)
|
||||
;;
|
||||
|
||||
abort-upgrade)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "preinst called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
||||
20
pkgs/deb/debian/rippled.prerm
Normal file
20
pkgs/deb/debian/rippled.prerm
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
remove|upgrade|deconfigure)
|
||||
;;
|
||||
|
||||
failed-upgrade)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "prerm called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
||||
77
pkgs/deb/debian/rules
Executable file
77
pkgs/deb/debian/rules
Executable file
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/make -f
|
||||
export DH_VERBOSE = 1
|
||||
export DH_OPTIONS = -v
|
||||
## TODO: Confirm these are still required.
|
||||
# debuild sets some warnings that don't work well
|
||||
# for our curent build..so try to remove those flags here:
|
||||
export CFLAGS:=$(subst -Wformat,,$(CFLAGS))
|
||||
export CFLAGS:=$(subst -Werror=format-security,,$(CFLAGS))
|
||||
export CXXFLAGS:=$(subst -Wformat,,$(CXXFLAGS))
|
||||
export CXXFLAGS:=$(subst -Werror=format-security,,$(CXXFLAGS))
|
||||
|
||||
## TODO: Confirm these are still required.
|
||||
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
||||
export DEB_BUILD_OPTIONS = nodwz
|
||||
|
||||
export RIPPLE_REMOTE = xrplf
|
||||
export RIPPLE_REMOTE_URL = https://conan.ripplex.io
|
||||
|
||||
# ## CMake Configure args
|
||||
# export DEB_CMAKE_GENERATOR = Ninja
|
||||
export DEB_CMAKE_BUILD_TYPE = Release
|
||||
|
||||
NPROC := $(shell nproc --ignore=2)
|
||||
export DEB_BUILD_OPTIONS += parallel=$(NPROC)
|
||||
|
||||
CONAN_HOME := $(shell conan config home)
|
||||
CONAN_PROFILE := $(shell conan profile path default)
|
||||
CONAN_GCONF := $(CONAN_HOME)/global.conf
|
||||
INSTALL_PREFIX := "/opt/ripple"
|
||||
BUILD_DIR := obj-$(DEB_BUILD_GNU_TYPE)
|
||||
|
||||
.ONESHELL:
|
||||
SHELL := /bin/bash
|
||||
|
||||
%:
|
||||
dh $@ --buildsystem=cmake
|
||||
override_dh_installsystemd:
|
||||
dh_installsystemd --no-start
|
||||
|
||||
override_dh_auto_configure:
|
||||
conan remote add --index 0 $(RIPPLE_REMOTE) $(RIPPLE_REMOTE_URL) --force
|
||||
conan config install ./conan/profiles/default --target-folder $(CONAN_HOME)/profiles
|
||||
echo "tools.build:jobs={{ os.cpu_count() - 2 }}" >> ${CONAN_HOME}/global.conf
|
||||
echo "core.download:parallel={{ os.cpu_count() }}" >> $(CONAN_GCONF)
|
||||
|
||||
conan install . \
|
||||
--settings:all build_type=$(DEB_CMAKE_BUILD_TYPE) \
|
||||
--output-folder=$(BUILD_DIR) \
|
||||
--options:host "&:xrpld=True" \
|
||||
--options:host "&:tests=True" \
|
||||
--build=missing
|
||||
|
||||
# Debian assumes an offline build process and sets CMake's FETCHCONTENT_FULLY_DISCONNECTED variable to ON
|
||||
# To use as much as the default settings as possible we'll clone it where CMake's FetchContent expects it.
|
||||
mkdir -p "$(BUILD_DIR)/_deps"
|
||||
git clone https://github.com/ripple/validator-keys-tool.git "$(BUILD_DIR)/_deps/validator_keys-src"
|
||||
|
||||
dh_auto_configure --builddirectory=$(BUILD_DIR) -- \
|
||||
-DCMAKE_BUILD_TYPE:STRING=$(DEB_CMAKE_BUILD_TYPE) \
|
||||
-Dxrpld=ON -Dtests=ON -Dvalidator_keys=ON \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=$(INSTALL_PREFIX) \
|
||||
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=$(BUILD_DIR)/build/generators/conan_toolchain.cmake
|
||||
|
||||
override_dh_auto_build:
|
||||
dh_auto_build \
|
||||
--builddirectory=$(BUILD_DIR) -- rippled validator-keys
|
||||
|
||||
override_dh_auto_install:
|
||||
cmake --install $(BUILD_DIR) --prefix debian/tmp/opt/ripple
|
||||
install -D update-rippled.sh debian/tmp/opt/ripple/bin/update-rippled.sh
|
||||
install -D update-rippled-cron debian/tmp/opt/ripple/etc/update-rippled-cron
|
||||
install -D rippled-logrotate debian/tmp/etc/logrotate.d/rippled
|
||||
rm -rf debian/tmp/opt/ripple/lib64/cmake/date
|
||||
|
||||
override_dh_dwz:
|
||||
@echo "Skipping DWZ due to huge debug info"
|
||||
1
pkgs/deb/debian/source/format
Normal file
1
pkgs/deb/debian/source/format
Normal file
@@ -0,0 +1 @@
|
||||
3.0 (native)
|
||||
2
pkgs/deb/debian/source/local-options
Normal file
2
pkgs/deb/debian/source/local-options
Normal file
@@ -0,0 +1,2 @@
|
||||
#abort-on-upstream-changes
|
||||
#unapply-patches
|
||||
1
pkgs/rpm/50-rippled.preset
Normal file
1
pkgs/rpm/50-rippled.preset
Normal file
@@ -0,0 +1 @@
|
||||
enable rippled.service
|
||||
171
pkgs/rpm/rippled.spec
Normal file
171
pkgs/rpm/rippled.spec
Normal file
@@ -0,0 +1,171 @@
|
||||
%global pkg_name %{getenv:repo_name}
|
||||
%global branch %{getenv:branch}
|
||||
%global commit %{getenv:commit}
|
||||
%global shortcommit %{getenv:shortcommit}
|
||||
%global date %{getenv:commit_date}
|
||||
%global conan_remote_name %{getenv:conan_remote_name}
|
||||
%global conan_remote_url %{getenv:conan_remote_url}
|
||||
%global shared_files %{getenv:shared_files}
|
||||
%global pkg_files %{getenv:pkg_files}
|
||||
%global build_type %{getenv:BUILD_TYPE}
|
||||
|
||||
%global _prefix /opt/ripple
|
||||
%global srcdir %{_builddir}/rippled
|
||||
%global blddir %{srcdir}/bld.rippled
|
||||
|
||||
%global xrpl_version %{getenv:xrpl_version}
|
||||
%global ver_base %(v=%{xrpl_version}; echo ${v%%-*})
|
||||
%global _has_dash %(v=%{xrpl_version}; [ "${v#*-}" != "$v" ] && echo 1 || echo 0)
|
||||
%if 0%{?_has_dash}
|
||||
%global ver_suffix %(v=%{xrpl_version}; printf %s "${v#*-}")
|
||||
%endif
|
||||
|
||||
Name: %{pkg_name}
|
||||
Version: %{ver_base}
|
||||
Release: %{?ver_suffix:0.%{ver_suffix}}%{!?ver_suffix:1}%{?dist}
|
||||
Summary: %{name} XRPL daemon
|
||||
|
||||
License: ISC
|
||||
URL: https://github.com/XRPLF/rippled
|
||||
Source0: rippled.tar.gz
|
||||
Patch0: rippled.patch
|
||||
%{warn:name=%{name}}
|
||||
%{warn:version=%{version}}
|
||||
%{warn:ver_base=%{ver_base}}
|
||||
%{warn:ver_suffix=%{ver_suffix}}
|
||||
%{warn:release=%{release}}
|
||||
%{warn:FullReleaseVersion=%{name}-%{version}-%{release}.%{_arch}.rpm}
|
||||
|
||||
%description
|
||||
%{name} with p2p server for the XRP Ledger.
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n %{name}
|
||||
|
||||
# TODO: Remove when version set with CMake.
|
||||
if [ %{branch} == 'develop' ]; then
|
||||
sed --in-place "s/versionString = \"\([^\"]*\)\"/versionString = \"\1+%{ver_input}\"/" src/libxrpl/protocol/BuildInfo.cpp
|
||||
fi
|
||||
|
||||
%build
|
||||
conan remote add --index 0 %{conan_remote_name} %{conan_remote_url} --force
|
||||
conan config install conan/profiles/default --target-folder $(conan config home)/profiles/
|
||||
echo "tools.build:jobs={{ os.cpu_count() - 2 }}" >> ${CONAN_HOME}/global.conf
|
||||
echo "core.download:parallel={{ os.cpu_count() }}" >> ${CONAN_HOME}/global.conf
|
||||
|
||||
conan install %{srcdir} \
|
||||
--settings:all build_type=%{build_type} \
|
||||
--output-folder %{srcdir}/conan_deps \
|
||||
--options:host "&:xrpld=True" \
|
||||
--options:host "&:tests=True" \
|
||||
--build=missing
|
||||
|
||||
cmake \
|
||||
-S %{srcdir} \
|
||||
-B %{blddir} \
|
||||
-Dxrpld=ON \
|
||||
-Dvalidator_keys=ON \
|
||||
-Dtests=ON \
|
||||
-DCMAKE_BUILD_TYPE:STRING=%{build_type} \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
|
||||
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|
||||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=%{srcdir}/conan_deps/build/generators/conan_toolchain.cmake
|
||||
|
||||
cmake \
|
||||
--build %{blddir} \
|
||||
--parallel %{_smp_build_ncpus} \
|
||||
--target rippled \
|
||||
--target validator-keys
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
DESTDIR=%{buildroot} cmake --install %{blddir}
|
||||
|
||||
install -Dm0755 %{shared_files}/update-rippled.sh %{buildroot}%{_bindir}/update-rippled.sh
|
||||
ln -s rippled %{buildroot}%{_bindir}/xrpld
|
||||
ln -s update-rippled.sh %{buildroot}%{_bindir}/update-xrpld.sh
|
||||
|
||||
# configs
|
||||
install -Dm0644 %{srcdir}/cfg/rippled-example.cfg %{buildroot}%{_prefix}/etc/rippled.cfg
|
||||
install -Dm0644 %{srcdir}/cfg/validators-example.txt %{buildroot}%{_prefix}/etc/validators.txt
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/opt/ripple
|
||||
|
||||
#/etc points to /opt
|
||||
ln -s ../../../opt/ripple/rippled.cfg %{buildroot}%{_sysconfdir}/opt/ripple/xrpld.cfg
|
||||
ln -s ../../../opt/ripple/etc/rippled.cfg %{buildroot}%{_sysconfdir}/opt/ripple/rippled.cfg
|
||||
ln -s ../../../opt/ripple/etc/validators.txt %{buildroot}%{_sysconfdir}/opt/ripple/validators.txt
|
||||
|
||||
# systemd/sysusers/tmpfiles
|
||||
install -Dm0644 %{shared_files}/rippled.service %{buildroot}%{_unitdir}/rippled.service
|
||||
install -Dm0644 %{pkg_files}/rippled.sysusers %{buildroot}%{_sysusersdir}/rippled.conf
|
||||
install -Dm0644 %{pkg_files}/rippled.tmpfiles %{buildroot}%{_tmpfilesdir}/rippled.conf
|
||||
|
||||
%files
|
||||
%license LICENSE*
|
||||
%doc README*
|
||||
|
||||
# Files/dirs the pkgs owns
|
||||
%dir %{_prefix}
|
||||
%dir %{_prefix}/bin
|
||||
%dir %{_prefix}/etc
|
||||
%if 0
|
||||
%dir %{_sysconfdir}/opt # Add this if rpmlint cries.
|
||||
%endif
|
||||
%dir %{_sysconfdir}/opt/ripple
|
||||
|
||||
# Binaries and symlinks under our (non-standard) _prefix (/opt/ripple)
|
||||
%{_bindir}/rippled
|
||||
%{_bindir}/xrpld
|
||||
%{_bindir}/update-rippled.sh
|
||||
%{_bindir}/update-xrpld.sh
|
||||
%{_bindir}/validator-keys
|
||||
|
||||
# We won't ship these but we'll create them.
|
||||
%ghost /usr/local/bin/rippled
|
||||
%ghost /usr/local/bin/xrpld
|
||||
|
||||
%config(noreplace) %{_prefix}/etc/rippled.cfg
|
||||
%config(noreplace) %{_prefix}/etc/validators.txt
|
||||
|
||||
%config(noreplace) %{_sysconfdir}/opt/ripple/rippled.cfg
|
||||
%config(noreplace) %{_sysconfdir}/opt/ripple/xrpld.cfg
|
||||
%config(noreplace) %{_sysconfdir}/opt/ripple/validators.txt
|
||||
|
||||
# systemd and service user creation
|
||||
%{_unitdir}/rippled.service
|
||||
%{_sysusersdir}/rippled.conf
|
||||
%{_tmpfilesdir}/rippled.conf
|
||||
|
||||
# Let tmpfiles create the db and log dirs
|
||||
%ghost %dir /var/opt/ripple
|
||||
%ghost %dir /var/opt/ripple/lib
|
||||
%ghost %dir /var/opt/ripple/log
|
||||
|
||||
# TODO: Fix the CMake install() calls so we don't need to exclude these.
|
||||
%exclude %{_prefix}/include/*
|
||||
%exclude %{_prefix}/lib/*
|
||||
%exclude %{_prefix}/lib/pkgconfig/*
|
||||
%exclude /usr/lib/debug/**
|
||||
|
||||
%post
|
||||
# Add a link to $PATH /usr/local/bin/rippled %{_bindir}/rippled (also non-standard)
|
||||
mkdir -p /usr/local/bin
|
||||
for i in rippled xrpld
|
||||
do
|
||||
if [ ! -e /usr/local/bin/${i} ]; then
|
||||
ln -s %{_bindir}/${i} /usr/local/bin/${i}
|
||||
elif [ -L /usr/local/bin/${i} ] && \
|
||||
[ "$(readlink -f /usr/local/bin/${i})" != "%{_bindir}/${i}" ]; then
|
||||
ln -sfn %{_bindir}/${i} /usr/local/bin/${i}
|
||||
fi
|
||||
done
|
||||
|
||||
%preun
|
||||
# remove the link only if it points to us (on erase, $1 == 0)
|
||||
for i in rippled xrpld
|
||||
do
|
||||
if [ "$1" -eq 0 ] && [ -L /usr/local/bin/${i} ] && \
|
||||
[ "$(readlink -f /usr/local/bin/${i})" = "%{_bindir}/${i}" ]; then
|
||||
rm -f /usr/local/bin/${i}
|
||||
fi
|
||||
done
|
||||
2
pkgs/rpm/rippled.sysusers
Normal file
2
pkgs/rpm/rippled.sysusers
Normal file
@@ -0,0 +1,2 @@
|
||||
u rippled - "System user for rippled service"
|
||||
g rippled - -
|
||||
2
pkgs/rpm/rippled.tmpfiles
Normal file
2
pkgs/rpm/rippled.tmpfiles
Normal file
@@ -0,0 +1,2 @@
|
||||
d /var/opt/ripple/lib 0750 rippled rippled -
|
||||
d /var/opt/ripple/log 0750 rippled adm -
|
||||
15
pkgs/shared/rippled-logrotate
Normal file
15
pkgs/shared/rippled-logrotate
Normal file
@@ -0,0 +1,15 @@
|
||||
/var/log/rippled/*.log {
|
||||
daily
|
||||
minsize 200M
|
||||
rotate 7
|
||||
nocreate
|
||||
missingok
|
||||
notifempty
|
||||
compress
|
||||
compresscmd /usr/bin/nice
|
||||
compressoptions -n19 ionice -c3 gzip
|
||||
compressext .gz
|
||||
postrotate
|
||||
/opt/ripple/bin/rippled --conf /opt/ripple/etc/rippled.cfg logrotate
|
||||
endscript
|
||||
}
|
||||
15
pkgs/shared/rippled.service
Normal file
15
pkgs/shared/rippled.service
Normal file
@@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=Ripple Daemon
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/opt/ripple/bin/rippled --net --silent --conf /etc/opt/ripple/rippled.cfg
|
||||
Restart=on-failure
|
||||
User=rippled
|
||||
Group=rippled
|
||||
LimitNOFILE=65536
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
10
pkgs/shared/update-rippled-cron
Normal file
10
pkgs/shared/update-rippled-cron
Normal file
@@ -0,0 +1,10 @@
|
||||
# For automatic updates, symlink this file to /etc/cron.d/
|
||||
# Do not remove the newline at the end of this cron script
|
||||
|
||||
# bash required for use of RANDOM below.
|
||||
SHELL=/bin/bash
|
||||
PATH=/sbin;/bin;/usr/sbin;/usr/bin
|
||||
|
||||
# invoke check/update script with random delay up to 59 mins
|
||||
0 * * * * root sleep $((RANDOM*3540/32768)) && /opt/ripple/bin/update-rippled.sh
|
||||
|
||||
65
pkgs/shared/update-rippled.sh
Executable file
65
pkgs/shared/update-rippled.sh
Executable file
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# auto-update script for rippled daemon
|
||||
|
||||
# Check for sudo/root permissions
|
||||
if [[ $(id -u) -ne 0 ]] ; then
|
||||
echo "This update script must be run as root or sudo"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOCKDIR=/tmp/rippleupdate.lock
|
||||
UPDATELOG=/var/log/rippled/update.log
|
||||
|
||||
function cleanup {
|
||||
# If this directory isn't removed, future updates will fail.
|
||||
rmdir $LOCKDIR
|
||||
}
|
||||
|
||||
# Use mkdir to check if process is already running. mkdir is atomic, as against file create.
|
||||
if ! mkdir $LOCKDIR 2>/dev/null; then
|
||||
echo $(date -u) "lockdir exists - won't proceed." >> $UPDATELOG
|
||||
exit 1
|
||||
fi
|
||||
trap cleanup EXIT
|
||||
|
||||
source /etc/os-release
|
||||
can_update=false
|
||||
|
||||
if [[ "$ID" == "ubuntu" || "$ID" == "debian" ]] ; then
|
||||
# Silent update
|
||||
apt-get update -qq
|
||||
|
||||
# The next line is an "awk"ward way to check if the package needs to be updated.
|
||||
RIPPLE=$(apt-get install -s --only-upgrade rippled | awk '/^Inst/ { print $2 }')
|
||||
test "$RIPPLE" == "rippled" && can_update=true
|
||||
|
||||
function apply_update {
|
||||
apt-get install rippled -qq
|
||||
}
|
||||
elif [[ "$ID" == "fedora" || "$ID" == "centos" || "$ID" == "rhel" || "$ID" == "scientific" ]] ; then
|
||||
RIPPLE_REPO=${RIPPLE_REPO-stable}
|
||||
yum --disablerepo=* --enablerepo=ripple-$RIPPLE_REPO clean expire-cache
|
||||
|
||||
yum check-update -q --enablerepo=ripple-$RIPPLE_REPO rippled || can_update=true
|
||||
|
||||
function apply_update {
|
||||
yum update -y --enablerepo=ripple-$RIPPLE_REPO rippled
|
||||
}
|
||||
else
|
||||
echo "unrecognized distro!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Do the actual update and restart the service after reloading systemctl daemon.
|
||||
if [ "$can_update" = true ] ; then
|
||||
exec 3>&1 1>>${UPDATELOG} 2>&1
|
||||
set -e
|
||||
apply_update
|
||||
systemctl daemon-reload
|
||||
systemctl restart rippled.service
|
||||
echo $(date -u) "rippled daemon updated."
|
||||
else
|
||||
echo $(date -u) "no updates available" >> $UPDATELOG
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user