This commit is contained in:
qo-op 2020-03-27 04:04:25 +01:00
commit 8463f23d73
5 changed files with 54 additions and 21 deletions

View File

@ -1,12 +1,26 @@
# Install IPFS
ipfs() {
echo -e "${c_yellow}Onboarding IPFS...$c_"
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
#!/bin/bash
is_ipfs_update_installed=$(which ipfs-update)
if [[ ! $is_ipfs_update_installed ]]; then
# Install IPFS
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
## Config
diskSize="5G"
templates="$MY_PATH/templates/ipfs"
if [ "$EUID" -eq 0 ]
then echo -e "${c_red}Veuillez ne pas executez ce script en root. Choisissez un utilisateur pour votre serveur G1sms+ (nous recommandons l'utilisateur pi)$c_"
exit 1
else echo -e "${c_yellow}OK $USER, let's go!$c_";
fi
[[ -d ~/.ipfs-old/ ]] && echo "Backup exist, please remove backup before execute this script" && exit 1
[[ -d ~/.ipfs/ ]] && rm -rf ~/.ipfs-old && mv ~/.ipfs/ ~/.ipfs-old
ipfs_install() {
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
@ -23,19 +37,41 @@ ipfs() {
echo "INSTALL latest ipfs"
sudo ipfs-update install latest || err+="Install IPFS"
fi
if [[ ! -f /etc/systemd/system/ipfs.service ]]; then
echo "CREATE SYSTEMD ipfs SERVICE"
sudo cp -f $BASE_DIR/ipfs.service /etc/systemd/system/
sudo sed -i "s/_USER/$USER/g" /etc/systemd/system/ipfs.service
sudo systemctl daemon-reload || err+="Reload systemd"
echo "CREATE SYSTEMD ipfs SERVICE"
[[ -f /etc/systemd/system/ipfs.service ]] && sudo rm /etc/systemd/system/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"
# DO NOT START YET... Must get IPFS swarm.key from a G1SSB Pub !!
fi
sudo systemctl stop ipfs
echo "ipfs OK. Daemon stop... continue..."
################
# BECOME $USER
# INIT ipfs
ipfs init -p lowpower
# ipfs init -p server ## Uncomment for server infrastructure
# ACTIVATE CONFIG OPTIONS
# PUBSUB
ipfs config Pubsub.Router gossipsub
# MAXSTORAGE
ipfs config Datastore.StorageMax $diskSize
## PORT FORWARD (SSH)
ipfs config --json Experimental.Libp2pStreamMounting true
######### UPDATE BOOTSTRAP LIST ###########
ipfs bootstrap rm --all
sudo systemctl daemon-reload || err+="Restart IPFS"
}
$@
ipfs_install
exit 0

View File

@ -51,9 +51,6 @@ $MY_PATH/.install/export_colors.sh
# --------------------------------------------
# Install IPFS
source .install/ipfs.sh
# Install ScuttleButt
source .install/scuttlebutt.sh
@ -71,7 +68,7 @@ iptubes() {
functions=$(declare -F | awk '{print $NF}' | sort | egrep -v "^_" )
## Check IPFS install
[[ -z $(which ipfs) ]] && ipfs
[[ -z $(which ipfs) ]] && source .install/ipfs.sh
echo -e "${c_green}Astroport UP$c_"
[[ -z $args ]] && echo -e "Select a gate to install:" && read apps

@ -1 +1 @@
Subproject commit 24847070307a3342d5d3237aedfe118fc3bc2284
Subproject commit 9bb02920fda14aa064f49a243369cd7a4acb61f4