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
4a60c535
Commit
4a60c535
authored
6 years ago
by
Robert Martin-Legene
Browse files
Options
Downloads
Patches
Plain Diff
Solving permission problems
parent
335c80a3
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
+37
-34
37 additions, 34 deletions
bin/installbfa.sh
with
37 additions
and
34 deletions
bin/installbfa.sh
+
37
−
34
View file @
4a60c535
...
...
@@ -25,6 +25,23 @@ function info
echo
'***'
}
# Runs as the owner of the given directory, and in the given directory
function
runasownerof
{
path
=
$1
precmd
=
shift
1
pushd
$path
if
[
$(
stat
--format
=
%u
.
)
-ne
$UID
]
then
precmd
=
"sudo --set-home -u
$(
stat
--format
=
%U
.
)
"
fi
unset
path
${
precmd
}
"
$@
"
popd
unset
precmd
}
# For getting a recent nodejs
function
nodejsinstall
{
...
...
@@ -49,16 +66,15 @@ function nodejsinstall
function
web3install
{
cd
~bfa
test
-r
package.json
||
test
-r
~bfa/package.json
||
info
"Initialising nodejs."
&&
sudo
--set-home
-u
bfa npm init
-y
runasownerof ~
bfa npm init
-y
# nodejs package(s) that we need.
echo
'require("web3")'
|
sudo
--set-home
-u
bfa nodejs 2>/dev/null
&&
return
echo
'require("web3")'
|
runasownerof ~
bfa nodejs 2>/dev/null
&&
return
info
"Installing nodejs module: web3 (will show many warnings)"
sudo
--set-home
-u
bfa npm
install
web3
runasownerof ~
bfa npm
install
web3
info
"Installing nodejs module: require"
sudo
--set-home
-u
bfa npm
install
require
runasownerof ~
bfa npm
install
require
}
function
golanginstall
...
...
@@ -114,22 +130,16 @@ function golanginstall
function
gethinstall
{
install
--verbose
--owner
=
bfa
--group
=
bfa
--directory
${
NEW
}
cd
${
NEW
}
if
[
-d
go-ethereum
]
if
[
-d
${
NEW
}
/go-ethereum
]
then
info
"Running git pull to ensure that the local go-ethereum repo is up-to-date."
cd
${
NEW
}
/go-ethereum
sudo
-u
bfa git pull
runasownerof
${
NEW
}
/go-ethereum git pull
else
info
"Download geth source code."
sudo
-u
bfa git clone https://github.com/ethereum/go-ethereum
cd
${
NEW
}
/go-ethereum
runasownerof
${
NEW
}
git clone https://github.com/ethereum/go-ethereum
fi
#
info
"Compiling geth"
echo
PATH
=
$PATH
make all
chown
-R
bfa:bfa
.
runasownerof
.
make all
HISBINDIR
=
$(
echo
~bfa/bin
)
install
--verbose
--owner
=
bfa
--group
=
bfa
--directory
${
HISBINDIR
}
install
--verbose
--owner
=
bfa
--group
=
bfa
--target-directory
=
${
HISBINDIR
}
${
NEW
}
/go-ethereum/build/bin/
{
geth,bootnode,abigen,ethkey,puppeth,rlpdump,wnode,swarm,swarm-smoke
}
...
...
@@ -155,29 +165,26 @@ function usersetup
info
"Adding required user
\"
bfa
\"
"
adduser
--disabled-password
--gecos
'Blockchain Federal Argentina'
bfa
fi
cd
~bfa
# If we're running inside a docker, this may already exist but
# probably owned by root. Let's make sure things are proper.
chown
-R
bfa:bfa
.
chown
-R
bfa:bfa
~bfa
#
}
function
userconfig
{
if
[
$(
expand
< .bashrc |
grep
-E
"source
${
BFAHOME
}
/bin/env"
|
wc
-l
)
-eq
0
]
if
[
$(
expand
<
~bfa/
.bashrc |
grep
-E
"source
${
BFAHOME
}
/bin/env"
|
wc
-l
)
-eq
0
]
then
info
"Adding to automatically source
${
BFAHOME
}
/bin/env via .bashrc"
echo
"test -r
${
BFAHOME
}
/bin/env && source
${
BFAHOME
}
/bin/env"
>>
.bashrc
fi
# cloning if not done already, or just update (pull)
if
[
!
-d
"
$BFAHOME
"
]
if
[
!
-d
"
$
{
BFAHOME
}
"
]
then
# initial cloning
git clone https://gitlab.bfa.ar/blockchain/nucleo.git
$BFAHOME
cd
"
$BFAHOME
"
runasownerof
${
BFAHOME
%/*
}
git clone https://gitlab.bfa.ar/blockchain/nucleo.git
$BFAHOME
else
cd
"
$BFAHOME
"
git pull
runasownerof
"
${
BFAHOME
}
"
git pull
fi
if
[
!
-e
"
${
BFAHOME
}
/bin/env"
]
then
...
...
@@ -210,7 +217,8 @@ function setupquestions
then
BFAHOME
=
$(
echo
~bfa/bfa
)
fi
unset
envfile
# Default to production
envfile
=
network/env
if
[
!
-e
"
${
BFAHOME
}
/bin/env"
]
then
REPLY
=
...
...
@@ -225,15 +233,10 @@ function setupquestions
echo
done
fi
case
"
$REPLY
"
in
2
)
envfile
=
test2network/env
;;
*
)
# Default to production
envfile
=
network/env
;;
esac
if
[
"
$REPLY
"
=
"2"
]
then
envfile
=
test2network/env
fi
fi
}
...
...
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