mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 22:26:42 +00:00
swarm/cmd: fix passing arguments to up function
This commit is contained in:
parent
05c62a9922
commit
36b6592542
1 changed files with 14 additions and 6 deletions
|
|
@ -430,10 +430,15 @@ function needs {
|
||||||
}
|
}
|
||||||
|
|
||||||
# swarm up 00 file uploads file via instances CLI
|
# swarm up 00 file uploads file via instances CLI
|
||||||
function up { #port, file
|
function up {
|
||||||
echo "Upload file '$2' to node $1... " 1>&2
|
id=$1
|
||||||
file=`basename $2`
|
path=$2
|
||||||
/usr/bin/time -f "latency: %e" swarm execute $1 "bzz.upload(\"$2\", \"$file\")"|tail -n1> /tmp/key
|
file=$3
|
||||||
|
if [ $file = "" ]; then
|
||||||
|
file=`basename $path`
|
||||||
|
fi
|
||||||
|
echo "Upload file '$path' to node $id... " 1>&2
|
||||||
|
/usr/bin/time -f "latency: %e" swarm execute $id "bzz.upload(\"$path\", \"$file\")"|tail -n1> /tmp/key
|
||||||
cat /tmp/key
|
cat /tmp/key
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -590,12 +595,15 @@ function checksum {
|
||||||
|
|
||||||
function checkaccess {
|
function checkaccess {
|
||||||
nodes=$1
|
nodes=$1
|
||||||
|
path=$2
|
||||||
target=`basename $2`
|
target=`basename $2`
|
||||||
chsum=`md5sum $2|cut -f1 -d' '`
|
chsum=`md5sum $2|cut -f1 -d' '`
|
||||||
|
shift
|
||||||
|
shift
|
||||||
master=`head -1 $nodes`
|
master=`head -1 $nodes`
|
||||||
echo "uploading target on $master (md5sum $chsum, size: `du -b -d0 $2|cut -f1`)"
|
echo "uploading target on $master (md5sum $chsum, size: `du -b -d0 $2|cut -f1`)"
|
||||||
scp $2 $master:$target
|
scp $path $master:$target
|
||||||
hash=`swarm remote-run $master "swarm up 00 $target $file"|tr -d '"'`
|
hash=`swarm remote-run $master "swarm up 00 $target $*"|tr -d '"'`
|
||||||
remote-run $nodes swarm checkdownload all $hash $chsum
|
remote-run $nodes swarm checkdownload all $hash $chsum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue