diff --git a/devops/rpmbuild/Makefile b/devops/rpmbuild/Makefile index c6964a1f5..0dab10846 100644 --- a/devops/rpmbuild/Makefile +++ b/devops/rpmbuild/Makefile @@ -34,83 +34,81 @@ endif binaries = tendermint basecoin ethermint build-binaries = build-tendermint build-basecoin build-ethermint -package-binaries = package-tendermint package-basecoin package-ethermint -install-binaries = install-tendermint install-basecoin install-ethermint +package-rpm = package-rpm-tendermint package-rpm-basecoin package-rpm-ethermint +install-rpm = install-rpm-tendermint install-rpm-basecoin install-rpm-ethermint +package-deb = package-deb-tendermint package-deb-basecoin package-deb-ethermint +install-deb = install-deb-tendermint install-deb-basecoin install-deb-ethermint all: $(binaries) build: $(build-binaries) -package: $(package-binaries) -install: $(install-binaries) -$(binaries): %: build-% package-% install-% ; +package: $(package-rpm) $(package-deb) +install: $(install-rpm) $(install-deb) +$(binaries): %: build-% package-rpm-% install-rpm-% package-deb-% install-deb-% ; ### # Building the binaries is not in the spec file, because in the spec file you already need to know the version number ### build-tendermint: - $(info Building tendermint) + @echo "*** Building tendermint" go get -u github.com/tendermint/tendermint/cmd/tendermint + @echo "*** Built tendermint" build-basecoin: - $(info Building basecoin) + @echo "*** Building basecoin" go get -u github.com/tendermint/basecoin/cmd/basecoin - $(info Building basecli) + @echo "Building basecli" + $(MAKE) -C $(GOPATH)/src/github.com/tendermint/basecoin get_vendor_deps go get -u github.com/tendermint/basecoin/cmd/basecli + @echo "*** Built basecoin" build-ethermint: - $(info Building ethermint) + @echo "*** Building ethermint" go get -d -u github.com/tendermint/ethermint/cmd/ethermint $(MAKE) -C $(GOPATH)/src/github.com/tendermint/ethermint get_vendor_deps $(MAKE) -C $(GOPATH)/src/github.com/tendermint/ethermint build cp $(GOPATH)/src/github.com/tendermint/ethermint/build/ethermint $(GOPATH)/bin + @echo "*** Built ethermint" -prepare-spec-%: $(GOPATH)/bin/% - $(info Preparing build for $*) +version-%: $(GOPATH)/bin/% if [ -z "$(BUILD_NUMBER)" ]; then echo "BUILD_NUMBER not set" ; false ; fi - mkdir -p {SPECS,tmp} $(eval $*_version=$(shell $< version | cut -d- -f1 )) + +prepare-spec-%: version-% + mkdir -p {SPECS,tmp} echo "Version: $($*_version)" > SPECS/$*.spec echo "Release: $(BUILD_NUMBER)" >> SPECS/$*.spec cat spectemplates/$*.spec >> SPECS/$*.spec -package-tendermint: prepare-spec-tendermint - $(info Packaging tendermint version $(tendermint_version)) - rpmbuild -bb SPECS/tendermint.spec - ./sign RPMS/x86_64/tendermint-$(tendermint_version)-$$BUILD_NUMBER.x86_64.rpm - rpm -Kv RPMS/x86_64/tendermint-$(tendermint_version)-$$BUILD_NUMBER.x86_64.rpm - -package-basecoin: prepare-spec-basecoin - $(info Packaging basecoin version $(basecoin_version)) - rpmbuild -bb SPECS/basecoin.spec - ./sign RPMS/x86_64/basecoin-$(basecoin_version)-$$BUILD_NUMBER.x86_64.rpm - rpm -Kv RPMS/x86_64/basecoin-$(basecoin_version)-$$BUILD_NUMBER.x86_64.rpm - -package-ethermint: prepare-spec-ethermint ; - $(info Packaging ethermint version $(ethermint_version)) - rpmbuild -bb SPECS/ethermint.spec - ./sign RPMS/x86_64/ethermint-$(ethermint_version)-$$BUILD_NUMBER.x86_64.rpm - rpm -Kv RPMS/x86_64/ethermint-$(ethermint_version)-$$BUILD_NUMBER.x86_64.rpm - -package-debian-tendermint: package-tendermint - $(info Packaging Debian tendermint version $(tendermint_version)-$(BUILD_NUMBER)) - rm -rf BUILD/tendermint-$(tendermint_version)-$(BUILD_NUMBER) tmp/_gpg tmp/_gpgbuilder tmp/debian-binary tmp/control.tar.gz tmp/data.tar.xz - cp -r BUILD/tendermint-$(tendermint_version) BUILD/tendermint-$(tendermint_version)-$(BUILD_NUMBER) - - cp -r extrafiles/DEBIAN BUILD/tendermint-$(tendermint_version)-$(BUILD_NUMBER)/ - sed -i "s/@TENDERMINT_VERSION@/$(tendermint_version)-$(BUILD_NUMBER)/" BUILD/tendermint-$(tendermint_version)-$(BUILD_NUMBER)/DEBIAN/changelog - sed -i "s/@STABILITY@/stable/" BUILD/tendermint-$(tendermint_version)-$(BUILD_NUMBER)/DEBIAN/changelog - sed -i "s/@DATETIMESTAMP@/`date +%a,\ %d\ %b\ %Y\ %T\ %z`/" BUILD/tendermint-$(tendermint_version)-$(BUILD_NUMBER)/DEBIAN/changelog - sed -i "s/@TENDERMINT_VERSION@/$(tendermint_version)-$(BUILD_NUMBER)/" BUILD/tendermint-$(tendermint_version)-$(BUILD_NUMBER)/DEBIAN/control - - rm -rf BUILD/tendermint-$(tendermint_version)-$(BUILD_NUMBER)/usr/share/licenses - mkdir -p BUILD/tendermint-$(tendermint_version)-$(BUILD_NUMBER)/usr/share/doc/tendermint - cp BUILD/tendermint-$(tendermint_version)-$(BUILD_NUMBER)/DEBIAN/copyright BUILD/tendermint-$(tendermint_version)-$(BUILD_NUMBER)/usr/share/doc/tendermint - gzip -c BUILD/tendermint-$(tendermint_version)-$(BUILD_NUMBER)/DEBIAN/changelog > BUILD/tendermint-$(tendermint_version)-$(BUILD_NUMBER)/usr/share/doc/tendermint/changelog.Debian.gz - gzip -c BUILD/tendermint-$(tendermint_version)-$(BUILD_NUMBER)/DEBIAN/changelog > BUILD/tendermint-$(tendermint_version)-$(BUILD_NUMBER)/usr/share/doc/tendermint/changelog.Debian.amd64.gz - - sed -i "s/@INSTALLEDSIZE@/`du -ks BUILD/tendermint-$(tendermint_version)-$(BUILD_NUMBER) | cut -f 1`/" BUILD/tendermint-$(tendermint_version)-$(BUILD_NUMBER)/DEBIAN/control - cd BUILD/tendermint-$(tendermint_version)-$(BUILD_NUMBER) && tar --owner=root --group=root -cvJf ../../tmp/data.tar.xz --exclude DEBIAN * - cd BUILD/tendermint-$(tendermint_version)-$(BUILD_NUMBER)/DEBIAN && tar --owner=root --group=root -cvzf ../../../tmp/control.tar.gz * +package-rpm-%: prepare-spec-% + @echo "*** Packaging RPM $* version $($*_version)" + rpmbuild -bb SPECS/$*.spec + ./sign RPMS/x86_64/$*-$($*_version)-$(BUILD_NUMBER).x86_64.rpm + rpm -Kv RPMS/x86_64/$*-$($*_version)-$(BUILD_NUMBER).x86_64.rpm + @echo "*** Packaged RPM $* version $($*_version)" + +package-deb-%: version-% + @echo "*** Packaging DEB $* version $($*_version)-$(BUILD_NUMBER)" + echo "BUILD/$*-$($*_version) folder is generated by package-rpm-$*" + test -d BUILD/$*-$($*_version) + rm -rf BUILD/$*-$($*_version)-$(BUILD_NUMBER) tmp/_gpg tmp/_gpgbuilder tmp/debian-binary tmp/control.tar.gz tmp/data.tar.xz + cp -r BUILD/$*-$($*_version) BUILD/$*-$($*_version)-$(BUILD_NUMBER) + + cp -r extrafiles/DEBIAN-$* BUILD/$*-$($*_version)-$(BUILD_NUMBER)/DEBIAN + sed -i "s/@VERSION@/$($*_version)-$(BUILD_NUMBER)/" BUILD/$*-$($*_version)-$(BUILD_NUMBER)/DEBIAN/changelog + sed -i "s/@STABILITY@/stable/" BUILD/$*-$($*_version)-$(BUILD_NUMBER)/DEBIAN/changelog + sed -i "s/@DATETIMESTAMP@/`date +%a,\ %d\ %b\ %Y\ %T\ %z`/" BUILD/$*-$($*_version)-$(BUILD_NUMBER)/DEBIAN/changelog + sed -i "s/@VERSION@/$($*_version)-$(BUILD_NUMBER)/" BUILD/$*-$($*_version)-$(BUILD_NUMBER)/DEBIAN/control + + rm -rf BUILD/$*-$($*_version)-$(BUILD_NUMBER)/usr/share/licenses + mkdir -p BUILD/$*-$($*_version)-$(BUILD_NUMBER)/usr/share/doc/$* + cp BUILD/$*-$($*_version)-$(BUILD_NUMBER)/DEBIAN/copyright BUILD/$*-$($*_version)-$(BUILD_NUMBER)/usr/share/doc/$* + gzip -c BUILD/$*-$($*_version)-$(BUILD_NUMBER)/DEBIAN/changelog > BUILD/$*-$($*_version)-$(BUILD_NUMBER)/usr/share/doc/$*/changelog.Debian.gz + gzip -c BUILD/$*-$($*_version)-$(BUILD_NUMBER)/DEBIAN/changelog > BUILD/$*-$($*_version)-$(BUILD_NUMBER)/usr/share/doc/$*/changelog.Debian.amd64.gz + + sed -i "s/@INSTALLEDSIZE@/`du -ks BUILD/$*-$($*_version)-$(BUILD_NUMBER) | cut -f 1`/" BUILD/$*-$($*_version)-$(BUILD_NUMBER)/DEBIAN/control + cd BUILD/$*-$($*_version)-$(BUILD_NUMBER) && tar --owner=root --group=root -cvJf ../../tmp/data.tar.xz --exclude DEBIAN * + cd BUILD/$*-$($*_version)-$(BUILD_NUMBER)/DEBIAN && tar --owner=root --group=root -cvzf ../../../tmp/control.tar.gz * echo "2.0" > tmp/debian-binary cp extrafiles/_gpg tmp/ @@ -126,46 +124,73 @@ package-debian-tendermint: package-tendermint cd tmp && sed -i "s/@DATSIZE@/`stat -c %s data.tar.xz | cut -d\ -f1`/" _gpg gpg --batch --passphrase "$(GPG_PASSPHRASE)" --clearsign tmp/_gpg mv tmp/_gpg.asc tmp/_gpgbuilder - ar r tmp/tendermint-$(tendermint_version)-$(BUILD_NUMBER)_amd64.deb tmp/debian-binary tmp/control.tar.gz tmp/data.tar.xz tmp/_gpgbuilder - mv tmp/tendermint-$(tendermint_version)-$(BUILD_NUMBER)_amd64.deb RPMS/ + ar r tmp/$*-$($*_version)-$(BUILD_NUMBER)_amd64.deb tmp/debian-binary tmp/control.tar.gz tmp/data.tar.xz tmp/_gpgbuilder + mv tmp/$*-$($*_version)-$(BUILD_NUMBER)_amd64.deb RPMS/ rm tmp/debian-binary tmp/control.tar.gz tmp/data.tar.xz tmp/_gpgbuilder tmp/_gpg + @echo "*** Packaged DEB $* version $($*_version)-$(BUILD_NUMBER)" -install-%: +install-rpm-%: version-% #Make sure your host has the IAM role to read/write the S3 bucket OR that you set up ~/.boto + @echo "*** Uploading $*-$($*_version)-$(BUILD_NUMBER).x86_64.rpm to AWS CentOS repository" aws s3 sync s3://tendermint-packages/centos/ tmp/s3/ mkdir -p tmp/s3/7/os/x86_64/Packages - cp -r RPMS/x86_64/$** tmp/s3/7/os/x86_64/Packages + cp RPMS/x86_64/$*-$($*_version)-$(BUILD_NUMBER).x86_64.rpm tmp/s3/7/os/x86_64/Packages cp repofiles/RPM-GPG-KEY-Tendermint tmp/s3/7/os/x86_64/ cp repofiles/tendermint.repo tmp/s3/7/os/x86_64/ - createrepo tmp/s3/7/os/x86_64/Packages -u http://tendermint-packages.s3-website-us-west-1.amazonaws.com/centos/7/os/x86_64/Packages -o tmp/s3/7/os/x86_64 --update -S --repo Tendermint --content tendermint --content basecoin --content ethermint + rm -rf tmp/s3/7/os/x86_64/repodata rm -f tmp/s3/7/os/x86_64/repodata/repomd.xml.asc + createrepo tmp/s3/7/os/x86_64/Packages -u http://tendermint-packages.s3-website-us-west-1.amazonaws.com/centos/7/os/x86_64/Packages -o tmp/s3/7/os/x86_64 --update -S --repo Tendermint --content tendermint --content basecoin --content ethermint gpg --batch --passphrase "$(GPG_PASSPHRASE)" --sign -a tmp/s3/7/os/x86_64/repodata/repomd.xml aws s3 sync tmp/s3/ s3://tendermint-packages/centos/ --acl public-read + @echo "*** Uploaded $* to AWS CentOS repository" -install-debian-tendermint: prepare-spec-tendermint -#Prereq: package-debian-tendermint +install-deb-%: version-% + @echo "*** Uploading $*-$($*_version)-$(BUILD_NUMBER)_amd64.deb to AWS Debian repository" + @echo "Testing if $*-$($*_version)-$(BUILD_NUMBER)_amd64.deb is already uploaded" + test ! -f tmp/debian-s3/pool/$*-$($*_version)-$(BUILD_NUMBER)_amd64.deb aws s3 sync s3://tendermint-packages/debian/ tmp/debian-s3/ + @echo "Testing if $*-$($*_version)-$(BUILD_NUMBER)_amd64.deb is already uploaded" + test ! -f tmp/debian-s3/pool/$*-$($*_version)-$(BUILD_NUMBER)_amd64.deb mkdir -p tmp/debian-s3/pool tmp/debian-s3/dists/stable/main/binary-amd64 - cp RPMS/tendermint-$(tendermint_version)-$(BUILD_NUMBER)_amd64.deb tmp/debian-s3/pool + cp RPMS/$*-$($*_version)-$(BUILD_NUMBER)_amd64.deb tmp/debian-s3/pool cp repofiles/Release_amd64 tmp/debian-s3/dists/stable/main/binary-amd64/Release -#Package.gz - test -f tmp/debian-s3/dists/stable/main/binary-amd64/Packages.gz && gunzip tmp/debian-s3/dists/stable/main/binary-amd64/Packages.gz || rm -f tmp/debian-s3/dists/stable/main/binary-amd64/Package + #Packages / Packages.gz echo > tmp/Package - echo "Filename: pool/tendermint-$(tendermint_version)-$(BUILD_NUMBER)_amd64.deb" >> tmp/Package - echo "MD5sum: `md5sum RPMS/tendermint-$(tendermint_version)-$(BUILD_NUMBER)_amd64.deb | cut -d\ -f 1`" >> tmp/Package - echo "SHA1: `sha1sum RPMS/tendermint-$(tendermint_version)-$(BUILD_NUMBER)_amd64.deb | cut -d\ -f 1`" >> tmp/Package - echo "SHA256: `sha256sum RPMS/tendermint-$(tendermint_version)-$(BUILD_NUMBER)_amd64.deb | cut -d\ -f 1`" >> tmp/Package - echo "Size: `stat -c %s RPMS/tendermint-$(tendermint_version)-$(BUILD_NUMBER)_amd64.deb | cut -d\ -f 1`" >> tmp/Package - cat BUILD/tendermint-$(tendermint_version)-$(BUILD_NUMBER)/DEBIAN/control >> tmp/Package + echo "Filename: pool/$*-$($*_version)-$(BUILD_NUMBER)_amd64.deb" >> tmp/Package + echo "MD5sum: `md5sum RPMS/$*-$($*_version)-$(BUILD_NUMBER)_amd64.deb | cut -d\ -f 1`" >> tmp/Package + echo "SHA1: `sha1sum RPMS/$*-$($*_version)-$(BUILD_NUMBER)_amd64.deb | cut -d\ -f 1`" >> tmp/Package + echo "SHA256: `sha256sum RPMS/$*-$($*_version)-$(BUILD_NUMBER)_amd64.deb | cut -d\ -f 1`" >> tmp/Package + echo "Size: `stat -c %s RPMS/$*-$($*_version)-$(BUILD_NUMBER)_amd64.deb | cut -d\ -f 1`" >> tmp/Package + cat BUILD/$*-$($*_version)-$(BUILD_NUMBER)/DEBIAN/control >> tmp/Package cat tmp/Package >> tmp/debian-s3/dists/stable/main/binary-amd64/Packages - gzip tmp/debian-s3/dists/stable/main/binary-amd64/Packages + rm -f tmp/debian-s3/dists/stable/main/binary-amd64/Packages.gz + gzip -c tmp/debian-s3/dists/stable/main/binary-amd64/Packages > tmp/debian-s3/dists/stable/main/binary-amd64/Packages.gz rm -f tmp/Package -#Release / InRelease / Release.gpg - cp repofiles/Release tmp/debian-s3/dists/stable + #main / Release / InRelease / Release.gpg + + cp repofiles/Release tmp/debian-s3/dists/stable/main/Release + rm -f tmp/debian-s3/dists/stable/main/InRelease + rm -f tmp/debian-s3/dists/stable/main/Release.gpg + + echo "MD5Sum:" >> tmp/debian-s3/dists/stable/main/Release + cd tmp/debian-s3/dists/stable/main && for f in `find . -type f | sed 's/^.\///'` ; do test "$$f" == "Release" && continue ; echo -n " " ; md5sum $$f | sed "s/ / `stat -c %s $$f` /" ; done >> Release + echo "SHA1:" >> tmp/debian-s3/dists/stable/main/Release + cd tmp/debian-s3/dists/stable/main && for f in `find . -type f | sed 's/^.\///'` ; do test "$$f" == "Release" && continue ; echo -n " " ; sha1sum $$f | sed "s/ / `stat -c %s $$f` /" ; done >> Release + echo "SHA256:" >> tmp/debian-s3/dists/stable/main/Release + cd tmp/debian-s3/dists/stable/main && for f in `find . -type f | sed 's/^.\///'` ; do test "$$f" == "Release" && continue ; echo -n " " ; sha256sum $$f | sed "s/ / `stat -c %s $$f` /" ; done >> Release + + gpg --batch --passphrase "$(GPG_PASSPHRASE)" --digest-algo SHA256 -b -a tmp/debian-s3/dists/stable/main/Release + mv tmp/debian-s3/dists/stable/main/Release.asc tmp/debian-s3/dists/stable/main/Release.gpg + gpg --batch --passphrase "$(GPG_PASSPHRASE)" --digest-algo SHA512 --clearsign tmp/debian-s3/dists/stable/main/Release + mv tmp/debian-s3/dists/stable/main/Release.asc tmp/debian-s3/dists/stable/main/InRelease + + #stable / Release / InRelease / Release.gpg + + cp repofiles/Release tmp/debian-s3/dists/stable/Release rm -f tmp/debian-s3/dists/stable/InRelease rm -f tmp/debian-s3/dists/stable/Release.gpg @@ -182,6 +207,7 @@ install-debian-tendermint: prepare-spec-tendermint mv tmp/debian-s3/dists/stable/Release.asc tmp/debian-s3/dists/stable/InRelease aws s3 sync tmp/debian-s3/ s3://tendermint-packages/debian/ --acl public-read + @echo "*** Uploaded $*-$($*_version)-$(BUILD_NUMBER)_amd64.deb to AWS Debian repository" mostlyclean: rm -rf {BUILDROOT,SOURCES,SPECS,SRPMS,tmp} diff --git a/devops/rpmbuild/extrafiles/DEBIAN-basecoin/changelog b/devops/rpmbuild/extrafiles/DEBIAN-basecoin/changelog new file mode 100644 index 000000000..e316bcd35 --- /dev/null +++ b/devops/rpmbuild/extrafiles/DEBIAN-basecoin/changelog @@ -0,0 +1,6 @@ +basecoin (@VERSION@) @STABILITY@; urgency=medium + + * Automatic build. See https://github.com/tendermint/basecoin for more information. + + -- Greg Szabo @DATETIMESTAMP@ + diff --git a/devops/rpmbuild/extrafiles/DEBIAN/compat b/devops/rpmbuild/extrafiles/DEBIAN-basecoin/compat similarity index 100% rename from devops/rpmbuild/extrafiles/DEBIAN/compat rename to devops/rpmbuild/extrafiles/DEBIAN-basecoin/compat diff --git a/devops/rpmbuild/extrafiles/DEBIAN-basecoin/control b/devops/rpmbuild/extrafiles/DEBIAN-basecoin/control new file mode 100644 index 000000000..7d86a71b5 --- /dev/null +++ b/devops/rpmbuild/extrafiles/DEBIAN-basecoin/control @@ -0,0 +1,15 @@ +Source: basecoin +Section: net +Priority: optional +Maintainer: Greg Szabo +Build-Depends: debhelper (>=9) +Depends: tendermint (>=0.10.0) +Standards-Version: 3.9.6 +Homepage: https://tendermint.com +Package: basecoin +Architecture: amd64 +Version: @VERSION@ +Installed-Size: @INSTALLEDSIZE@ +Description: basecoin is a Proof-of-Stake cryptocurrency and framework + 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. + diff --git a/devops/rpmbuild/extrafiles/DEBIAN-basecoin/copyright b/devops/rpmbuild/extrafiles/DEBIAN-basecoin/copyright new file mode 100644 index 000000000..22340c79a --- /dev/null +++ b/devops/rpmbuild/extrafiles/DEBIAN-basecoin/copyright @@ -0,0 +1,21 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: basecoin +Source: https://github.com/tendermint/basecoin + +Files: * +Copyright: 2017 All In Bits, Inc. +License: Apache-2.0 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + . + http://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + . + On Debian systems, the full text of the Apache License 2.0 can be found + in the file `/usr/share/common-licenses/Apache-2.0'. diff --git a/devops/rpmbuild/extrafiles/DEBIAN-basecoin/postinst b/devops/rpmbuild/extrafiles/DEBIAN-basecoin/postinst new file mode 100644 index 000000000..cf7250e1b --- /dev/null +++ b/devops/rpmbuild/extrafiles/DEBIAN-basecoin/postinst @@ -0,0 +1,64 @@ +#!/bin/sh +# postinst script for basecoin +# + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + configure) + chown basecoin.basecoin /etc/basecoin + chown basecoin.basecoin /etc/basecoin/genesis.json + chown basecoin.basecoin /etc/basecoin/tendermint + chown basecoin.basecoin /etc/basecoin/tendermint/config.toml + test ! -f /etc/basecoin/priv_validator.json && tendermint gen_validator > /etc/basecoin/priv_validator.json && chmod 0400 /etc/basecoin/priv_validator.json && chown basecoin.basecoin /etc/basecoin/priv_validator.json + test ! -f /etc/basecoin/tendermint/priv_validator.json && tendermint gen_validator > /etc/basecoin/tendermint/priv_validator.json && chmod 0400 /etc/basecoin/tendermint/priv_validator.json && chown basecoin.basecoin /etc/basecoin/tendermint/priv_validator.json + tendermint_pubkey=`python -uc "import json ; print json.loads(open('/etc/basecoin/tendermint/priv_validator.json').read())['pub_key']['data']"` + test ! -f /etc/basecoin/tendermint/genesis.json && cat << EOF > /etc/basecoin/tendermint/genesis.json +{ + "genesis_time": "2017-06-10T03:37:03Z", + "chain_id": "my_chain_id", + "validators": + [ + { + "pub_key":{"type":"ed25519","data":"$tendermint_pubkey"}, + "amount":10, + "name":"my_testchain_node" + } + ], + "app_hash": "", + "app_options": {} +} +EOF + chown basecoin.basecoin /etc/basecoin/tendermint/genesis.json + systemctl daemon-reload + systemctl enable basecoin + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/devops/rpmbuild/extrafiles/DEBIAN-basecoin/postrm b/devops/rpmbuild/extrafiles/DEBIAN-basecoin/postrm new file mode 100644 index 000000000..b8e3c39bd --- /dev/null +++ b/devops/rpmbuild/extrafiles/DEBIAN-basecoin/postrm @@ -0,0 +1,45 @@ +#!/bin/sh +# postrm script for basecoin +# + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + upgrade|failed-upgrade|abort-upgrade) + systemctl daemon-reload + if [ -d /etc/basecoin/tendermint/data ]; then + service basecoin start + fi + ;; + + purge|remove|abort-install|disappear) + systemctl daemon-reload +# userdel basecoin + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/devops/rpmbuild/extrafiles/DEBIAN-basecoin/preinst b/devops/rpmbuild/extrafiles/DEBIAN-basecoin/preinst new file mode 100644 index 000000000..731ea7e28 --- /dev/null +++ b/devops/rpmbuild/extrafiles/DEBIAN-basecoin/preinst @@ -0,0 +1,37 @@ +#!/bin/sh +# preinst script for basecoin +# + +set -e + +# summary of how this script can be called: +# * `install' +# * `install' +# * `upgrade' +# * `abort-upgrade' +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + install|upgrade) + if ! grep -q '^basecoin:' /etc/passwd ; then + useradd -k /dev/null -r -m -b /etc basecoin + fi + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/devops/rpmbuild/extrafiles/DEBIAN-basecoin/prerm b/devops/rpmbuild/extrafiles/DEBIAN-basecoin/prerm new file mode 100644 index 000000000..5cc57e154 --- /dev/null +++ b/devops/rpmbuild/extrafiles/DEBIAN-basecoin/prerm @@ -0,0 +1,39 @@ +#!/bin/sh +# prerm script for basecoin +# + +set -e + +# summary of how this script can be called: +# * `remove' +# * `upgrade' +# * `failed-upgrade' +# * `remove' `in-favour' +# * `deconfigure' `in-favour' +# `removing' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + remove|upgrade|deconfigure) + systemctl stop basecoin 2> /dev/null || : + systemctl stop basecoin-service 2> /dev/null || : + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/devops/rpmbuild/extrafiles/DEBIAN/changelog b/devops/rpmbuild/extrafiles/DEBIAN-ethermint/changelog similarity index 70% rename from devops/rpmbuild/extrafiles/DEBIAN/changelog rename to devops/rpmbuild/extrafiles/DEBIAN-ethermint/changelog index 7a4913b57..76a1fb154 100644 --- a/devops/rpmbuild/extrafiles/DEBIAN/changelog +++ b/devops/rpmbuild/extrafiles/DEBIAN-ethermint/changelog @@ -1,4 +1,4 @@ -tendermint (@TENDERMINT_VERSION@) @STABILITY@; urgency=medium +ethermint (@VERSION@) @STABILITY@; urgency=medium * Automatic build. See https://github.com/tendermint/tendermint for more information. diff --git a/devops/rpmbuild/extrafiles/DEBIAN-ethermint/compat b/devops/rpmbuild/extrafiles/DEBIAN-ethermint/compat new file mode 100644 index 000000000..ec635144f --- /dev/null +++ b/devops/rpmbuild/extrafiles/DEBIAN-ethermint/compat @@ -0,0 +1 @@ +9 diff --git a/devops/rpmbuild/extrafiles/DEBIAN-ethermint/control b/devops/rpmbuild/extrafiles/DEBIAN-ethermint/control new file mode 100644 index 000000000..0904eb4e8 --- /dev/null +++ b/devops/rpmbuild/extrafiles/DEBIAN-ethermint/control @@ -0,0 +1,15 @@ +Source: ethermint +Section: net +Priority: optional +Maintainer: Greg Szabo +Build-Depends: debhelper (>=9) +Depends: tendermint (>=0.10.0) +Standards-Version: 3.9.6 +Homepage: https://tendermint.com +Package: ethermint +Architecture: amd64 +Version: @VERSION@ +Installed-Size: @INSTALLEDSIZE@ +Description: ethermint enables ethereum as an ABCI application on tendermint and the COSMOS hub + Ethermint enables ethereum to run as an ABCI application on tendermint and the COSMOS hub. This application allows you to get all the benefits of ethereum without having to run your own miners. + diff --git a/devops/rpmbuild/extrafiles/DEBIAN-ethermint/copyright b/devops/rpmbuild/extrafiles/DEBIAN-ethermint/copyright new file mode 100644 index 000000000..6d1bab01b --- /dev/null +++ b/devops/rpmbuild/extrafiles/DEBIAN-ethermint/copyright @@ -0,0 +1,21 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: ethermint +Source: https://github.com/tendermint/ethermint + +Files: * +Copyright: 2017 All In Bits, Inc. +License: Apache-2.0 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + . + http://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + . + On Debian systems, the full text of the Apache License 2.0 can be found + in the file `/usr/share/common-licenses/Apache-2.0'. diff --git a/devops/rpmbuild/extrafiles/DEBIAN-ethermint/postinst b/devops/rpmbuild/extrafiles/DEBIAN-ethermint/postinst new file mode 100644 index 000000000..c83ce75d6 --- /dev/null +++ b/devops/rpmbuild/extrafiles/DEBIAN-ethermint/postinst @@ -0,0 +1,71 @@ +#!/bin/sh +# postinst script for basecoin +# + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + configure) + chown ethermint.ethermint /etc/ethermint + chown ethermint.ethermint /etc/ethermint/genesis.json + chown ethermint.ethermint /etc/ethermint/tendermint + chown ethermint.ethermint /etc/ethermint/tendermint/config.toml + chown ethermint.ethermint /etc/ethermint/keystore + chown ethermint.ethermint /etc/ethermint/keystore/UTC--2016-10-21T22-30-03.071787745Z--7eff122b94897ea5b0e2a9abf47b86337fafebdc + + /usr/bin/ethermint --datadir /etc/ethermint init /etc/ethermint/genesis.json + chown -R ethermint.ethermint /etc/ethermint/ethermint + test ! -f /etc/ethermint/tendermint/priv_validator.json && tendermint gen_validator > /etc/ethermint/tendermint/priv_validator.json && chmod 0400 /etc/ethermint/tendermint/priv_validator.json && chown ethermint.ethermint /etc/ethermint/tendermint/priv_validator.json + tendermint_pubkey=`python -uc "import json ; print json.loads(open('/etc/ethermint/tendermint/priv_validator.json').read())['pub_key']['data']"` + test ! -f /etc/ethermint/tendermint/genesis.json && cat << EOF > /etc/ethermint/tendermint/genesis.json +{ + "genesis_time": "2017-06-10T03:37:03Z", + "chain_id": "my_chain_id", + "validators": + [ + { + "pub_key":{"type":"ed25519","data":"$tendermint_pubkey"}, + "amount":10, + "name":"my_testchain_node" + } + ], + "app_hash": "", + "app_options": {} +} +EOF + chown ethermint.ethermint /etc/ethermint/tendermint/genesis.json + systemctl daemon-reload + systemctl enable ethermint + if [ -d /etc/ethermint/tendermint/data ]; then + service ethermint start + fi + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/devops/rpmbuild/extrafiles/DEBIAN-ethermint/postrm b/devops/rpmbuild/extrafiles/DEBIAN-ethermint/postrm new file mode 100644 index 000000000..7b355652c --- /dev/null +++ b/devops/rpmbuild/extrafiles/DEBIAN-ethermint/postrm @@ -0,0 +1,45 @@ +#!/bin/sh +# postrm script for ethermint +# + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + upgrade|failed-upgrade|abort-upgrade) + systemctl daemon-reload + if [ -d /etc/ethermint/tendermint/data ]; then + service ethermint start + fi + ;; + + purge|remove|abort-install|disappear) + systemctl daemon-reload +# userdel ethermint + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/devops/rpmbuild/extrafiles/DEBIAN-ethermint/preinst b/devops/rpmbuild/extrafiles/DEBIAN-ethermint/preinst new file mode 100644 index 000000000..57cb44880 --- /dev/null +++ b/devops/rpmbuild/extrafiles/DEBIAN-ethermint/preinst @@ -0,0 +1,37 @@ +#!/bin/sh +# preinst script for ethermint +# + +set -e + +# summary of how this script can be called: +# * `install' +# * `install' +# * `upgrade' +# * `abort-upgrade' +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + install|upgrade) + if ! grep -q '^ethermint:' /etc/passwd ; then + useradd -k /dev/null -r -m -b /etc ethermint + fi + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/devops/rpmbuild/extrafiles/DEBIAN-ethermint/prerm b/devops/rpmbuild/extrafiles/DEBIAN-ethermint/prerm new file mode 100644 index 000000000..5af626fdf --- /dev/null +++ b/devops/rpmbuild/extrafiles/DEBIAN-ethermint/prerm @@ -0,0 +1,39 @@ +#!/bin/sh +# prerm script for ethermint +# + +set -e + +# summary of how this script can be called: +# * `remove' +# * `upgrade' +# * `failed-upgrade' +# * `remove' `in-favour' +# * `deconfigure' `in-favour' +# `removing' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + remove|upgrade|deconfigure) + systemctl stop ethermint 2> /dev/null || : + systemctl stop ethermint-service 2> /dev/null || : + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/devops/rpmbuild/extrafiles/DEBIAN-tendermint/changelog b/devops/rpmbuild/extrafiles/DEBIAN-tendermint/changelog new file mode 100644 index 000000000..4b016f845 --- /dev/null +++ b/devops/rpmbuild/extrafiles/DEBIAN-tendermint/changelog @@ -0,0 +1,6 @@ +tendermint (@VERSION@) @STABILITY@; urgency=medium + + * Automatic build. See https://github.com/tendermint/tendermint for more information. + + -- Greg Szabo @DATETIMESTAMP@ + diff --git a/devops/rpmbuild/extrafiles/DEBIAN-tendermint/compat b/devops/rpmbuild/extrafiles/DEBIAN-tendermint/compat new file mode 100644 index 000000000..ec635144f --- /dev/null +++ b/devops/rpmbuild/extrafiles/DEBIAN-tendermint/compat @@ -0,0 +1 @@ +9 diff --git a/devops/rpmbuild/extrafiles/DEBIAN/control b/devops/rpmbuild/extrafiles/DEBIAN-tendermint/control similarity index 95% rename from devops/rpmbuild/extrafiles/DEBIAN/control rename to devops/rpmbuild/extrafiles/DEBIAN-tendermint/control index c498a533f..d9da17dd1 100644 --- a/devops/rpmbuild/extrafiles/DEBIAN/control +++ b/devops/rpmbuild/extrafiles/DEBIAN-tendermint/control @@ -7,7 +7,7 @@ Standards-Version: 3.9.6 Homepage: https://tendermint.com Package: tendermint Architecture: amd64 -Version: @TENDERMINT_VERSION@ +Version: @VERSION@ Installed-Size: @INSTALLEDSIZE@ Description: securely and consistently replicate an application on many machines Tendermint is software for securely and consistently replicating an application on many machines. By securely, we mean that Tendermint works even if up to 1/3 of machines fail in arbitrary ways. By consistently, we mean that every non-faulty machine sees the same transaction log and computes the same state. diff --git a/devops/rpmbuild/extrafiles/DEBIAN/copyright b/devops/rpmbuild/extrafiles/DEBIAN-tendermint/copyright similarity index 100% rename from devops/rpmbuild/extrafiles/DEBIAN/copyright rename to devops/rpmbuild/extrafiles/DEBIAN-tendermint/copyright diff --git a/devops/rpmbuild/extrafiles/basecoin/basecoin.service b/devops/rpmbuild/extrafiles/basecoin/basecoin.service index f806ef481..b3a24c280 100644 --- a/devops/rpmbuild/extrafiles/basecoin/basecoin.service +++ b/devops/rpmbuild/extrafiles/basecoin/basecoin.service @@ -19,7 +19,7 @@ Restart=on-failure User=basecoin Group=basecoin PermissionsStartOnly=true -ExecStart=/usr/bin/basecoin start --without-tendermint +ExecStart=/usr/bin/basecoin start --without-tendermint --address "tcp://0.0.0.0:36658" ExecReload=/bin/kill -HUP $MAINPID KillSignal=SIGTERM diff --git a/devops/rpmbuild/extrafiles/binarydescription b/devops/rpmbuild/extrafiles/binarydescription deleted file mode 100644 index a25ddd732..000000000 --- a/devops/rpmbuild/extrafiles/binarydescription +++ /dev/null @@ -1,29 +0,0 @@ -Format: 3.0 (native) -Source: tendermint -Binary: tendermint -Architecture: amd64 -Version: @TENDERMINTVERSION@ -Maintainer: Greg Szabo -Standards-Version: 3.9.6 -Vcs-Browser: http://svn.debian.org/wsvn/pkg-apache/trunk/ssl-cert -Vcs-Svn: svn://svn.debian.org/pkg-apache/trunk/ssl-cert -Build-Depends: debhelper (>=9) -Checksums-Sha1: - a108d8df792554ed7be41a9aaa317bada441f216 22697 ssl-cert_1.0.28.tar.gz -Checksums-Sha256: - 464dabcf44d72d7e1ecdf1ffa8d0641694e6375704097d5e8ba04f3242e83d5e 22697 ssl-cert_1.0.28.tar.gz -Files: - 4377beded7717321f9f75cfd12057dac 22697 ssl-cert_1.0.28.tar.gz - -Package: tendermint -Architecture: amd64 -Version: @TENDERMINT_VERSION@ -Installed-Size: @INSTALLEDSIZE@ -Description: securely and consistently replicate an application on many machines - Tendermint is software for securely and consistently replicating an application on many machines. By securely, we mean that Tendermint works even if up to 1/3 of machines fail in arbitrary ways. By consistently, we mean that every non-faulty machine sees the same transaction log and computes the same state. - -~ -~ -~ -~ - diff --git a/devops/rpmbuild/spectemplates/basecoin.spec b/devops/rpmbuild/spectemplates/basecoin.spec index 98b9d070e..3b5ee9683 100644 --- a/devops/rpmbuild/spectemplates/basecoin.spec +++ b/devops/rpmbuild/spectemplates/basecoin.spec @@ -72,12 +72,16 @@ EOF %{__chown} %{name}.%{name} %{_sysconfdir}/%{name}/tendermint/genesis.json systemctl daemon-reload systemctl enable %{name} +if [ -d /etc/%{name}/tendermint/data ]; then + service %{name} start +fi %preun systemctl stop %{name} 2> /dev/null || : systemctl stop %{name}-service 2> /dev/null || : %postun +#userdel %{name} systemctl daemon-reload %files diff --git a/devops/rpmbuild/spectemplates/ethermint.spec b/devops/rpmbuild/spectemplates/ethermint.spec index 8363e45f7..4f878f0ef 100644 --- a/devops/rpmbuild/spectemplates/ethermint.spec +++ b/devops/rpmbuild/spectemplates/ethermint.spec @@ -69,12 +69,16 @@ EOF %{__chown} %{name}.%{name} %{_sysconfdir}/%{name}/tendermint/genesis.json systemctl daemon-reload systemctl enable %{name} +if [ -d /etc/%{name}/tendermint/data ]; then + service %{name} start +fi %preun systemctl stop %{name} 2> /dev/null || : systemctl stop %{name}-service 2> /dev/null || : %postun +#userdel %{name} systemctl daemon-reload %files