dogi / ole--vagrant-community

0 stars 19 forks source link

Uninstall script to help with testing #19

Open pranesh-s opened 8 years ago

pranesh-s commented 8 years ago
DrewPerlman commented 8 years ago

Thanks for opening this issue @pranesh-s. To go into more detail about this issue, we'd like to have an uninstall script that reverses/"undo's" everything that the install script does so we can test that the install script is doing its job.

sthak004 commented 8 years ago

@DrewPerlman What do you mean by a second install script? Are there two?

Hulmani commented 8 years ago

@DrewPerlman could you please elaborate on this?

sthak004 commented 8 years ago

@DrewPerlman I am currently researching and working on this issue. Would it be more helpful if I created a windows batch script to uninstall bonjour and putty as done in https://github.com/dogi/ole--vagrant-community/blob/master/windows/bonjour_putty_installation.bat as a method of testing?

DrewPerlman commented 8 years ago

Sorry for the late response @sthak004 and @Hulmani. What I meant was we need an install script that installs all the required components AND an uninstall script to remove all of those components in order to test that the install script is working. Does that make sense?

And @sthak004, if the install script adds bonjour and putty to the system (not sure if putty is going to be necessary in the install script fyi), then the UNinstall script should remove them. To start off, however, I would probably go in the direction of uninstalling the vagrant machine and virtualbox.

sthak004 commented 8 years ago

@DrewPerlman I have submitted https://github.com/dogi/ole--vagrant-community/pull/20 I'm not sure if this was the method you wanted the file in (as opposed a zip file or something else). Please let me know if this is acceptable and if so, I'd like to pass it over to other Windows users to test.

Hulmani commented 8 years ago

Please help test this uninstall script on mac.

This works if brew cask is installed and the virtualbox and vagrant installed using brew cask. [The install script will be installing brew cask to install * virtualbox and vagrant * and hence brew cask is assumed to be installed]

#!/bin/bash

#assuming brew cask is installed (via install script);
VB="virtualbox";
VG="vagrant";
cask_list=`brew cask list`;

vb=$(echo "$cask_list" | grep "$VB" );
vg=$(echo "$cask_list" | grep "$VG" );

#the variables vb and vg contain the value "virtaulbox" and "vagrant" respectively if they are installed
if [[ $vb == "$VB" ]] ; then
echo "unistalling virtual box";
brew cask uninstall virtualbox;
else
echo 'virtualbox not installed'
fi

if [[ $vg == "$VG" ]] ; then
echo "unistalling vagrant";
brew cask uninstall vagrant;
else
echo 'vagrant not installed'
fi

1) save this script as uninstall.sh. 2) chmod +x uninstall.sh 3) ./uninstall.sh

Please enter the password to complete the steps. Please comment to let me know the issues with the script

sthak004 commented 8 years ago

@DrewPerlman I am working on uninstalling Git from Windows machines. I can try and uninstall Git from the virtualbox_and_vagrant uninstaller script as an add-on if you'd like or I can create a different script for it. Is there a preference that you or @dogi would rather see?

DrewPerlman commented 8 years ago

@Hulmani I personally can't test your script because I don't have a Mac, but it looks good! Please submit a pull request with your code.

@sthak004 I think it'd be better add the Git uninstall to the uninstall script you've already made instead of creating a new script in order to keep it more streamlined.

EmilyLarkin commented 8 years ago

@Hulmani: @DrewPerlman and @dogi tested your script and this was the output:

emily@scout ~/ole--vagrant-community/macosx $ ./uninstall.sh
Warning: The default Caskroom location has moved to /usr/local/Caskroom.

Please migrate your Casks to the new location and delete /opt/homebrew-cask/Caskroom,
or if you would like to keep your Caskroom at /opt/homebrew-cask/Caskroom, add the
following to your HOMEBREW_CASK_OPTS:

  --caskroom=/opt/homebrew-cask/Caskroom

For more details on each of those options, see https://github.com/caskroom/homebrew-cask/issues/21913.
virtualbox not installed
vagrant not installed
Hulmani commented 8 years ago

@EmilyLarkin @dogi while installing vagrant and virtualbox, we have to use brew cask to install them. Please see this link. So if we use this link to download vagrant, the script is unable to recognize as it is using brew casks. As we are using script to install and uninstall software, I assumed we will use brew cask.

Please try this to uninstall vagrant and if you have installed virtual box the from the website, uninstall virtual box from deleting it from the applications directory. right click virtual box in the applications directory and click on move to trash

After you delete the two, please run

brew cask install virtualbox brew cask install vagrant

then run the uninstall script.

I will soon update on install script.

sthak004 commented 7 years ago

@dogi @DrewPerlman So, I have hit a bit of a roadblock in incorporating Git into the virtualbox and vagrant uninstaller script.

I realized that both vagrant and virtualbox use MSI uninstallers, while Git does not

The issue here: Incorporating Git into my script as it is now, will cause the code to become longer and unnecessarily messy, as compensating for Git having its own uninstaller would mean the newly added code would not keep the script as modular as possible.

My suggestion:

Create a new uninstall script for Git and call it from the vagrant_virtualbox_uninstaller.bat script.

DrewPerlman commented 7 years ago

@Hulmani Okay, I'll try that soon and let you know the results.

@sthak004 Your solution of having a different uninstall script for Git and calling it from the other uninstall script sounds good! :smile:

DrewPerlman commented 7 years ago

@Hulmani Just tried your instructions above with brew cask and using your uninstall.sh and it worked! :smile:

sthak004 commented 7 years ago

@DrewPerlman I have submitted a PR https://github.com/dogi/ole--vagrant-community/pull/25

I have wrote in the PR message, but just to reiterate, I could not find a way disable any GUI interface from appearing when GIt is being uninstalled. It is however, considered a silent uninstall so the user doesn't have to interact in any way and it only lasts momentarily.

sthak004 commented 7 years ago

@DrewPerlman Also, I apologize for the script naming because I forgot to change those, but in order to uninstall VirtualBox, Vagrant, and Git you would simply call virtualbox_vagrant_uninstaller.bat since it calls the git_uninstaller script within it.

TODO: I will make the changes shortly to improve clarity.