1@echo off
2
3rem This script upgrades specified target 3.7.x midPoint directory to midPoint 3.8
4rem by replacing appropriate files
5
6setlocal
7
8set BIN_DIR=%~dp0
9set DIST_DIR=%BIN_DIR%..
10
11echo MidPoint 3.8 distribution (i.e. source) is in %DIST_DIR%
12
13if not exist "%DIST_DIR%\bin" goto :wrongDistribution
14if not exist "%DIST_DIR%\lib" goto :wrongDistribution
15
16set MIDPOINT_EXISTING_FOLDER=%1
17
18if x%MIDPOINT_EXISTING_FOLDER% == x goto noParameter
19
20echo Existing midPoint installation (i.e. target) is in %MIDPOINT_EXISTING_FOLDER%
21
22if not exist %MIDPOINT_EXISTING_FOLDER% goto :noExistingFolder
23if not exist %MIDPOINT_EXISTING_FOLDER%\bin goto :wrongExistingFolder
24if not exist %MIDPOINT_EXISTING_FOLDER%\lib goto :wrongExistingFolder
25if exist %MIDPOINT_EXISTING_FOLDER%\bin.backup goto :backupAlreadyExists
26if exist %MIDPOINT_EXISTING_FOLDER%\lib.backup goto :backupAlreadyExists
27
28echo Renaming %MIDPOINT_EXISTING_FOLDER%\bin to %MIDPOINT_EXISTING_FOLDER%\bin.backup ...
29rename %MIDPOINT_EXISTING_FOLDER%\bin bin.backup
30
31echo Renaming %MIDPOINT_EXISTING_FOLDER%\lib to %MIDPOINT_EXISTING_FOLDER%\lib.backup ...
32rename %MIDPOINT_EXISTING_FOLDER%\lib lib.backup
33
34echo Deleting %MIDPOINT_EXISTING_FOLDER%\doc
35del /F /S /Q %MIDPOINT_EXISTING_FOLDER%\doc\* 1>nul
36
37echo Copying from %DIST_DIR% into %MIDPOINT_EXISTING_FOLDER%
38xcopy /S /E /Y /Q "%DIST_DIR%\*" %MIDPOINT_EXISTING_FOLDER%
39
40echo MidPoint installation upgrade finished.
41
42goto :end
43
44:noParameter
45echo ---
46echo No arguments supplied. Please specify the location of existing midPoint installation that is to be updated.
47goto end
48
49:wrongDistribution
50echo ---
51echo Error: Wrong distribution: Directory %DIST_DIR%\bin or %DIST_DIR%\lib does not exist.
52goto end
53
54:noExistingFolder
55echo ---
56echo Error: Target folder %MIDPOINT_EXISTING_FOLDER% does not exist.
57goto end
58
59:wrongExistingFolder
60echo ---
61echo Error: Wrong target folder with existing midPoint installation: Directory %MIDPOINT_EXISTING_FOLDER%\bin or %MIDPOINT_EXISTING_FOLDER%\lib does not exist.
62goto end
63
64:backupAlreadyExists
65echo ---
66echo Error: Backup directory (bin.backup or lib.backup) already exists in %MIDPOINT_EXISTING_FOLDER%. This means that the upgrade has been already run. If you are sure that you want to run this upgrade, please remove the backup directories and start over.
67goto end
68
69:end
70