Sort of working

develop
Sven Slootweg 12 years ago
parent b46b841482
commit f4dcb885c8

@ -16,34 +16,36 @@ if [ $? -ne 0 ]; then echo "[X] Adding tahoe user failed."; exit 1; fi
echo "[+] Added tahoe user."
su tahoe
if [ $? -ne 0 ]; then echo "[X] Switching to tahoe user failed."; exit 1; fi
if [ $? -ne 0 ]; then echo "[X] Switching to tahoe user failed."; exit 1; exit 1; fi
cd ~
if [ $? -ne 0 ]; then echo "[X] Navigation to home directory failed."; exit 1; fi
if [ $? -ne 0 ]; then echo "[X] Navigation to home directory failed."; exit 1; exit 1; fi
wget https://tahoe-lafs.org/source/tahoe-lafs/releases/allmydata-tahoe-1.9.1.tar.gz >/dev/null 2>/dev/null
if [ $? -ne 0 ]; then echo "[X] Downloading Tahoe-LAFS failed."; exit 1; fi
if [ $? -ne 0 ]; then echo "[X] Downloading Tahoe-LAFS failed."; exit 1; exit 1; fi
echo "[+] Downloaded Tahoe-LAFS."
tar -xzvf allmydata-tahoe-1.9.1.tar.gz >/dev/null 2>/dev/null
if [ $? -ne 0 ]; then echo "[X] Unpacking Tahoe-LAFS failed."; exit 1; fi
if [ $? -ne 0 ]; then echo "[X] Unpacking Tahoe-LAFS failed."; exit 1; exit 1; fi
echo "[+] Unpacked Tahoe-LAFS."
cd allmydata-tahoe-1.9.1
if [ $? -ne 0 ]; then echo "[X] Navigating to Tahoe-LAFS source directory failed."; exit 1; fi
if [ $? -ne 0 ]; then echo "[X] Navigating to Tahoe-LAFS source directory failed."; exit 1; exit 1; fi
echo "[!] I am now going to build Tahoe-LAFS, this is going to take a while. It's recommended to use this time to retrieve a beverage of your choice :)"
echo "[!] Building..."
python setup.py build >/dev/null 2>/dev/null
if [ $? -ne 0 ]; then echo "[X] Building Tahoe-LAFS failed."; exit 1; fi
if [ $? -ne 0 ]; then echo "[X] Building Tahoe-LAFS failed."; exit 1; exit 1; fi
echo "[+] Successfully built Tahoe-LAFS."
cd bin
if [ $? -ne 0 ]; then echo "[X] Navigation to Tahoe-LAFS binary directory failed."; exit 1; fi
if [ $? -ne 0 ]; then echo "[X] Navigation to Tahoe-LAFS binary directory failed."; exit 1; exit 1; fi
./tahoe create-node >/dev/null 2>/dev/null
if [ $? -ne 0 ]; then echo "[X] Creation of Tahoe-LAFS storage node failed."; exit 1; fi
if [ $? -ne 0 ]; then echo "[X] Creation of Tahoe-LAFS storage node failed."; exit 1; exit 1; fi
echo "[+] Storage node created."
stat --format=%Y ~/.tahoe/tahoe.cfg > ~/tahoe_setup_time
ENDSSH
if [ $? -ne 0 ]; then
@ -56,15 +58,26 @@ echo "[!] Press enter to continue."
read
echo "[ ] There goes..."
ssh -t "root@$HOST" 2>/dev/null nano /home/tahoe/.tahoe/tahoe.cfg
echo "[+] Configuration done."
ssh -t -T "root@$HOST" 2>/dev/null <<'ENDSSH'
su tahoe
OLDTIME="$(cat ~/tahoe_setup_time)"
rm ~/tahoe_setup_time
if [ "$(stat --format=%Y ~/.tahoe/tahoe.cfg)" == $OLDTIME ]; then echo "[X] You did not save the config file, cancellation assumed and installation aborted."; exit 1; exit 1; fi
echo "[+] Configuration done."
cd ~/allmydata-tahoe-1.9.1/bin
./tahoe start >/dev/null 2>/dev/null
if [ $? -ne 0 ]; then echo "[X] Starting the Tahoe-LAFS node failed, something went wrong."; exit 1; fi
if [ $? -ne 0 ]; then echo "[X] Starting the Tahoe-LAFS node failed, something went wrong."; exit 1; exit 1; fi
ENDSSH
if [ $? -ne 0 ]; then
RESULT=$?
echo "$RESULT"
if [ $RESULT -ne 0 ]; then
echo "[X] An error occurred during setup, the script will now exit."
exit 1
fi

Loading…
Cancel
Save