aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authornolash2019-08-21 21:50:13 +0200
committernolash2019-08-21 21:50:13 +0200
commit7b9c5827b1fa70b32d69275713cdedb37d3bddc2 (patch)
tree1ea5db4881cf8fa4f0ba323073dbaf469899750e
parentb8f43620bb8b373616b636c256d3d98c21bd41d9 (diff)
downloadaur-7b9c5827b1fa70b32d69275713cdedb37d3bddc2.tar.gz
Improve checking wallet generation tools
-rw-r--r--PKGBUILD37
-rw-r--r--go-swarm.install29
-rw-r--r--swarm-resources.tar.gzbin1257 -> 1215 bytes
3 files changed, 31 insertions, 35 deletions
diff --git a/PKGBUILD b/PKGBUILD
index b1171eba4dc2..368040065890 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -22,10 +22,21 @@ source=("https://github.com/ethersphere/swarm/archive/v${pkgver}.tar.gz"
"v${pkgver}.tar.gz.sig"
"swarm-resources.tar.gz")
noextract=()
-md5sums=("7f394b218657463761a555d5c598a320" "SKIP" "d86f000521890a4e84a9ad3e97c30a60");
+md5sums=("7f394b218657463761a555d5c598a320"
+ "SKIP"
+ "8e69aa2b907450a996fd33535051c1b9")
validpgpkeys=("0826EDA1702D1E87C6E2875121D2E7BB88C2A746")
+_pythonwalletdepends=1
prepare() {
+ for m in ${optdepends[@]}; do
+ if [ ! pacman -Qi $m &> /dev/null ]; then
+ if [ $m =~ /^python-/ ]; then
+ _pythonwalletdepends=0
+ fi
+ fi
+ done
+
export GOPATH=${srcdir}/go
export SWARMPATH=${GOPATH}/src/github.com/ethersphere
if [ -d "$GOPATH" ]; then
@@ -51,30 +62,12 @@ build() {
}
check() {
- pythonwalletdepends=1
- gethwalletdepends=1
- for m in ${optdepends[@]}; do
- if [ ! pacman -Qi $m &> /dev/null ]; then
- if [ $m =~ /^python-/ ]; then
- pythonwalletdepends=0
- else
- gethwalletdepends=0
- fi
- warning "missing optional depend ${m}"
- fi
- done
- dependsdir="/tmp/.${pkgname}-depends-${pkgver}-${pkgrel}"
- mkdir -p ${dependsdir}
- if [ ${pythonwalletdepends} -eq 1 ]; then
- touch ${dependsdir}/.havepythonwallet
- fi
- if [ ${gethwalletdepends} -eq 1 ]; then
- touch ${dependsdir}/.havegethwallet
- fi
warning "still need to add checks"
}
package() {
install -v -D -m0755 build/swarm ${pkgdir}/usr/local/bin/swarm
- install -v -D -m0700 swarm-genkey.py ${pkgdir}/usr/local/bin/swarm-genkey
+ if [ ${_pythonwalletdepends} -eq 1 ]; then
+ install -v -D -m0700 swarm-genkey.py ${pkgdir}/usr/local/bin/swarm-genkey
+ fi
}
diff --git a/go-swarm.install b/go-swarm.install
index 65f2fe638196..121b9e497f0c 100644
--- a/go-swarm.install
+++ b/go-swarm.install
@@ -1,31 +1,34 @@
post_install () {
- dependsdir=/tmp/.go-swarm-depends-$1
- mkdir -p /var/lib/bzz/keystore
+ if [ -f /var/lib/bzz/.swarm-pass ]; then
+ echo "you already have a Swarm data dir. I'll leave it alone ;)"
+ return 0
+ fi
- if [ -f "${dependsdir}/.havepythonwallet" ]; then
- echo "generating wallet with swarm-genkey"
+ mkdir -p /var/lib/bzz/.ethereum/keystore
+ gethbin=$(which geth)
+ if [ ! -z $gethbin ]; then
+ echo "generating wallet with geth"
tmpkey=$(mktemp -d)
pushd ${tmpkey}
- /usr/local/bin/swarm-genkey
+ dd if=/dev/urandom of=.swarm-pass bs=1 count=64
+ geth --datadir /var/lib/bzz/.ethereum --password ${tmpkey}/.swarm-pass account new
install -v -D -m600 .swarm-pass /var/lib/bzz/.swarm-pass
- install -v -D -m600 UTC* /var/lib/bzz/keystore/
popd
rm -vrf ${tmpkey}
- elif [ -f "${dependsdir}/.havegethwallet" ]; then
- echo "generating wallet with geth"
+ elif [ -x /usr/local/bin/swarm-genkey ]; then
+ echo "generating wallet with swarm-genkey"
tmpkey=$(mktemp -d)
pushd ${tmpkey}
- dd if=/dev/urandom of=.swarm-pass bs=1 count=64
- geth --datadir /var/lib/bzz --password ${tmpkey}/.swarm-pass account new
+ /usr/local/bin/swarm-genkey
install -v -D -m600 .swarm-pass /var/lib/bzz/.swarm-pass
+ install -v -D -m600 UTC* /var/lib/bzz/.ethereum/keystore/
popd
+ rm -vrf ${tmpkey}
else
echo "Missing optional dependencies required to automatically generate a ethereum wallet for the swarm node"
echo "You will not be able to run a node with it"
echo "You can generate it manually later using go-ethereum or the swarm-genkey.py script provided this package, provided dependencies are met"
fi
- unlink ${dependsdir}/.havepythonwallet
- unlink ${dependsdir}/.havegethwallet
chown -v bzz:bzz /var/lib/bzz -R
- chmod 700 /var/lib/bzz/keystore
+ chmod 700 /var/lib/bzz/.ethereum/keystore
}
diff --git a/swarm-resources.tar.gz b/swarm-resources.tar.gz
index bd372d48c0eb..ccdcb7a692f1 100644
--- a/swarm-resources.tar.gz
+++ b/swarm-resources.tar.gz
Binary files differ