-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
29: Adding rpm build capability and CI publish to release r=sacherjj a=sacherjj Co-authored-by: Joe Sacher <[email protected]>
- Loading branch information
Showing
8 changed files
with
171 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
BuildRequires: systemd-rpm-macros | ||
Requires: curl | ||
%define __spec_install_post %{nil} | ||
%define __os_install_post %{_dbpath}/brp-compress | ||
%define debug_package %{nil} | ||
|
||
Name: casper-node-launcher | ||
Summary: A binary which runs and upgrades the casper-node of the Casper network | ||
Version: @@VERSION@@ | ||
Release: @@RELEASE@@%{?dist} | ||
License: CasperLabs Open Source License (COSL) | ||
Group: Applications/System | ||
Source0: %{name}-%{version}.tar.gz | ||
URL: https://casperlabs.io | ||
|
||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root | ||
|
||
%description | ||
%{summary} | ||
|
||
%prep | ||
%setup -q | ||
|
||
%pre | ||
# Default Variables | ||
# --- | ||
DEFAULT_USERNAME="casper" | ||
DEFAULT_CONFIG_DIRECTORY="/etc/${DEFAULT_USERNAME}" | ||
DEFAULT_DATA_DIRECTORY="/var/lib/${DEFAULT_USERNAME}/bin" | ||
DEFAULT_LOG_DIRECOTRY="/var/log/${DEFAULT_USERNAME}" | ||
|
||
# Creation of Files/Directories | ||
# --- | ||
# Assure DEFAULT_DATA_DIRECTORY is available for state data | ||
if [ -d ${DEFAULT_DATA_DIRECTORY} ] ; then | ||
echo "Directory ${DEFAULT_DATA_DIRECTORY} already exists." | ||
else | ||
mkdir -p ${DEFAULT_DATA_DIRECTORY} | ||
fi | ||
|
||
# Assure DEFAULT_CONFIG_DIRECTORY is available for config data | ||
if [ -d ${DEFAULT_CONFIG_DIRECTORY} ] ; then | ||
echo "Directory ${DEFAULT_CONFIG_DIRECTORY} already exists." | ||
else | ||
mkdir -p ${DEFAULT_CONFIG_DIRECTORY} | ||
fi | ||
|
||
# Assure DEFAULT_LOG_DIRECOTRY is available for logging | ||
if [ -d ${DEFAULT_LOG_DIRECOTRY} ] ; then | ||
echo "Directory ${DEFAULT_LOG_DIRECOTRY} already exists." | ||
else | ||
mkdir -p ${DEFAULT_LOG_DIRECOTRY} | ||
fi | ||
exit 0 | ||
|
||
%post | ||
# Default Variables | ||
# --- | ||
DEFAULT_USERNAME="casper" | ||
DEFAULT_CONFIG_DIRECTORY="/etc/${DEFAULT_USERNAME}" | ||
DEFAULT_DATA_DIRECTORY="/var/lib/${DEFAULT_USERNAME}" | ||
DEFAULT_LOG_DIRECOTRY="/var/log/${DEFAULT_USERNAME}" | ||
|
||
# User Creation | ||
# --- | ||
# Assure DEFAULT_USERNAME user exists | ||
getent group casper >/dev/null || groupadd -r casper | ||
getent passwd casper >/dev/null || \ | ||
useradd -r -g casper -s /sbin/nologin \ | ||
-c "User for running casper-node-launcher" casper | ||
|
||
# Take ownership of directories and files installed | ||
chown -R ${DEFAULT_USERNAME}:${DEFAULT_USERNAME} ${DEFAULT_DATA_DIRECTORY} | ||
chown -R ${DEFAULT_USERNAME}:${DEFAULT_USERNAME} ${DEFAULT_CONFIG_DIRECTORY} | ||
chown -R ${DEFAULT_USERNAME}:${DEFAULT_USERNAME} ${DEFAULT_LOG_DIRECOTRY} | ||
|
||
# Update systemd for unit file | ||
systemctl daemon-reload | ||
|
||
exit 0 | ||
|
||
|
||
%install | ||
rm -rf %{buildroot} | ||
mkdir -p %{buildroot} | ||
cp -a * %{buildroot} | ||
|
||
%clean | ||
rm -rf %{buildroot} | ||
|
||
%files | ||
%defattr(-,casper,casper,-) | ||
%{_bindir}/* | ||
/var/lib/casper/bin/README.md | ||
/etc/logrotate.d/casper-node | ||
/etc/casper/PLATFORM | ||
/etc/casper/pull_casper_node_version.sh | ||
/etc/casper/network_configs/casper.conf | ||
/etc/casper/network_configs/casper-test.conf | ||
/etc/casper/delete_local_db.sh | ||
/etc/casper/config_from_example.sh | ||
/etc/casper/README.md | ||
/etc/casper/validator_keys/README.md | ||
/etc/systemd/system/casper-node-launcher.service |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
[package] | ||
name = "casper-node-launcher" | ||
version = "0.3.3" | ||
version = "0.3.4" | ||
authors = ["Fraser Hutchison <[email protected]>", "Joe Sacher <[email protected]>"] | ||
edition = "2018" | ||
description = "A binary which runs and upgrades the casper-node of the Casper network" | ||
readme = "README.md" | ||
documentation = "https://docs.rs/casper-node-launcher" | ||
homepage = "https://casperlabs.io" | ||
homepage = "https://casper.network" | ||
repository = "https://github.com/CasperLabs/casper-node/tree/master/client" | ||
license-file = "./LICENSE" | ||
|
||
|
@@ -35,11 +35,12 @@ assets = [ | |
["./target/release/casper-node-launcher", "/usr/bin/casper-node-launcher", "755"], | ||
["./resources/BIN_README.md", "/var/lib/casper/bin/README.md", "755"], | ||
["./resources/maintainer_scripts/logrotate.d/casper-node", "/etc/logrotate.d/casper-node", "644"], | ||
["./resources/PLATFORM_DEB", "/etc/casper/PLATFORM", "644"], | ||
["./resources/maintainer_scripts/pull_casper_node_version.sh", "/etc/casper/pull_casper_node_version.sh", "755"], | ||
["./resources/maintainer_scripts/network_configs/*", "/etc/casper/network_configs/", "644"], | ||
["./resources/maintainer_scripts/delete_local_db.sh", "/etc/casper/delete_local_db.sh", "755"], | ||
["./resources/maintainer_scripts/config_from_example.sh", "/etc/casper/config_from_example.sh", "755"], | ||
["./resources/DEB_README.md", "/etc/casper/README.md", "644"], | ||
["./resources/ETC_README.md", "/etc/casper/README.md", "644"], | ||
["./resources/VALIDATOR_KEYS_README.md", "/etc/casper/validator_keys/README.md", "644"] | ||
] | ||
maintainer-scripts = "./resources/maintainer_scripts/debian" | ||
|
@@ -52,3 +53,27 @@ For information on using package, see https://github.com/CasperLabs/casper-node- | |
[package.metadata.deb.systemd-units] | ||
unit-scripts = "./resources/maintainer_scripts/casper_node_launcher" | ||
restart-after-upgrade = false | ||
|
||
[package.metadata.rpm] | ||
package = "casper-node-launcher" | ||
|
||
[package.metadata.rpm.cargo] | ||
buildflags = ["--release"] | ||
|
||
[package.metadata.rpm.systemd-units] | ||
unit-scripts = "./resources/maintainer_scripts/casper_node_launcher" | ||
restart-after-upgrade = false | ||
|
||
[package.metadata.rpm.targets] | ||
casper-node-launcher = { path = "/usr/bin/casper-node-launcher" } | ||
"../../resources/BIN_README.md" = {path = "/var/lib/casper/bin/README.md"} | ||
"../../resources/PLATFORM_RPM" = {path = "/etc/casper/PLATFORM"} | ||
"../../resources/maintainer_scripts/logrotate.d/casper-node" = {path = "/etc/logrotate.d/casper-node"} | ||
"../../resources/maintainer_scripts/pull_casper_node_version.sh" = {path = "/etc/casper/pull_casper_node_version.sh"} | ||
"../../resources/maintainer_scripts/network_configs/casper.conf" = {path = "/etc/casper/network_configs/casper.conf"} | ||
"../../resources/maintainer_scripts/network_configs/casper-test.conf" = {path = "/etc/casper/network_configs/casper-test.conf"} | ||
"../../resources/maintainer_scripts/delete_local_db.sh" = {path = "/etc/casper/delete_local_db.sh"} | ||
"../../resources/maintainer_scripts/config_from_example.sh" = {path = "/etc/casper/config_from_example.sh"} | ||
"../../resources/ETC_README.md" = {path = "/etc/casper/README.md"} | ||
"../../resources/VALIDATOR_KEYS_README.md" = {path = "/etc/casper/validator_keys/README.md"} | ||
"../../resources/maintainer_scripts/casper_node_launcher/casper-node-launcher.service" = {path = "/etc/systemd/system/casper-node-launcher.service"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rpm |