31 lines
1.3 KiB
Bash
Executable File
31 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
################################################################################
|
|
# Author: Fred (support@qo-op.com)
|
|
# Version: 0.1
|
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
|
################################################################################
|
|
# Activate SUPPORT MODE: open ssh over IPFS
|
|
MY_PATH="`dirname \"$0\"`" # relative
|
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
if [[ -f $MY_PATH/.profile ]]; then
|
|
source $MY_PATH/.profile
|
|
elif [[ -f $MY_PATH/../.profile ]]; then
|
|
source $MY_PATH/../.profile
|
|
else
|
|
echo -e "${c_red}Le .profile n'existe pas$c_"
|
|
exit 1
|
|
fi
|
|
cd $GPATH
|
|
|
|
if [[ "$USER" != "root" ]]; then echo "Hey, $USER you must at least be admin of your system (sudo $0)"; exit; fi
|
|
YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
|
if [[ "$YOU" == "" || "$YOU" == "root" ]]; then echo "BAD IPFS. Aucune installation IPFS satisfaisante ici... Ciao $YOU !"; exit; fi
|
|
IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
|
|
# UIDNA NODE
|
|
[[ -f ./wallets/.$IPFSNODEID/$IPFSNODEID.uidna ]] && UIDNA=$(cat ./wallets/.$IPFSNODEID/$IPFSNODEID.uidna) || UIDNA="ssh"
|
|
su $YOU -c "ipfs p2p close --all"
|
|
su $YOU -c "ipfs p2p listen /x/$UIDNA /ip4/127.0.0.1/tcp/22"
|
|
su $YOU -c "ipfs p2p listen /x/$IPFSNODEID /ip4/127.0.0.1/tcp/80"
|
|
echo $(su $YOU -c "ipfs p2p ls")
|
|
|