forked from axiom-team/astroport
ssb install fix
This commit is contained in:
parent
98f844c5de
commit
135a05291e
|
@ -1,16 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
scuttlebutt() {
|
scuttlebutt() {
|
||||||
|
|
||||||
echo -e "${c_yellow}Onboarding SCUTTLEBUTT...$c_"
|
echo -e "${c_yellow}Onboarding SCUTTLEBUTT...$c_"
|
||||||
where_is_ssb_installed=$(which ssb-server)
|
where_is_ssb_installed=$(which ssb-server)
|
||||||
|
|
||||||
# Install npm_modules in ~/.zen/fatlayer_install
|
|
||||||
mkdir -p ~/.zen/fatlayer_install
|
|
||||||
|
|
||||||
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
if [[ ! $where_is_ssb_installed ]]; then
|
if [[ ! $where_is_ssb_installed ]]; then
|
||||||
cd ~/.zen/fatlayer_install
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
sudo apt-get install -y socat python3-dev libtool python3-setuptools autoconf automake
|
sudo apt-get install -y socat python3-dev libtool python3-setuptools autoconf automake
|
||||||
|
|
||||||
|
@ -19,7 +14,8 @@ scuttlebutt() {
|
||||||
source ~/.bashrc
|
source ~/.bashrc
|
||||||
nvm install --lts
|
nvm install --lts
|
||||||
|
|
||||||
# Install sbot-server
|
# Install ssb-server and config in ~/.ssb_astroport
|
||||||
|
[[ ! -d ~/.ssb_astroport ]] && mkdir -p ~/.ssb_astroport && cd ~/.ssb_astroport
|
||||||
npm install sodium-native ssb-backlinks ssb-ws ssb-links ssb-query
|
npm install sodium-native ssb-backlinks ssb-ws ssb-links ssb-query
|
||||||
npm install -g ssb-server
|
npm install -g ssb-server
|
||||||
fi
|
fi
|
||||||
|
@ -29,11 +25,10 @@ scuttlebutt() {
|
||||||
[[ $ssbSERVER == "" ]] && echo "Check your ssb-server install... Cannot find it !!" && exit 1
|
[[ $ssbSERVER == "" ]] && echo "Check your ssb-server install... Cannot find it !!" && exit 1
|
||||||
|
|
||||||
# BACKUP OLD SSB
|
# BACKUP OLD SSB
|
||||||
[[ -d ~/.ssb ]] && mv ~/.ssb ~/.ssb.$USER # BACKUP OLD SSB
|
[[ -d ~/.ssb ]] && [[ ! -d ~/.ssb.$USER ]] && mv ~/.ssb ~/.ssb.$USER # BACKUP OLD SSB
|
||||||
|
|
||||||
# MAKE A LINK ~/.ssb.astroport to ~/.ssb
|
# MAKE A LINK ~/.ssb_astroport to ~/.ssb
|
||||||
mkdir ~/.ssb.astroport
|
[[ -L ~/.ssb ]] && rm ~/.ssb && ln -s ~/.ssb_astroport ~/.ssb
|
||||||
ln -s ~/.ssb.astroport ~/.ssb
|
|
||||||
|
|
||||||
# Create config (TODO: adapt if public Pub or Local Node)
|
# Create config (TODO: adapt if public Pub or Local Node)
|
||||||
nodename=$(cat /etc/hostname)
|
nodename=$(cat /etc/hostname)
|
||||||
|
@ -83,20 +78,21 @@ EOF
|
||||||
|
|
||||||
# Store current user as sudo will change it
|
# Store current user as sudo will change it
|
||||||
currentUser=$USER
|
currentUser=$USER
|
||||||
|
[[ -f /etc/systemd/system/ssb.service ]] && rm -f /etc/systemd/system/ssb.service
|
||||||
# Copy SYSTEMD service to correct location
|
# Copy SYSTEMD service to correct location
|
||||||
cp "$BASE_DIR/ssb.service" /tmp/ssb.service
|
sudo cp "$BASE_DIR/ssb.service" /tmp/ssb.service
|
||||||
# Copy repplace __USER__ place holder to current user
|
# Copy repplace __USER__ place holder to current user
|
||||||
sed -i "s|__USER__|${currentUser}|g" /tmp/ssb.service
|
sudo sed -i "s|__USER__|${currentUser}|g" /tmp/ssb.service
|
||||||
sed -i "s|__SSBSERVER__|${ssbSERVER}|g" /tmp/ssb.service
|
sudo sed -i "s|__SSBSERVER__|ssb-server|g" /tmp/ssb.service
|
||||||
|
|
||||||
echo -e "${c_yellow}Installing ssb.service...$c_"
|
|
||||||
sudo mv /tmp/ssb.service /etc/systemd/system/ssb.service
|
sudo mv /tmp/ssb.service /etc/systemd/system/ssb.service
|
||||||
|
|
||||||
# Reload, Enable and start SSB Service
|
# Reload, Enable and start SSB Service
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
sudo systemctl enable ssb.service
|
sudo systemctl enable ssb.service
|
||||||
sudo systemctl start ssb.service
|
sudo systemctl restart ssb.service
|
||||||
|
|
||||||
|
sudo systemctl status ssb.service
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue