#!/bin/bash scuttlebutt() { echo -e "${c_yellow}Onboarding SCUTTLEBUTT...$c_" where_is_ssb_installed=$(which ssb-server) where_is_oasis_installed=$(which oasis) mkdir -p ~/.zen BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" if [[ ! $where_is_ssb_installed ]]; then # KILL the BRUTAL WAY... kill -9 $(ps auxf --sort=+utime | grep -w ssb-server| grep -v -E 'color=auto|grep' | tail -n 1 | awk '{print $2}') # Install dependencies sudo apt-get install -y socat python3-dev libtool python3-setuptools autoconf automake # Install nvm if [[ ! $(which nvm) ]]; then curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash source ~/.bashrc export NVM_DIR="$HOME/.nvm" nvm install --lts fi cd ~/.ssb ### Install module npm install -g sodium-native ssb-backlinks ssb-ws ssb-links ssb-query ssb-secret-blob ssb-private npm install -g ssb-server # TODO plugin activation !?? # sbot plugins.enable ### Install oasis & ssb-cli (could replace ssb-server?? TODO: try it) npm -g install fraction/oasis#semver: npm install -g fraction/ssb-daemon # npm install -g ssb-cli # INSTALL sbotc if [[ ! $(which sbotc) ]]; then sudo apt install libsodium-dev jq -y git submodule add https://git.scuttlebot.io/%25133ulDgs%2FoC1DXjoK04vDFy6DgVBB%2FZok15YJmuhD5Q%3D.sha256 sbotc cd sbotc make sudo make install fi fi # TEST ssb-server Install ssbSERVER=$(which ssb-server) [[ $ssbSERVER == "" ]] && echo "Check your ssb-server install... Cannot find it !!" && exit 1 # If exists backup ~/.ssb to ~/.ssb_$USER SSB (one time only !) [[ -d ~/.ssb_$USER ]] && echo "BACKUP already existing... ~/.ssb_$USER !!! Manual check please..." && exit 1 [[ -d ~/.ssb ]] && [[ ! -d ~/.ssb_$USER ]] && mv ~/.ssb ~/.ssb_$USER # CREATE ~/.ssb_astroport [[ ! -d ~/.ssb_astroport ]] && mkdir -p ~/.ssb_astroport && cd ~/.ssb_astroport # if exists, keep ~/.ssb_$USER/secret* [[ ! -f ~/.ssb_astroport/secret ]] && [[ -f ~/.ssb_$USER/secret ]] && cp -f ~/.ssb_$USER/secret* ~/.ssb_astroport/ # Symlink ~/.ssb -> ~/.ssb_astroport [[ -L ~/.ssb ]] && rm ~/.ssb [[ -d ~/.ssb_astroport ]] && ln -s ~/.ssb_astroport ~/.ssb ## #TODO get ~/.ssb/manifest.json from template cp ./templates/ssb/manifest.json ~/.ssb/manifest.json # Create config (TODO: adapt if public Pub or Local Node) # TODO: Create unique hostname in swarm !! uidna nodename=$(cat /etc/hostname) extension=$(echo $nodename | cut -d '.' -f 2) if [[ $extension == $nodename ]]; then PUB="false" nodename=$nodename.local else PUB="true" fi cat > ~/.ssb/config < ~/.zen/launch-oasis.sh <