Skip to content

Commit 36b6592

Browse files
committed
swarm/cmd: fix passing arguments to up function
1 parent 05c62a9 commit 36b6592

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

swarm/cmd/swarm/swarm

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -430,10 +430,15 @@ function needs {
430430
}
431431

432432
# swarm up 00 file uploads file via instances CLI
433-
function up { #port, file
434-
echo "Upload file '$2' to node $1... " 1>&2
435-
file=`basename $2`
436-
/usr/bin/time -f "latency: %e" swarm execute $1 "bzz.upload(\"$2\", \"$file\")"|tail -n1> /tmp/key
433+
function up {
434+
id=$1
435+
path=$2
436+
file=$3
437+
if [ $file = "" ]; then
438+
file=`basename $path`
439+
fi
440+
echo "Upload file '$path' to node $id... " 1>&2
441+
/usr/bin/time -f "latency: %e" swarm execute $id "bzz.upload(\"$path\", \"$file\")"|tail -n1> /tmp/key
437442
cat /tmp/key
438443
}
439444

@@ -590,12 +595,15 @@ function checksum {
590595

591596
function checkaccess {
592597
nodes=$1
598+
path=$2
593599
target=`basename $2`
594600
chsum=`md5sum $2|cut -f1 -d' '`
601+
shift
602+
shift
595603
master=`head -1 $nodes`
596604
echo "uploading target on $master (md5sum $chsum, size: `du -b -d0 $2|cut -f1`)"
597-
scp $2 $master:$target
598-
hash=`swarm remote-run $master "swarm up 00 $target $file"|tr -d '"'`
605+
scp $path $master:$target
606+
hash=`swarm remote-run $master "swarm up 00 $target $*"|tr -d '"'`
599607
remote-run $nodes swarm checkdownload all $hash $chsum
600608
}
601609

0 commit comments

Comments
 (0)