Skip to content
Snippets Groups Projects
Commit 21b4b2de authored by Robert Martin-Legene's avatar Robert Martin-Legene
Browse files

Fixing file permissions

parent b9b056ce
No related branches found
No related tags found
No related merge requests found
...@@ -32,15 +32,15 @@ function nodejsinstall ...@@ -32,15 +32,15 @@ function nodejsinstall
# 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
info Adding nodejs software repository PGP key info "Adding 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" ]
then then
info Adding nodejs repository to apt sources. info "Adding nodejs repository to apt sources."
echo "deb https://deb.nodesource.com/node_10.x $(lsb_release -sc) main" > $file echo "deb https://deb.nodesource.com/node_10.x $(lsb_release -sc) main" > $file
info And now updating the software package list. info "And now updating the software package list."
apt update apt update
fi fi
# nodejs also provides npm # nodejs also provides npm
...@@ -49,14 +49,15 @@ function nodejsinstall ...@@ -49,14 +49,15 @@ function nodejsinstall
function web3install function web3install
{ {
test -r ~bfa/package.json || cd ~bfa
info Initialising nodejs. && test -r package.json ||
info "Initialising nodejs." &&
sudo --set-home -u bfa npm init -y sudo --set-home -u 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")' | sudo --set-home -u 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 sudo --set-home -u bfa npm install web3
info Installing nodejs module: require info "Installing nodejs module: require"
sudo --set-home -u bfa npm install require sudo --set-home -u bfa npm install require
} }
...@@ -64,16 +65,16 @@ function golanginstall ...@@ -64,16 +65,16 @@ function golanginstall
{ {
if [ ! -d /usr/local/go ] if [ ! -d /usr/local/go ]
then then
info Downloading package of go binaries. info "Downloading package of go binaries."
mkdir -p ${NEW} mkdir -p ${NEW}
cd ${NEW} cd ${NEW}
local arch= local arch=$( uname -m )
case "$(uname -m)" in case "${arch}" in
x86_64) x86_64)
arch=amd64 arch=amd64
;; ;;
*) *)
echo Do not know how to help you. >&2 echo "We have no recipe for how to build on your \"${arch}\" platform." >&2
exit 1 exit 1
;; ;;
esac esac
...@@ -100,7 +101,7 @@ function golanginstall ...@@ -100,7 +101,7 @@ function golanginstall
fi fi
# Integrity checking the archive # Integrity checking the archive
tar -xzf "$name" tar -xzf "$name"
info Unpacking $name into /usr/local info "Unpacking $name into /usr/local"
tar -C /usr/local -xzf go*.tar.gz tar -C /usr/local -xzf go*.tar.gz
fi fi
PATH=${PATH}:/usr/local/go/bin PATH=${PATH}:/usr/local/go/bin
...@@ -108,21 +109,24 @@ function golanginstall ...@@ -108,21 +109,24 @@ function golanginstall
function gethinstall function gethinstall
{ {
mkdir -p ${NEW} install --verbose --owner=bfa --group=bfa --directory ${NEW}
cd ${NEW} cd ${NEW}
info Download geth source code. if [ -d go-ethereum ]
test -d go-ethereum || then
git clone https://github.com/ethereum/go-ethereum info "Running git pull to ensure that the local go-ethereum repo is up-to-date."
cd ${NEW}/go-ethereum cd ${NEW}/go-ethereum
info Running git pull to ensure that the local go-ethereum repo is up-to-date. sudo -u bfa git pull
git pull else
info "Download geth source code."
sudo -u bfa git clone https://github.com/ethereum/go-ethereum
cd ${NEW}/go-ethereum
fi
# #
cd ${NEW}/go-ethereum info "Compiling geth"
info Compiling geth sudo -u bfa make all
make all HISBINDIR=$( echo ~bfa/bfa )
mkdir -p ~bfa/bin install --verbose --owner=bfa --group=bfa --directory ${HISBINDIR}
cp -vp ${NEW}/go-ethereum/build/bin/{geth,bootnode,abigen,ethkey,puppeth,rlpdump,wnode,swarm,swarm-smoke} ~bfa/bin/ install --verbose --owner=bfa --group=bfa --target-directory=${HISBINDIR} ${NEW}/go-ethereum/build/bin/{geth,bootnode,abigen,ethkey,puppeth,rlpdump,wnode,swarm,swarm-smoke}
chown -R bfa:bfa ~bfa
} }
function aptinstall function aptinstall
...@@ -132,7 +136,7 @@ function aptinstall ...@@ -132,7 +136,7 @@ function aptinstall
# consider apt install --install-suggests if you are masochist # consider apt install --install-suggests if you are masochist
dpkg --verify $pkg 2>/dev/null || dpkg --verify $pkg 2>/dev/null ||
( (
info Installing $pkg info "Installing $pkg"
apt -y install $pkg apt -y install $pkg
) )
done done
...@@ -142,7 +146,7 @@ function usersetup ...@@ -142,7 +146,7 @@ function usersetup
{ {
if ! id bfa >/dev/null 2>&1 if ! id bfa >/dev/null 2>&1
then then
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 cd ~bfa
...@@ -180,7 +184,7 @@ function cronit ...@@ -180,7 +184,7 @@ function cronit
{ {
if [ $( ( crontab -u bfa -l 2>/dev/null || true ) | grep -E "$BFAHOME/bin/cron.sh" | wc -l ) -eq 0 ] if [ $( ( crontab -u bfa -l 2>/dev/null || true ) | grep -E "$BFAHOME/bin/cron.sh" | wc -l ) -eq 0 ]
then then
info Install crontab to start automatically upon reboot info "Install crontab to start automatically upon reboot"
(( crontab -u bfa -l 2>/dev/null || true ) ; echo "@reboot $BFAHOME/bin/cron.sh" ) | crontab -u bfa - (( crontab -u bfa -l 2>/dev/null || true ) ; echo "@reboot $BFAHOME/bin/cron.sh" ) | crontab -u bfa -
fi fi
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment