[17674] | 1 | @echo off
|
---|
[17949] | 2 | CD /D "%~dp0"
|
---|
[22532] | 3 |
|
---|
[23243] | 4 | setlocal enabledelayedexpansion
|
---|
| 5 |
|
---|
[22532] | 6 | :checkUserPermissions
|
---|
[22573] | 7 | echo Checking if the Greenstone directory is writable ...
|
---|
[22577] | 8 | (echo This is a temporary file. It is safe to delete it. > "testing.tmp" ) 2>nul
|
---|
| 9 | if exist "testing.tmp" goto deleteTempFile
|
---|
[22573] | 10 | if "%1" == "Elevated" goto printWarning
|
---|
| 11 | echo ... FAILED
|
---|
[22577] | 12 | echo The uninstaller cannot write to the Greenstone directory (%CD%)
|
---|
[22573] | 13 | echo Requesting elevated status to become admin user to continue.
|
---|
[23263] | 14 | ..\bin\windows\gstart.exe %0 Elevated %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
[22532] | 15 | goto done
|
---|
[22573] | 16 |
|
---|
| 17 | :printWarning
|
---|
| 18 | echo ... FAILED
|
---|
[22577] | 19 | echo The uninstaller cannot write to the Greenstone directory (%CD%).
|
---|
[22573] | 20 | echo Attempting to continue without permissions.
|
---|
| 21 | goto shiftElevated
|
---|
[22532] | 22 |
|
---|
| 23 | :deleteTempFile
|
---|
[22573] | 24 | echo ... OK
|
---|
[22577] | 25 | del "testing.tmp"
|
---|
[22532] | 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
|
---|
[22573] | 30 | if "%1" == "Elevated" shift
|
---|
[22532] | 31 |
|
---|
[23256] | 32 | cd ..
|
---|
| 33 | if exist .\bin\windows\search4j.exe .\bin\windows\search4j.exe -p .\packages\jre -l .\uninstall\uninst.jar
|
---|
[18071] | 34 |
|
---|
[23256] | 35 | if exist .\gs2build\bin\windows\search4j.exe .\gs2build\bin\windows\search4j.exe -p .\packages\jre -l .\uninstall\uninst.jar
|
---|
[18071] | 36 |
|
---|
| 37 | if exist uninst.flag (
|
---|
| 38 |
|
---|
[23256] | 39 | rd /s /q packages\jre
|
---|
| 40 | rmdir packages
|
---|
[18071] | 41 |
|
---|
[23256] | 42 | if exist bin\windows\search4j.exe (
|
---|
| 43 | del bin\windows\search4j.exe
|
---|
| 44 | rmdir bin\windows
|
---|
[18498] | 45 | )
|
---|
[23256] | 46 | if exist gs2build\bin\windows\search4j.exe (
|
---|
| 47 | del gs2build\bin\windows\search4j.exe
|
---|
| 48 | rd /s /q gs2build
|
---|
[19461] | 49 | )
|
---|
[23267] | 50 |
|
---|
| 51 | if exist llssite.cfg del llssite.cfg
|
---|
| 52 | if exist glisite.cfg del glisite.cfg
|
---|
| 53 | del uninst.flag
|
---|
[18071] | 54 |
|
---|
[23256] | 55 | del uninstall\uninst.jar
|
---|
| 56 | del uninstall\Uninstall.*
|
---|
| 57 | del uninstall\*.uninstall
|
---|
| 58 | rmdir /S /Q bin
|
---|
| 59 | rmdir /S /Q tmp
|
---|
| 60 | rmdir /S /Q ext
|
---|
[18071] | 61 |
|
---|
[23243] | 62 | set GSDEL=!CD!
|
---|
[23271] | 63 | cd ..
|
---|
[18071] | 64 |
|
---|
[23243] | 65 | echo @echo off > %TEMP%\gsuninstall.bat
|
---|
| 66 | echo rmdir /S /Q !GSDEL!\uninstall >> %TEMP%\gsuninstall.bat
|
---|
[23271] | 67 | echo ping 127.0.0.1 ^> nul >> %TEMP%\gsuninstall.bat
|
---|
[23243] | 68 | echo rmdir !GSDEL! >> %TEMP%\gsuninstall.bat
|
---|
| 69 | start cmd /C %TEMP%\gsuninstall.bat
|
---|
| 70 |
|
---|
[18071] | 71 | )
|
---|
[22577] | 72 |
|
---|
| 73 | :done
|
---|