Sort of working

develop
Sven Slootweg 13 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." echo "[+] Added tahoe user."
su tahoe 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 ~ 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 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." echo "[+] Downloaded Tahoe-LAFS."
tar -xzvf allmydata-tahoe-1.9.1.tar.gz >/dev/null 2>/dev/null 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." echo "[+] Unpacked Tahoe-LAFS."
cd allmydata-tahoe-1.9.1 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 "[!] 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..." echo "[!] Building..."
python setup.py build >/dev/null 2>/dev/null 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." echo "[+] Successfully built Tahoe-LAFS."
cd bin 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 ./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." echo "[+] Storage node created."
stat --format=%Y ~/.tahoe/tahoe.cfg > ~/tahoe_setup_time
ENDSSH ENDSSH
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
@ -56,15 +58,26 @@ echo "[!] Press enter to continue."
read read
echo "[ ] There goes..." echo "[ ] There goes..."
ssh -t "root@$HOST" 2>/dev/null nano /home/tahoe/.tahoe/tahoe.cfg 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' ssh -t -T "root@$HOST" 2>/dev/null <<'ENDSSH'
su tahoe 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 cd ~/allmydata-tahoe-1.9.1/bin
./tahoe start >/dev/null 2>/dev/null ./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 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." echo "[X] An error occurred during setup, the script will now exit."
exit 1 exit 1
fi fi

Loading…
Cancel
Save