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
Branches containing commit
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
...
@@ -25,6 +25,23 @@ function info
echo
'***'
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
# For getting a recent nodejs
function
nodejsinstall
function
nodejsinstall
{
{
...
@@ -49,16 +66,15 @@ function nodejsinstall
...
@@ -49,16 +66,15 @@ function nodejsinstall
function
web3install
function
web3install
{
{
cd
~bfa
test
-r
~bfa/package.json
||
test
-r
package.json
||
info
"Initialising nodejs."
&&
info
"Initialising nodejs."
&&
sudo
--set-home
-u
bfa npm init
-y
runasownerof ~
bfa npm init
-y
# nodejs package(s) that we need.
# 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)"
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"
info
"Installing nodejs module: require"
sudo
--set-home
-u
bfa npm
install
require
runasownerof ~
bfa npm
install
require
}
}
function
golanginstall
function
golanginstall
...
@@ -114,22 +130,16 @@ function golanginstall
...
@@ -114,22 +130,16 @@ function golanginstall
function
gethinstall
function
gethinstall
{
{
install
--verbose
--owner
=
bfa
--group
=
bfa
--directory
${
NEW
}
install
--verbose
--owner
=
bfa
--group
=
bfa
--directory
${
NEW
}
cd
${
NEW
}
if
[
-d
${
NEW
}
/go-ethereum
]
if
[
-d
go-ethereum
]
then
then
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."
cd
${
NEW
}
/go-ethereum
runasownerof
${
NEW
}
/go-ethereum git pull
sudo
-u
bfa git pull
else
else
info
"Download geth source code."
info
"Download geth source code."
sudo
-u
bfa git clone https://github.com/ethereum/go-ethereum
runasownerof
${
NEW
}
git clone https://github.com/ethereum/go-ethereum
cd
${
NEW
}
/go-ethereum
fi
fi
#
info
"Compiling geth"
info
"Compiling geth"
echo
PATH
=
$PATH
runasownerof
.
make all
make all
chown
-R
bfa:bfa
.
HISBINDIR
=
$(
echo
~bfa/bin
)
HISBINDIR
=
$(
echo
~bfa/bin
)
install
--verbose
--owner
=
bfa
--group
=
bfa
--directory
${
HISBINDIR
}
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
}
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
...
@@ -155,29 +165,26 @@ function usersetup
info
"Adding required user
\"
bfa
\"
"
info
"Adding required user
\"
bfa
\"
"
adduser
--disabled-password
--gecos
'Blockchain Federal Argentina'
bfa
adduser
--disabled-password
--gecos
'Blockchain Federal Argentina'
bfa
fi
fi
cd
~bfa
# If we're running inside a docker, this may already exist but
# If we're running inside a docker, this may already exist but
# probably owned by root. Let's make sure things are proper.
# probably owned by root. Let's make sure things are proper.
chown
-R
bfa:bfa
.
chown
-R
bfa:bfa
~bfa
#
#
}
}
function
userconfig
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
then
info
"Adding to automatically source
${
BFAHOME
}
/bin/env via .bashrc"
info
"Adding to automatically source
${
BFAHOME
}
/bin/env via .bashrc"
echo
"test -r
${
BFAHOME
}
/bin/env && source
${
BFAHOME
}
/bin/env"
>>
.bashrc
echo
"test -r
${
BFAHOME
}
/bin/env && source
${
BFAHOME
}
/bin/env"
>>
.bashrc
fi
fi
# cloning if not done already, or just update (pull)
# cloning if not done already, or just update (pull)
if
[
!
-d
"
$BFAHOME
"
]
if
[
!
-d
"
$
{
BFAHOME
}
"
]
then
then
# initial cloning
# initial cloning
git clone https://gitlab.bfa.ar/blockchain/nucleo.git
$BFAHOME
runasownerof
${
BFAHOME
%/*
}
git clone https://gitlab.bfa.ar/blockchain/nucleo.git
$BFAHOME
cd
"
$BFAHOME
"
else
else
cd
"
$BFAHOME
"
runasownerof
"
${
BFAHOME
}
"
git pull
git pull
fi
fi
if
[
!
-e
"
${
BFAHOME
}
/bin/env"
]
if
[
!
-e
"
${
BFAHOME
}
/bin/env"
]
then
then
...
@@ -210,7 +217,8 @@ function setupquestions
...
@@ -210,7 +217,8 @@ function setupquestions
then
then
BFAHOME
=
$(
echo
~bfa/bfa
)
BFAHOME
=
$(
echo
~bfa/bfa
)
fi
fi
unset
envfile
# Default to production
envfile
=
network/env
if
[
!
-e
"
${
BFAHOME
}
/bin/env"
]
if
[
!
-e
"
${
BFAHOME
}
/bin/env"
]
then
then
REPLY
=
REPLY
=
...
@@ -225,15 +233,10 @@ function setupquestions
...
@@ -225,15 +233,10 @@ function setupquestions
echo
echo
done
done
fi
fi
case
"
$REPLY
"
in
if
[
"
$REPLY
"
=
"2"
]
2
)
then
envfile
=
test2network/env
envfile
=
test2network/env
;;
fi
*
)
# Default to production
envfile
=
network/env
;;
esac
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