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
...
@@ -21,40 +21,15 @@ function info
echo
'***'
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
# For getting a recent nodejs
function
nodejs
_pre
function
nodejs
install
{
{
info nodejs
info nodejs
# Nodejs software repository PGP key
# Nodejs software repository PGP key
if
[
`
apt-key
export
${
NODEJSPGP
}
2>&1 |
wc
-l
`
-le
50
]
if
[
`
apt-key
export
${
NODEJSPGP
}
2>&1 |
wc
-l
`
-le
50
]
then
then
yesno n
Add nodejs software repository PGP key
&&
info
Add nodejs software repository PGP key
apt-key adv
--keyserver
keyserver.ubuntu.com
--recv
${
NODEJSPGP
}
apt-key adv
--keyserver
keyserver.ubuntu.com
--recv
${
NODEJSPGP
}
fi
fi
local
file
=
/etc/apt/sources.list.d/nodesource.list
local
file
=
/etc/apt/sources.list.d/nodesource.list
if
[
!
-r
"
$file
"
]
if
[
!
-r
"
$file
"
]
...
@@ -64,26 +39,28 @@ function nodejs_pre
...
@@ -64,26 +39,28 @@ function nodejs_pre
info And now updating the software package list.
info And now updating the software package list.
apt update
apt update
fi
fi
aptinstall nodejs npm
# nodejs also provides npm
aptinstall nodejs
}
}
function
nodejs_post
function
web3install
{
{
info Initialising nodejs.
(
test
-r
"package.json"
||
cd
~bfa
npm init
-y
test
-r
package.json
||
info Initialising nodejs.
&&
sudo
-u
bfa npm init
-y
)
# nodejs package(s) that we need.
# nodejs package(s) that we need.
nodejs
-e
'require("web3")'
2>/dev/null
&&
return
echo
'require("web3")'
|
sudo
-u
bfa nodejs
2>/dev/null
&&
return
yesno n
Installing nodejs module: web3
info
Installing nodejs module: web3
npm
install
web3
sudo
-u
bfa
npm
install
web3
}
}
function
golang
_pre
function
golang
install
{
{
unset
installedusrlocalgo
if
[
!
-d
/usr/local/go
]
if
[
!
-d
/usr/local/go
]
then
then
installedusrlocalgo
=
1
info Downloading package of go binaries.
info Downloading package of go binaries.
mkdir
-p
~/new
mkdir
-p
~/new
cd
~/new
cd
~/new
...
@@ -126,7 +103,7 @@ function golang_pre
...
@@ -126,7 +103,7 @@ function golang_pre
PATH
=
${
PATH
}
:/usr/local/go/bin
PATH
=
${
PATH
}
:/usr/local/go/bin
}
}
function
geth
_pre
function
geth
install
{
{
mkdir
-p
~/new
mkdir
-p
~/new
cd
~/new
cd
~/new
...
@@ -136,19 +113,13 @@ function geth_pre
...
@@ -136,19 +113,13 @@ function geth_pre
cd
~/new/go-ethereum
cd
~/new/go-ethereum
info Running git pull to ensure that the
local
go-ethereum repo is up-to-date.
info Running git pull to ensure that the
local
go-ethereum repo is up-to-date.
git pull
git pull
}
#
function
geth_compile
{
cd
~/new/go-ethereum
cd
~/new/go-ethereum
info Compiling geth
info Compiling geth
make geth
make all
&&
}
echo
Ignore that last line,
if
it tells you to run geth now.
function
geth_post
{
mkdir
-p
~bfa/bin
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
chown
-R
bfa:bfa ~bfa
}
}
...
@@ -165,9 +136,9 @@ function aptinstall
...
@@ -165,9 +136,9 @@ function aptinstall
function
usersetup
function
usersetup
{
{
if
echo
~bfa |
grep
-qvE
'^/'
&&
yesno n Add required user
\"
bfa
\"
if
!
id
bfa
>
/dev/null 2>&1
then
then
info Add
ing BFA
user
\"
bfa
\"
.
info Add
required
user
\"
bfa
\"
adduser
--disabled-password
--gecos
'Blockchain Federal Argentina'
bfa
adduser
--disabled-password
--gecos
'Blockchain Federal Argentina'
bfa
fi
fi
cd
~bfa
cd
~bfa
...
@@ -177,7 +148,7 @@ function usersetup
...
@@ -177,7 +148,7 @@ function usersetup
git clone https://gitlab.bfa.ar/blockchain/nucleo.git bfa
git clone https://gitlab.bfa.ar/blockchain/nucleo.git bfa
fi
fi
# updating
# updating
cd
bfa
cd
~bfa/
bfa
git pull
git pull
#
#
cd
~bfa
cd
~bfa
...
@@ -188,40 +159,27 @@ function usersetup
...
@@ -188,40 +159,27 @@ function usersetup
fi
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
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
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 -
(
crontab
-u
bfa
-l
;
echo
'@reboot bfa/bin/cron.sh'
)
| crontab
-u
bfa -
fi
fi
}
}
function
welcome
function
welcome
{
{
echo
info
"(re)log in as user bfa"
echo
"(re)log in as user bfa"
}
}
# development tools
# development tools
aptinstall dirmngr apt-transport-https curl git curl build-essential
aptinstall dirmngr apt-transport-https curl git curl build-essential
nodejs_pre
usersetup
usersetup
nodejs_post
nodejsinstall
golang_pre
web3install
geth_pre
golanginstall
geth_compile
gethinstall
geth_post
golang_post
cronit
cronit
welcome
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