ssb install fix

This commit is contained in:
qo-op 2020-03-23 20:52:51 +01:00
parent 98f844c5de
commit 135a05291e
1 changed files with 12 additions and 16 deletions

View File

@ -1,16 +1,11 @@
#!/bin/bash
scuttlebutt() {
echo -e "${c_yellow}Onboarding SCUTTLEBUTT...$c_"
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)"
if [[ ! $where_is_ssb_installed ]]; then
cd ~/.zen/fatlayer_install
# Install dependencies
sudo apt-get install -y socat python3-dev libtool python3-setuptools autoconf automake
@ -19,7 +14,8 @@ scuttlebutt() {
source ~/.bashrc
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 -g ssb-server
fi
@ -29,11 +25,10 @@ scuttlebutt() {
[[ $ssbSERVER == "" ]] && echo "Check your ssb-server install... Cannot find it !!" && exit 1
# 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
mkdir ~/.ssb.astroport
ln -s ~/.ssb.astroport ~/.ssb
# MAKE A LINK ~/.ssb_astroport to ~/.ssb
[[ -L ~/.ssb ]] && rm ~/.ssb && ln -s ~/.ssb_astroport ~/.ssb
# Create config (TODO: adapt if public Pub or Local Node)
nodename=$(cat /etc/hostname)
@ -83,20 +78,21 @@ EOF
# Store current user as sudo will change it
currentUser=$USER
[[ -f /etc/systemd/system/ssb.service ]] && rm -f /etc/systemd/system/ssb.service
# 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
sed -i "s|__USER__|${currentUser}|g" /tmp/ssb.service
sed -i "s|__SSBSERVER__|${ssbSERVER}|g" /tmp/ssb.service
sudo sed -i "s|__USER__|${currentUser}|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
# Reload, Enable and start SSB Service
sudo systemctl daemon-reload
sudo systemctl enable ssb.service
sudo systemctl start ssb.service
sudo systemctl restart ssb.service
sudo systemctl status ssb.service
}