Cleaned up launch scripts
This commit is contained in:
@@ -1,69 +1,73 @@
|
||||
@echo off
|
||||
@ECHO OFF
|
||||
SET dlurl=https://fhir.github.io/latest-ig-publisher/org.hl7.fhir.publisher.jar
|
||||
SET publisher_jar=org.hl7.fhir.publisher.jar
|
||||
SET input_cache_path=%CD%\input-cache\
|
||||
|
||||
for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j
|
||||
if "%version%" == "10.0" set winver=10
|
||||
if "%version%" == "6.3" set winver=8.1
|
||||
if "%version%" == "6.2" set winver=8
|
||||
if "%version%" == "6.1" set winver=7
|
||||
if "%version%" == "6.0" set winver=vista
|
||||
FOR %%x IN ("%CD%") DO SET upper_path=%%~dpx
|
||||
|
||||
for %%x in ("%CD%") do set upper_path=%%~dpx
|
||||
set current_path=%cd%
|
||||
|
||||
@Set location=
|
||||
rem echo inputcachepath
|
||||
rem echo "%current_path%\input-cache\org.hl7.fhir.publisher.jar"
|
||||
|
||||
If not exist "%current_path%\input-cache\org.hl7.fhir.publisher.jar" (
|
||||
If not exist "%upper_path%org.hl7.fhir.publisher.jar" (
|
||||
@ECHO IG Publisher is not in input-cache or parent folder...
|
||||
@Set filelocation="%current_path%\input-cache\org.hl7.fhir.publisher.jar"
|
||||
echo %filelocation%
|
||||
@goto:download
|
||||
|
||||
) else (
|
||||
@ECHO IG Publisher FOUND in parent folder
|
||||
@Set location=parent
|
||||
@Set filelocation="%upper_path%org.hl7.fhir.publisher.jar"
|
||||
@set filelocationname=Parent folder
|
||||
echo %filelocation%
|
||||
@goto:upgrade
|
||||
|
||||
IF NOT EXIST "%input_cache_path%%publisher_jar%" (
|
||||
IF NOT EXIST "%upper_path%%publisher_jar%" (
|
||||
SET jarlocation=%input_cache_path%%publisher_jar%
|
||||
SET jarlocationname=Input Cache
|
||||
ECHO IG Publisher is not yet in input-cache or parent folder.
|
||||
REM we don't use jarlocation below because it will be empty because we're in a bracketed if statement
|
||||
GOTO create
|
||||
) ELSE (
|
||||
ECHO IG Publisher FOUND in parent folder
|
||||
SET jarlocation=%upper_path%%publisher_jar%
|
||||
SET jarlocationname=Parent folder
|
||||
GOTO:upgrade
|
||||
)
|
||||
|
||||
) else (
|
||||
@ECHO IG Publisher FOUND in input-cache
|
||||
@Set location=cache
|
||||
@Set filelocation="%current_path%\input-cache\org.hl7.fhir.publisher.jar"
|
||||
@set filelocationname=Input Cache
|
||||
echo %filelocation%
|
||||
@goto:upgrade
|
||||
|
||||
) ELSE (
|
||||
ECHO IG Publisher FOUND in input-cache
|
||||
SET jarlocation=%input_cache_path%%publisher_jar%
|
||||
SET jarlocationname=Input Cache
|
||||
GOTO:upgrade
|
||||
)
|
||||
|
||||
echo Done
|
||||
goto:eof
|
||||
:create
|
||||
ECHO Will place publisher jar here: %input_cache_path%%publisher_jar%
|
||||
SET /p create="Ok? (Y/N)"
|
||||
IF /I "%create%"=="Y" (
|
||||
MKDIR "%input_cache_path%" 2> NUL
|
||||
GOTO:download
|
||||
)
|
||||
GOTO:done
|
||||
|
||||
:upgrade
|
||||
set /p overwrite="Overwrite? "
|
||||
if /I "%overwrite%"=="Y" (
|
||||
goto:download
|
||||
SET /p overwrite="Overwrite %jarlocation%? (Y/N)"
|
||||
IF /I "%overwrite%"=="Y" (
|
||||
GOTO:download
|
||||
)
|
||||
|
||||
goto:eof
|
||||
GOTO:done
|
||||
|
||||
:download
|
||||
set dlurl=https://fhir.github.io/latest-ig-publisher/org.hl7.fhir.publisher.jar
|
||||
@ECHO Downloading most recent publisher to %filelocationname% - it's ~100 MB, so this may take a bit
|
||||
ECHO Downloading most recent publisher to %jarlocationname% - it's ~100 MB, so this may take a bit
|
||||
|
||||
if /I "%winver%"=="10" (
|
||||
@POWERSHELL -command Invoke-WebRequest -Uri %dlurl% -Outfile %filelocation%
|
||||
)
|
||||
FOR /f "tokens=4-5 delims=. " %%i IN ('ver') DO SET VERSION=%%i.%%j
|
||||
IF "%version%" == "10.0" GOTO win10
|
||||
IF "%version%" == "6.3" GOTO win8.1
|
||||
IF "%version%" == "6.2" GOTO win8
|
||||
IF "%version%" == "6.1" GOTO win7
|
||||
IF "%version%" == "6.0" GOTO vista
|
||||
|
||||
if /I "%winver%"=="7" (
|
||||
bitsadmin /transfer GetPublisher /download /priority normal %dlurl% %filelocation%
|
||||
)
|
||||
ECHO Unrecognized version: %version%
|
||||
GOTO done
|
||||
|
||||
@ECHO "Done"
|
||||
pause
|
||||
:eof
|
||||
:win10
|
||||
POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%dlurl%\",\"%jarlocation%\") } else { Invoke-WebRequest -Uri "%dlurl%" -Outfile "%jarlocation%" }
|
||||
|
||||
GOTO done
|
||||
|
||||
:win7
|
||||
bitsadmin /transfer GetPublisher /download /priority normal "%dlurl%" "%jarlocation%"
|
||||
GOTO done
|
||||
|
||||
:win8.1
|
||||
:win8
|
||||
:vista
|
||||
ECHO This script does not yet support Windows %winver%. Please ask for help on http://chat.fhir.org
|
||||
GOTO done
|
||||
|
||||
:done
|
||||
PAUSE
|
||||
Reference in New Issue
Block a user