Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to uninstall devon-ide #69

Closed
hohwille opened this issue Apr 1, 2019 · 10 comments · Fixed by #96
Closed

Ability to uninstall devon-ide #69

hohwille opened this issue Apr 1, 2019 · 10 comments · Fixed by #96
Labels
enhancement New feature or request scripts related to shell scripts (bash and CMD)
Milestone

Comments

@hohwille
Copy link
Member

hohwille commented Apr 1, 2019

The main setup[.bat] script delegates to devon ide setup what "installs" the devon-ide.
As devon-ide aims to be portable and minimal invasiv to your OS it only does little tweaks on your system. However, there are some:

  • ~/.devon folder
  • ~/scripts/devon.bat (on windows)
  • adding ~/scripts to your PATH (on windows)
  • Windows registry entries for explorer integration (e.g. system/windows/cmd/*.reg)
  • MacOS workflows for finder integration

A good pice of software should always provide an automated way to "uninstall" itself if the user does not want to have it anymore. Also this might be a way to repair or upgrade an installation if the according central scripts or hooks may have changed.

@hohwille hohwille added enhancement New feature or request scripts related to shell scripts (bash and CMD) labels Apr 1, 2019
@markusschuh
Copy link
Member

markusschuh commented Apr 1, 2019

Wrt to removal of the registry value:
If devon-ide would use its own directory key - named "devonfw" - the removal would be just a
"%Systemroot%\system32\reg delete HKCU\Software\Classes\Folder\shell\devonfw /f

But the registry key used so far within the devon-cmd.reg makes it a bit harder:

  1. it uses "HKCR". This is the logic "unified" registry path which mixes administrative and user keys within one tree. It can be used for write - but the resulting path depends on the current right level of the user. So most already written keys will have been saved at
    HKCU\Software\Classes\Folder\shell\cmd
    but some may have beend saved at
    HKLM\Software\Classes\Folder\shell\cmd

  2. The subkey "cmd" should match to the specific application using it. Quite some application define their own subkeys (though many may use Classes\Directory instead, which is the same as Folder - but matched for directories on local filesystems only). The "cmd" could be used by others - so it would be more friendly in this case to not remove the whole tree without another check, the values saved there are as expected.

I favorize to also change the setup of this explorer integration to be realized in its own key at user level:

"%SystemRoot%\system32\reg" add HKCU\Software\Classes\Folder\shell\devonfw\command
"%SystemRoot%\system32\reg" add HKCU\Software\Classes\Folder\shell\devonfw /ve /t REG_SZ /d "Open Devon CMD here" /f
"%SystemRoot%\system32\reg" add HKCU\Software\Classes\Folder\shell\devonfw\command /ve /t REG_SZ /d "cmd.exe /s /k pushd \"%V\" && devon" /f

but in that case it may still be necessary to write some "remove keys from older oasp / devon" versions.

hohwille added a commit that referenced this issue Apr 2, 2019
* #73: fix for load_properties in bash
* #68: fixed
* #61: allow "devon bash" to open bash on windows
* #61: automatically call devon initialization when bash or zsh is opened
* #69: support uninstall
* #69: fixed quotation, also support upgrade
* #43: doc update
* #64: applied fixes from PR
@hohwille
Copy link
Member Author

hohwille commented Apr 2, 2019

Uninstalling devon-ide...
/c/projects/beta3-latest/scripts/command/ide: line 92:  grep: command not found
/c/projects/beta3-latest/scripts/command/ide: line 96:  grep: command not found

https://github.com/devonfw/devon-ide/blob/a4d8c37dd391121d07e8620f52308169a80ebf1d/scripts/src/main/resources/scripts/command/ide#L83

@hohwille
Copy link
Member Author

hohwille commented Apr 2, 2019

Running git-bash manually:

$ grep
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.

So the only explanation for the above bug I have is that the PATH was broken/wracked.

@hohwille hohwille added commandlet related to commandlets (scripts/command/*) and removed commandlet related to commandlets (scripts/command/*) labels Apr 5, 2019
@hohwille
Copy link
Member Author

hohwille commented Apr 5, 2019

@markusschuh I added devon specific values for the registry.
I am also happy with changing from HKCR to HKCU, but we need a new PR for this.

@hohwille
Copy link
Member Author

hohwille commented Apr 9, 2019

For this grep: command not found error it is also very magically:

➜  devon cat ~/.bashrc | grep -v '^alias devon="source ~/.devon/devon"$' | grep -v '^devon$'
. ~/.profile
➜  devon cat ~/.bashrc | grep -v '^alias devon="source ~/.devon/devon"$' | grep -v '^devon$'
zsh: command not found:  grep

The 2nd line was copy & pasted from the script. The first line was typed manually visually copying from the script. Seems as there is some magic unicode character in the word grep that looks exactly like its Latin variant.

@hohwille
Copy link
Member Author

hohwille commented Apr 9, 2019

It is not a different character. This is totally wired. I have seen really strange bugs and effects in my life but this one has definetly potential to entre my top 10.

The two lines are exactly identical. Now that I copy them from this github issue in my shell both are working. Still when copying again from the script I get the error again.
May still an invisible unicode character - still clueless...

@hohwille
Copy link
Member Author

hohwille commented Apr 9, 2019

This is the most crazy piece of black magic:

➜  devon cat ~/.bashrc | grep -v '^alias devon="source ~/.devon/devon"$' | grep -v '^devon$'
. ~/.profile
➜  devon cat ~/.bashrc | grep -v '^alias devon="source ~/.devon/devon"$' | grep -v '^devon$'
. ~/.profile
➜  devon cat ~/.bashrc | grep -v '^alias devon="source ~/.devon/devon"$' | grep -v '^devon$'
zsh: command not found:  grep
➜  devon cat ~/.bashrc | grep -v '^alias devon="source ~/.devon/devon"$' | grep -v
zsh: command not found:  grep
➜  devon cat ~/.bashrc | grep -v '^alias devon="source ~/.devon/devon"$' | grep
zsh: command not found:  grep
➜  devon cat ~/.bashrc | grep -v '^alias devon="source ~/.devon/devon"$'
. ~/.profile
➜  devon cat ~/.bashrc | grep -v '^alias devon="source ~/.devon/devon"$' | grep -v foo
. ~/.profile
➜  devon cat ~/.bashrc | grep -v '^alias devon="source ~/.devon/devon"$' | grep -v '^devon$'
. ~/.profile

@hohwille
Copy link
Member Author

hohwille commented Apr 9, 2019

OK, got it. Seems I was not so clueless as it really was a special unicode character immediately after the pipe symbol that looked like a regular whitespace but was not.

@hohwille
Copy link
Member Author

hohwille commented Apr 9, 2019

All fixed except the last remaining issue:

hohwille added a commit that referenced this issue Apr 10, 2019
* #95: fixed by removing PS support for Background
* #69: changed registry keys to HKCU as suggested my markusschuh
* #69: fixed magic grep not found error
* #61: added cygwin integration
* #69: #50: uninstall both from cygwin and mingw
* #97: bash fix and disabled settings update
@hohwille
Copy link
Member Author

Done

@hohwille hohwille reopened this Jan 6, 2022
@hohwille hohwille linked a pull request Jan 6, 2022 that will close this issue
@hohwille hohwille added this to the release:3.2.0 milestone Jan 6, 2022
@hohwille hohwille closed this as completed Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request scripts related to shell scripts (bash and CMD)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants