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.

98 lines
4.1 KiB

  1. %define __spec_install_post %{nil}
  2. %define debug_package %{nil}
  3. %define __os_install_post %{nil}
  4. Name: basecoin
  5. Summary: basecoin is a Proof-of-Stake cryptocurrency and framework
  6. License: Apache 2.0
  7. URL: https://tendermint.com/
  8. Packager: Greg Szabo
  9. Requires: tendermint >= 0.10.0
  10. Provides: basecli
  11. Requires(pre): /sbin/useradd
  12. Requires(post): %{__python}
  13. %description
  14. Basecoin is an ABCI application designed to be used with the Tendermint consensus engine to form a Proof-of-Stake cryptocurrency. It also provides a general purpose framework for extending the feature-set of the cryptocurrency by implementing plugins.
  15. %pre
  16. if ! %{__grep} -q '^%{name}:' /etc/passwd ; then
  17. useradd -k /dev/null -r -m -b %{_sysconfdir} %{name}
  18. fi
  19. %prep
  20. test -d "$GOPATH" || echo "GOPATH not set"
  21. test -d "$GOPATH"
  22. %{__mkdir_p} %{name}-%{version}
  23. cd %{name}-%{version}
  24. %{__mkdir_p} .%{_bindir} .%{_defaultlicensedir}/%{name} .%{_sysconfdir}/%{name}/tendermint .%{_datadir}/%{name} .%{_sysconfdir}/systemd/system .%{_sysconfdir}/systemd/system-preset
  25. %{__cp} $GOPATH/bin/%{name} $GOPATH/bin/basecli .%{_bindir}
  26. %{__cp} $GOPATH/src/github.com/tendermint/%{name}/LICENSE .%{_defaultlicensedir}/%{name}
  27. %{__cp} %{_topdir}/extrafiles/%{name}/genesis.json .%{_sysconfdir}/%{name}/genesis.json
  28. %{__cp} %{_topdir}/extrafiles/%{name}/tendermint-config.toml .%{_sysconfdir}/%{name}/tendermint/config.toml
  29. %{__cp} %{_topdir}/extrafiles/%{name}/%{name}.service .%{_sysconfdir}/systemd/system/%{name}.service
  30. %{__cp} %{_topdir}/extrafiles/%{name}/%{name}-server.service .%{_sysconfdir}/systemd/system/%{name}-server.service
  31. %{__cp} %{_topdir}/extrafiles/%{name}/50-%{name}.preset .%{_sysconfdir}/systemd/system-preset/50-%{name}.preset
  32. %{__cp} %{_topdir}/extrafiles/%{name}/key.json .%{_datadir}/%{name}/key.json
  33. %{__cp} %{_topdir}/extrafiles/%{name}/key2.json .%{_datadir}/%{name}/key2.json
  34. %{__chmod} -Rf a+rX,u+w,g-w,o-w .
  35. %build
  36. # Nothing to do here.
  37. %install
  38. cd %{name}-%{version}
  39. %{__cp} -a * %{buildroot}
  40. %post
  41. test ! -f %{_sysconfdir}/%{name}/priv_validator.json && tendermint gen_validator > %{_sysconfdir}/%{name}/priv_validator.json && %{__chmod} 0400 %{_sysconfdir}/%{name}/priv_validator.json && %{__chown} %{name}.%{name} %{_sysconfdir}/%{name}/priv_validator.json
  42. test ! -f %{_sysconfdir}/%{name}/tendermint/priv_validator.json && tendermint gen_validator > %{_sysconfdir}/%{name}/tendermint/priv_validator.json && %{__chmod} 0400 %{_sysconfdir}/%{name}/tendermint/priv_validator.json && %{__chown} %{name}.%{name} %{_sysconfdir}/%{name}/tendermint/priv_validator.json
  43. tendermint_pubkey=`%{__python} -uc "import json ; print json.loads(open('%{_sysconfdir}/%{name}/tendermint/priv_validator.json').read())['pub_key']['data']"`
  44. test ! -f %{_sysconfdir}/%{name}/tendermint/genesis.json && %{__cat} << EOF > %{_sysconfdir}/%{name}/tendermint/genesis.json
  45. {
  46. "genesis_time": "2017-06-10T03:37:03Z",
  47. "chain_id": "my_chain_id",
  48. "validators":
  49. [
  50. {
  51. "pub_key":{"type":"ed25519","data":"$tendermint_pubkey"},
  52. "amount":10,
  53. "name":"my_testchain_node"
  54. }
  55. ],
  56. "app_hash": "",
  57. "app_options": {}
  58. }
  59. EOF
  60. %{__chown} %{name}.%{name} %{_sysconfdir}/%{name}/tendermint/genesis.json
  61. systemctl daemon-reload
  62. systemctl enable %{name}
  63. %preun
  64. systemctl stop %{name} 2> /dev/null || :
  65. systemctl stop %{name}-service 2> /dev/null || :
  66. %postun
  67. systemctl daemon-reload
  68. %files
  69. %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}
  70. #%ghost %attr(0400, %{name}, %{name}) %{_sysconfdir}/%{name}/priv_validator.json
  71. %config(noreplace) %attr(0644, %{name}, %{name}) %{_sysconfdir}/%{name}/genesis.json
  72. %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}/tendermint
  73. #%ghost %attr(0400, %{name}, %{name}) %{_sysconfdir}/%{name}/tendermint/priv_validator.json
  74. %config(noreplace) %attr(0644, %{name}, %{name}) %{_sysconfdir}/%{name}/tendermint/config.toml
  75. #%ghost %attr(0644, %{name}, %{name}) %{_sysconfdir}/%{name}/tendermint/genesis.json
  76. %{_bindir}/*
  77. %{_sysconfdir}/systemd/system/*
  78. %{_sysconfdir}/systemd/system-preset/*
  79. %dir %{_datadir}/%{name}
  80. %{_datadir}/%{name}/*
  81. %dir %{_defaultlicensedir}/%{name}
  82. %doc %{_defaultlicensedir}/%{name}/LICENSE