Skip to content

Commit

Permalink
Feature/69 fix uninstall (#96)
Browse files Browse the repository at this point in the history
* #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
  • Loading branch information
hohwille authored Apr 10, 2019
1 parent 04db785 commit 9196abb
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 36 deletions.
50 changes: 32 additions & 18 deletions scripts/src/main/resources/scripts/command/ide
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function doUpdateScripts() {
function doUpdateSettings() {
if [ ! -d "${SETTINGS_PATH}" ]
then
if [ -n "${1}"]
if [ -n "${1}" ]
then
SETTINGS_URL="${1}"
fi
Expand Down Expand Up @@ -55,7 +55,8 @@ function doUpdateSettings() {
cd -
fi
else
doUpgradeMavenArtifact "${SETTINGS_PATH}" "${DEVON_IDE_REPO_URL}" "devon-ide-settings" "${target_version}" ".zip"
#doUpgradeMavenArtifact "${SETTINGS_PATH}" "${DEVON_IDE_REPO_URL}" "devon-ide-settings" "${target_version}" ".zip"
echo
fi
}

Expand All @@ -80,32 +81,45 @@ function doSetup() {
fi
}

function doUninstall() {
echo "Uninstalling devon-ide..."
mkdir -p "${DEVON_IDE_HOME}/updates"
if [ -f ~/.bashrc ]
# $1: home directory
function doUninstallFromHome() {
if [ -f "${1}/.bashrc" ]
then
cat "${1}/.bashrc" | grep -v '^alias devon="source ~/.devon/devon"$' | grep -v '^devon$' > "${DEVON_IDE_HOME}/updates/.bashrc" && mv "${DEVON_IDE_HOME}/updates/.bashrc" "${1}/.bashrc"
fi
if [ -f "${1}/.zshrc" ]
then
cat ~/.bashrc | grep -v '^alias devon="source ~/.devon/devon"$' | grep -v '^devon$' > "${DEVON_IDE_HOME}/updates/.bashrc" && mv "${DEVON_IDE_HOME}/updates/.bashrc" ~/.bashrc
cat "${1}/.zshrc" | grep -v '^alias devon="source ~/.devon/devon"$' | grep -v '^devon$' > "${DEVON_IDE_HOME}/updates/.zshrc" && mv "${DEVON_IDE_HOME}/updates/.zshrc" "${1}/.zshrc"
fi
if [ -f ~/.zshrc ]
if [ -f "${1}/scripts/devon" ]
then
cat ~/.zshrc | grep -v '^alias devon="source ~/.devon/devon"$' | grep -v '^devon$' > "${DEVON_IDE_HOME}/updates/.zshrc" && mv "${DEVON_IDE_HOME}/updates/.zshrc" ~/.zshrc
doRunCommand "rm '${1}/scripts/devon'"
fi
doRunCommand 'rm -rf ~/.devon'
doRunCommand "rm -rf '${1}/.devon'"
}

function doUninstall() {
echo "Uninstalling devon-ide..."
mkdir -p "${DEVON_IDE_HOME}/updates"
doUninstallFromHome ~
if doIsWindows
then
if [ "${OSTYPE}" = "cygwin" ]
then
doUninstallFromHome "$(cygpath $USERPROFILE)"
else
if [ -d "/c/cygwin64" ]
then
doUninstallFromHome "/c/cygwin64/home/${USER}"
elif [ -d "/c/cygwin" ]
then
doUninstallFromHome "/c/cygwin/home/${USER}"
fi
fi
echo "To uninstall the windows explorer integrations we need to apply changes to the windows registry:"
echo "${DEVON_IDE_HOME}/system/windows/devon-uninstall.reg"
echo "Simply confirm the popup with Yes or otherwise review and merge the registry file manually."
regedit.exe "${DEVON_IDE_HOME}/system/windows/devon-uninstall.reg"
if [ -d "${USERPROFILE}/.devon" ]
then
doRunCommand 'rm -rf "${USERPROFILE}/.devon"'
fi
if [ -f "${USERPROFILE}/scripts/devon" ]
then
doRunCommand 'rm "${USERPROFILE}/scripts/devon"'
fi
fi
echo "So sad that you did not like devon-ide. It has been uninstalled from your system."
echo "You can now manually delete ${DEVON_IDE_HOME} to remove it completely."
Expand Down
3 changes: 1 addition & 2 deletions scripts/src/main/resources/scripts/devon
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ then
echo "ERROR: DEVON_IDE_HOME does not exist!"
if [ -n "${DEVON_IDE_HOME}" ]
then
echo "${DEVON_IDE_HOME}"
echo "It seems as if you original installation has been moved."
echo "It seems as if you original installation (${DEVON_IDE_HOME}) has been moved."
if [ -f ~/.devon/home ]
then
rm ~/.devon/home
Expand Down
1 change: 1 addition & 0 deletions scripts/src/main/resources/setup
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash

cd `dirname ${BASH_SOURCE:-$0}`
echo "Setting up your devon-ide in ${PWD}"
source scripts/devon ide setup
2 changes: 1 addition & 1 deletion scripts/src/main/resources/setup.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@echo off

pushd %~dp0

echo Setting up your devon-ide in %CD%
call scripts\devon.bat ide setup
call regedit.exe /s system/windows/cmd/devon-cmd.reg
call regedit.exe /s system/windows/power-shell/devon-power-shell.reg
Expand Down
8 changes: 4 additions & 4 deletions scripts/src/main/resources/system/windows/cmd/devon-cmd.reg
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\devon_cmd]
[HKEY_CURRENT_USER\Software\Classes\Directory\shell\devon_cmd]
@="Open Devon CMD shell here"
[HKEY_CLASSES_ROOT\Directory\shell\devon_cmd\command]
[HKEY_CURRENT_USER\Software\Classes\Directory\shell\devon_cmd\command]
@="cmd.exe /s /k pushd \"%V\" & devon"
[HKEY_CLASSES_ROOT\Directory\Background\shell\devon_cmd]
[HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\devon_cmd]
@="Open Devon CMD shell here"
[HKEY_CLASSES_ROOT\Directory\Background\shell\devon_cmd\command]
[HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\devon_cmd\command]
@="cmd.exe /s /k pushd \"%V\" & devon"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Windows Registry Editor Version 5.00

[-HKEY_CURRENT_USER\Software\Classes\Directory\shell\devon_cygwin]
[-HKEY_CURRENT_USER\Software\Classes\Directory\shell\devon_cygwin\command]
[-HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\devon_cygwin]
[-HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\devon_cygwin\command]
10 changes: 10 additions & 0 deletions scripts/src/main/resources/system/windows/cygwin/devon-cygwin.reg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\Directory\shell\devon_cygwin]
@="Open Devon Cygwin Bash Here"
[HKEY_CURRENT_USER\Software\Classes\Directory\shell\devon_cygwin\command]
@="C:\\cygwin64\\bin\\mintty.exe -i /Cygwin-Terminal.ico C:\\cygwin64\\bin\\bash.exe --login -c \"cd \\\"%V\\\" ; exec bash -rcfile ~/.bashrc\""
[HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\devon_cygwin]
@="Open Devon Cygwin Bash Here"
[HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\devon_cygwin\command]
@="C:\\cygwin64\\bin\\mintty.exe -i /Cygwin-Terminal.ico C:\\cygwin64\\bin\\bash.exe --login -c \"cd \\\"%V\\\" ; exec bash -rcfile ~/.bashrc\""
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
regedit.exe /S devon-cygwin.reg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
regedit.exe /S devon-cygwin-uninstall.reg
8 changes: 4 additions & 4 deletions scripts/src/main/resources/system/windows/devon-uninstall.reg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\Directory\shell\devon_cmd]
[-HKEY_CLASSES_ROOT\Directory\Background\shell\devon_cmd]
[-HKEY_CLASSES_ROOT\Directory\shell\devon_ps]
[-HKEY_CLASSES_ROOT\Directory\Background\shell\devon_ps]
[-HKEY_CURRENT_USER\Software\Classes\Directory\shell\devon_cmd]
[-HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\devon_cmd]
[-HKEY_CURRENT_USER\Software\Classes\Directory\shell\devon_ps]
[-HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\devon_ps]
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\devon_ps]
[HKEY_CURRENT_USER\Software\Classes\Directory\shell\devon_ps]
@="Open Devon PowerShell here"
[HKEY_CLASSES_ROOT\Directory\shell\devon_ps\command]
@="powershell.exe -NoExit -Command Set-Location -LiteralPath '%L';devon.bat"
[HKEY_CLASSES_ROOT\Directory\Background\shell\devon_ps]
@="Open Devon PowerShell here"
[HKEY_CLASSES_ROOT\Directory\Background\shell\devon_ps\command]
@="powershell.exe -NoExit -Command Set-Location -LiteralPath '%L';devon.bat"
[HKEY_CURRENT_USER\Software\Classes\Directory\shell\devon_ps\command]
@="powershell.exe -NoExit -Command Set-Location -LiteralPath '%L';%USERPROFILE%\devon.bat"

0 comments on commit 9196abb

Please sign in to comment.