source: main/trunk/release-kits/shared/core/uninstaller/Uninstall.bat@ 23243

Last change on this file since 23243 was 23243, checked in by sjm84, 12 years ago

Windows installations of Greenstone will now uninstall correctly (no left over folders)

File size: 1.9 KB
Line 
1@echo off
2CD /D "%~dp0"
3
4setlocal enabledelayedexpansion
5
6:checkUserPermissions
7 echo Checking if the Greenstone directory is writable ...
8 (echo This is a temporary file. It is safe to delete it. > "testing.tmp" ) 2>nul
9 if exist "testing.tmp" goto deleteTempFile
10 if "%1" == "Elevated" goto printWarning
11 echo ... FAILED
12 echo The uninstaller cannot write to the Greenstone directory (%CD%)
13 echo Requesting elevated status to become admin user to continue.
14 ..\bin\windows\gstart.exe %0 Elevated %1 %2 %3 %4 %5 %6 %7 %8 %9
15 goto done
16
17:printWarning
18 echo ... FAILED
19 echo The uninstaller cannot write to the Greenstone directory (%CD%).
20 echo Attempting to continue without permissions.
21 goto shiftElevated
22
23:deleteTempFile
24 echo ... OK
25 del "testing.tmp"
26
27:shiftElevated
28:: Shift "Elevated" (one of our own internal command words) out of the way if present
29:: so the command-line is as it was when the user initiated the command
30 if "%1" == "Elevated" shift
31
32if exist ..\bin\windows\search4j.exe ..\bin\windows\search4j.exe -p ..\packages\jre -l .\uninst.jar
33
34if exist ..\gs2build\bin\windows\search4j.exe ..\gs2build\bin\windows\search4j.exe -p ..\packages\jre -l .\uninst.jar
35
36
37if exist uninst.flag (
38
39 rd /s /q ..\packages\jre
40 rmdir ..\packages
41
42 if exist ..\bin\windows\search4j.exe (
43 del ..\bin\windows\search4j.exe
44 rmdir ..\bin\windows
45 )
46 if exist ..\gs2build\bin\windows\search4j.exe (
47 del ..\gs2build\bin\windows\search4j.exe
48 rd /s /q ..\gs2build
49 )
50
51 del uninst.jar
52 del uninst.flag
53 del Uninstall.*
54 del *.uninstall
55 rmdir /S /Q ..\bin
56 rmdir /S /Q ..\tmp
57 rmdir /S /Q ..\ext
58
59 cd ..
60 set GSDEL=!CD!
61 cd ..
62
63 echo @echo off > %TEMP%\gsuninstall.bat
64 echo rmdir /S /Q !GSDEL!\uninstall >> %TEMP%\gsuninstall.bat
65 echo rmdir !GSDEL! >> %TEMP%\gsuninstall.bat
66 start cmd /C %TEMP%\gsuninstall.bat
67
68)
69
70:done
Note: See TracBrowser for help on using the repository browser.