From c2766585d405a3127ada775af5e769f9ee951f67 Mon Sep 17 00:00:00 2001 From: qo-op Date: Thu, 30 Apr 2020 02:51:50 +0200 Subject: [PATCH] sbotc --- .install/ipfs.sh | 84 +++++++++++++++++----------------- zen/tools/make_G1SSB_secret.sh | 12 ++++- 2 files changed, 53 insertions(+), 43 deletions(-) diff --git a/.install/ipfs.sh b/.install/ipfs.sh index 08c520a..eedc570 100755 --- a/.install/ipfs.sh +++ b/.install/ipfs.sh @@ -1,5 +1,5 @@ #!/bin/bash - +ipfs() { # Install IPFS MY_PATH="`dirname \"$0\"`" # relative @@ -16,54 +16,54 @@ fi [[ -d ~/.ipfs ]] && echo "IPFS install exist, please remove backup before execute this script" && exit 1 - echo -e "${c_yellow}Onboarding IPFS...$c_" - [[ -f /usr/local/bin/ipfs ]] && sudo service ipfs stop - if [[ $ARM == "yes" ]]; then - wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-arm.tar.gz -O $MY_PATH/ipfs-update.tar.gz || err+="Download ipfs-update" - else - wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-amd64.tar.gz -O $MY_PATH/ipfs-update.tar.gz || err+="Download ipfs-update" - fi - - echo "INSTALL ipfs-update" - sudo tar -xvzf $MY_PATH/ipfs-update.tar.gz -C /usr/src/ || err+="Untar ipfs-update" - rm $MY_PATH/ipfs-update.tar.gz - cd /usr/src/ipfs-update/ - sudo ./install.sh || err+="Install ipfs-update" - cd $MY_PATH - - echo "INSTALL latest ipfs" - sudo ipfs-update install latest || err+="Install IPFS" +echo -e "${c_yellow}Onboarding IPFS...$c_" +[[ -f /usr/local/bin/ipfs ]] && sudo service ipfs stop - if [[ ! -f /etc/systemd/system/ipfs.service ]]; then +if [[ $ARM == "yes" ]]; then + wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-arm.tar.gz -O $MY_PATH/ipfs-update.tar.gz || err+="Download ipfs-update" +else + wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-amd64.tar.gz -O $MY_PATH/ipfs-update.tar.gz || err+="Download ipfs-update" +fi - echo "CREATE SYSTEMD ipfs SERVICE" - sudo cp -f $templates/ipfs.service /etc/systemd/system/ - sudo sed -i "s/_USER/$USER/g" /etc/systemd/system/ipfs.service - fi - sudo systemctl daemon-reload || err+="Restart IPFS" - sudo systemctl enable ipfs || err+="Enable IPFS daemon" +echo "INSTALL ipfs-update" +sudo tar -xvzf $MY_PATH/ipfs-update.tar.gz -C /usr/src/ || err+="Untar ipfs-update" +rm $MY_PATH/ipfs-update.tar.gz +cd /usr/src/ipfs-update/ +sudo ./install.sh || err+="Install ipfs-update" +cd $MY_PATH - ################ - # BECOME $USER - # INIT ipfs - ipfs init -p lowpower - # ipfs init -p server ## Uncomment for server infrastructure +echo "INSTALL latest ipfs" +sudo ipfs-update install latest || err+="Install IPFS" - # ACTIVATE CONFIG OPTIONS - # PUBSUB - ipfs config Pubsub.Router gossipsub - # MAXSTORAGE - availableDiskSize=$(df -P ~/ | awk 'NR>1{sum+=$4}END{print sum}') - diskSize="$((availableDiskSize / 2))" - ipfs config Datastore.StorageMax $diskSize - ## PORT FORWARD (SSH) - ipfs config --json Experimental.Libp2pStreamMounting true +echo "CREATE SYSTEMD ipfs SERVICE" +sudo cp -f $templates/ipfs.service /etc/systemd/system/ +sudo sed -i "s/_USER/$USER/g" /etc/systemd/system/ipfs.service + +sudo systemctl daemon-reload || err+="Restart IPFS" +sudo systemctl enable ipfs || err+="Enable IPFS daemon" - ######### UPDATE BOOTSTRAP LIST ########### - ipfs bootstrap rm --all +# INIT ipfs +ipfs init -p lowpower +# ipfs init -p server ## Uncomment for server infrastructure - sudo systemctl daemon-reload || err+="Restart IPFS" +# ACTIVATE CONFIG OPTIONS +# PUBSUB +ipfs config Pubsub.Router gossipsub +# MAXSTORAGE +availableDiskSize=$(df -P ~/ | awk 'NR>1{sum+=$4}END{print sum}') +diskSize="$((availableDiskSize / 2))" +ipfs config Datastore.StorageMax $diskSize +## PORT FORWARD (SSH) +ipfs config --json Experimental.Libp2pStreamMounting true + +######### UPDATE BOOTSTRAP LIST ########### +ipfs bootstrap rm --all + +sudo systemctl restart ipfs || err+="Restart IPFS daemon" exit 0 +} + +$@ diff --git a/zen/tools/make_G1SSB_secret.sh b/zen/tools/make_G1SSB_secret.sh index a55730b..2cb378c 100755 --- a/zen/tools/make_G1SSB_secret.sh +++ b/zen/tools/make_G1SSB_secret.sh @@ -25,13 +25,23 @@ __) _|_ |_ |\ /--\ \_| mkdir -p ~/.zen sudo apt update || true libzzz=$(sudo apt-cache search libsodium | awk '{print $1}' | grep libsodium2) - sudo apt install build-essential $libzzz -y + sudo apt install build-essential jq $libzzz -y sudo pip3 install base58 sudo apt install python3-pip python3-setuptools python3-wheel -y pip3 install silkaj --user echo 'PATH=$PATH:~/.local/bin' >> ~/.bashrc && source ~/.bashrc fi +# INSTALL sbotc +if [[ ! $(which sbotc) ]]; then + cd /tmp + sudo apt install libsodium-dev jq -y + git clone https://git.scuttlebot.io/%25133ulDgs%2FoC1DXjoK04vDFy6DgVBB%2FZok15YJmuhD5Q%3D.sha256 sbotc + cd sbotc + make + sudo make install + cd $MY_PATH +fi if [[ -d ~/.ssb ]]; then echo "ScuttleButt is already installed...??"