Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nucleo
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Santiago
nucleo
Commits
33f2043e
Commit
33f2043e
authored
5 years ago
by
Robert Martin-Legene
Browse files
Options
Downloads
Patches
Plain Diff
Move loop control into libbfa.sh itself
parent
b83efbd6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/generate-genesis-block.sh
+6
-12
6 additions, 12 deletions
bin/generate-genesis-block.sh
bin/libbfa.sh
+44
-34
44 additions, 34 deletions
bin/libbfa.sh
with
50 additions
and
46 deletions
bin/generate-genesis-block.sh
+
6
−
12
View file @
33f2043e
#!/bin/bash
# Robert Martin-Legene <robert@nic.ar>
# Don't let us call ourselves
if
[
-n
"
$LOOPCONTROL_GENESISCREATE
"
]
then
export
LOOPCONTROL_GENESISCREATE
=
1
if
[
-z
"
${
BFAHOME
}
"
]
;
then
echo
"
\$
BFAHOME not set. Did you source bfa/bin/env ?"
>
&2
;
exit
1
;
fi
source
${
BFAHOME
}
/bin/libbfa.sh
||
exit
1
if
[
-z
"
${
BFAHOME
}
"
]
;
then
echo
"
\$
BFAHOME not set. Did you source bfa/bin/env ?"
>
&2
;
exit
1
;
fi
source
${
BFAHOME
}
/bin/libbfa.sh
||
exit
1
if
[
!
-d
"
${
BFANODEDIR
}
"
-o
!
-d
"
${
BFANODEDIR
}
/geth/chaindata"
]
then
echo
"Node is not initialised. Initialising with genesis."
geth
--cache
0
--datadir
"
${
BFANODEDIR
}
"
--networkid
${
BFANETWORKID
}
init
"
${
BFANETWORKDIR
}
/genesis.json"
fi
if
[
!
-d
"
${
BFANODEDIR
}
"
-o
!
-d
"
${
BFANODEDIR
}
/geth/chaindata"
]
then
echo
"Node is not initialised. Initialising with genesis."
geth
--cache
0
--datadir
"
${
BFANODEDIR
}
"
--networkid
${
BFANETWORKID
}
init
"
${
BFANETWORKDIR
}
/genesis.json"
fi
unset
LOOPCONTROL_GENESISCREATE
This diff is collapsed.
Click to expand it.
bin/libbfa.sh
+
44
−
34
View file @
33f2043e
...
...
@@ -157,39 +157,49 @@ function contractSendTx
echo
"contract.
${
func
}
.sendTransaction(
${
args
}
{from: eth.accounts[0], gas: 1000000} )"
}
###############
# bfainit #
test
-n
"
${
BFAHOME
}
"
-a
\
-d
"
${
BFAHOME
}
"
||
fatal
"
\$
BFAHOME in your environment must point to a directory."
#
# BFANETWORKID
test
-n
"
${
BFANETWORKID
}
"
||
BFANETWORKID
=
47525974938
#
# BFANETWORKDIR
test
-n
"
${
BFANETWORKDIR
}
"
||
BFANETWORKDIR
=
"
${
BFAHOME
}
/network"
mkdir
-p
"
${
BFANETWORKDIR
}
"
test
-d
"
${
BFANETWORKDIR
}
"
||
fatal
"
\$
BFANETWORKDIR (
\"
${
BFANETWORKDIR
}
\"
) not found."
#
# BFANODEDIR
test
-n
"
$BFANODEDIR
"
||
BFANODEDIR
=
"
${
BFANETWORKDIR
}
/node"
if
[
!
-d
"
${
BFANODEDIR
}
"
-o
!
-d
"
${
BFANODEDIR
}
/geth/chaindata"
]
function
bfainit
{
###############
# bfainit #
test
-n
"
${
BFAHOME
}
"
-a
\
-d
"
${
BFAHOME
}
"
||
fatal
"
\$
BFAHOME in your environment must point to a directory."
#
# BFANETWORKID
test
-n
"
${
BFANETWORKID
}
"
||
BFANETWORKID
=
47525974938
#
# BFANETWORKDIR
test
-n
"
${
BFANETWORKDIR
}
"
||
BFANETWORKDIR
=
"
${
BFAHOME
}
/network"
mkdir
-p
"
${
BFANETWORKDIR
}
"
test
-d
"
${
BFANETWORKDIR
}
"
||
fatal
"
\$
BFANETWORKDIR (
\"
${
BFANETWORKDIR
}
\"
) not found."
#
# BFANODEDIR
test
-n
"
$BFANODEDIR
"
||
BFANODEDIR
=
"
${
BFANETWORKDIR
}
/node"
if
[
!
-d
"
${
BFANODEDIR
}
"
-o
!
-d
"
${
BFANODEDIR
}
/geth/chaindata"
]
then
generate-genesis-block.sh
fi
#
# Default to IPC connections, because we have more geth modules available.
true
${
BFASOCKETTYPE
:
=ipc
}
case
"
${
BFASOCKETTYPE
}
"
in
ipc
)
true
${
BFASOCKETURL
:
=
"ipc:
${
BFANODEDIR
}
/geth.ipc"
}
;;
http
)
true
${
BFASOCKETURL
:
=
"http://127.0.0.1:8545"
}
;;
ws
)
true
${
BFASOCKETURL
:
=
"ws://127.0.0.1:8546"
}
;;
*
)
echo
"Unknown socket type. Supported types are http, ws, ipc"
>
&2
exit
1
esac
}
if
[
-z
"
$SOURCED_BFAINIT_SH
"
]
then
generate-genesis-block.sh
SOURCED_BFAINIT_SH
=
yes
bfainit
fi
true
${
BFASOCKETTYPE
:
=ipc
}
case
"
${
BFASOCKETTYPE
}
"
in
ipc
)
test
${
BFASOCKETURL
:
=
"ipc:
${
BFANODEDIR
}
/geth.ipc"
}
;;
http
)
test
${
BFASOCKETURL
:
=
"http://127.0.0.1:8545"
}
;;
ws
)
test
${
BFASOCKETURL
:
=
"ws://127.0.0.1:8546"
}
;;
*
)
echo
"Unknown socket type. Supported types are http, ws, ipc"
>
&2
exit
1
esac
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment