Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nucleo
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
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
blockchain
nucleo
Commits
d35d659e
Commit
d35d659e
authored
6 years ago
by
Robert Martin-Legene
Browse files
Options
Downloads
Patches
Plain Diff
Simplifying installation script
parent
bdc11652
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/installbfa.sh
+31
-73
31 additions, 73 deletions
bin/installbfa.sh
with
31 additions
and
73 deletions
bin/installbfa.sh
+
31
−
73
View file @
d35d659e
...
...
@@ -21,40 +21,15 @@ function info
echo
'***'
}
function
yesno
{
local
defval
=
$1
shift
local
yn
=
"yN"
test
"
${
defval
,,
}
"
=
"y"
&&
yn
=
"Yn"
REPLY
=
while
[
"
${
REPLY
}
"
!=
"y"
-a
"
${
REPLY
}
"
!=
"n"
]
do
read
-s
-n
1
-p
"
${
*
}
? [
${
yn
}
]: "
test
-z
"
${
REPLY
}
"
&&
REPLY
=
${
defval
:0:1
}
REPLY
=
${
REPLY
,,
}
test
"
$REPLY
"
!=
"y"
-a
"
$REPLY
"
!=
"n"
&&
REPLY
=
done
echo
$REPLY
if
[
"
$REPLY
"
=
"n"
]
then
return
1
fi
return
0
}
# For getting a recent nodejs
function
nodejs
_pre
function
nodejs
install
{
info nodejs
# Nodejs software repository PGP key
if
[
`
apt-key
export
${
NODEJSPGP
}
2>&1 |
wc
-l
`
-le
50
]
then
yesno n
Add nodejs software repository PGP key
&&
apt-key adv
--keyserver
keyserver.ubuntu.com
--recv
${
NODEJSPGP
}
info
Add nodejs software repository PGP key
apt-key adv
--keyserver
keyserver.ubuntu.com
--recv
${
NODEJSPGP
}
fi
local
file
=
/etc/apt/sources.list.d/nodesource.list
if
[
!
-r
"
$file
"
]
...
...
@@ -64,26 +39,28 @@ function nodejs_pre
info And now updating the software package list.
apt update
fi
aptinstall nodejs npm
# nodejs also provides npm
aptinstall nodejs
}
function
nodejs_post
function
web3install
{
info Initialising nodejs.
test
-r
"package.json"
||
npm init
-y
(
cd
~bfa
test
-r
package.json
||
info Initialising nodejs.
&&
sudo
-u
bfa npm init
-y
)
# nodejs package(s) that we need.
nodejs
-e
'require("web3")'
2>/dev/null
&&
return
yesno n
Installing nodejs module: web3
npm
install
web3
echo
'require("web3")'
|
sudo
-u
bfa nodejs
2>/dev/null
&&
return
info
Installing nodejs module: web3
sudo
-u
bfa
npm
install
web3
}
function
golang
_pre
function
golang
install
{
unset
installedusrlocalgo
if
[
!
-d
/usr/local/go
]
then
installedusrlocalgo
=
1
info Downloading package of go binaries.
mkdir
-p
~/new
cd
~/new
...
...
@@ -126,7 +103,7 @@ function golang_pre
PATH
=
${
PATH
}
:/usr/local/go/bin
}
function
geth
_pre
function
geth
install
{
mkdir
-p
~/new
cd
~/new
...
...
@@ -136,19 +113,13 @@ function geth_pre
cd
~/new/go-ethereum
info Running git pull to ensure that the
local
go-ethereum repo is up-to-date.
git pull
}
function
geth_compile
{
#
cd
~/new/go-ethereum
info Compiling geth
make geth
}
function
geth_post
{
make all
&&
echo
Ignore that last line,
if
it tells you to run geth now.
mkdir
-p
~bfa/bin
cp
-vp
~/new/go-ethereum/build/bin/geth ~bfa/bin/
cp
-vp
~/new/go-ethereum/build/bin/
{
geth
,bootnode,abigen,ethkey,puppeth,rlpdump,wnode,swarm,swarm-smoke
}
~bfa/bin/
chown
-R
bfa:bfa ~bfa
}
...
...
@@ -165,9 +136,9 @@ function aptinstall
function
usersetup
{
if
echo
~bfa |
grep
-qvE
'^/'
&&
yesno n Add required user
\"
bfa
\"
if
!
id
bfa
>
/dev/null 2>&1
then
info Add
ing BFA
user
\"
bfa
\"
.
info Add
required
user
\"
bfa
\"
adduser
--disabled-password
--gecos
'Blockchain Federal Argentina'
bfa
fi
cd
~bfa
...
...
@@ -177,7 +148,7 @@ function usersetup
git clone https://gitlab.bfa.ar/blockchain/nucleo.git bfa
fi
# updating
cd
bfa
cd
~bfa/
bfa
git pull
#
cd
~bfa
...
...
@@ -188,40 +159,27 @@ function usersetup
fi
}
function
golang_post
{
if
[
-n
"
${
installedusrlocalgo
}
"
]
then
yesno n Remove unneeded go installation /usr/local/go
&&
rm
-rf
/usr/local/go
fi
}
function
cronit
{
if
crontab
-u
bfa
-l
|
expand
|
grep
-qvE
'^@reboot +bfa/bin/cron.sh$'
if
crontab
-u
bfa
-l
2>/dev/null
|
expand
|
grep
-qvE
'^@reboot +bfa/bin/cron.sh$'
then
yesno n
Install crontab to start automatically upon reboot
||
return
info
Install crontab to start automatically upon reboot
(
crontab
-u
bfa
-l
;
echo
'@reboot bfa/bin/cron.sh'
)
| crontab
-u
bfa -
fi
}
function
welcome
{
echo
echo
"(re)log in as user bfa"
info
"(re)log in as user bfa"
}
# development tools
aptinstall dirmngr apt-transport-https curl git curl build-essential
nodejs_pre
usersetup
nodejs_post
golang_pre
geth_pre
geth_compile
geth_post
golang_post
nodejsinstall
web3install
golanginstall
gethinstall
cronit
welcome
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