This is easily solved by putting everything in a bash function and calling the function as the last thing in the script. If you look at the Cloud SDK setup script, that is exactly what it does.
Re:Announcing Google Cloud Bigtable
by lukeschlather on Wednesday May 06, 2015 @03:33PM
(#9501255)
I agree it's a trivial problem to solve, I just think the right way is to download the code and store it separately, so that it's easy to add checksum/signature validation later.
rm -rf ~/.config/google
and the connection gives out at
rm -rf ~/
Suddenly your script didn't install, and you've blown away your home directory. HTTP(S) is designed for reading documents, where it's OK if you can't read the document in its entirety.