FHIR Chat · Updating IG publisher bash scripts · committers

Stream: committers

Topic: Updating IG publisher bash scripts


view this post on Zulip Jose Costa Teixeira (Jul 03 2020 at 21:24):

Anyone willing to update the _updatePublisher.sh to match the _updatePublisher.bat ?
https://github.com/FHIR/sample-ig/blob/master/_updatePublisher.sh

view this post on Zulip Jose Costa Teixeira (Jul 03 2020 at 21:24):

What needs to be done: After downloading the publisher, it should ask the user whether to update the scripts (_genOnce, _genContinuous, _updatePublisher) and if Yes, download and replace existing ones (including itself).

view this post on Zulip Jose Costa Teixeira (Jul 03 2020 at 21:32):

https://github.com/FHIR/sample-ig/blob/master/_updatePublisher.bat shows how, but it is rather simple:

  1. declare url variables:
set update_bat_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_updatePublisher.bat
set gen_bat_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_genonce.bat
set gencont_bat_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_gencontinuous.bat
set gencont_sh_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_gencontinuous.sh
set gen_sh_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_genonce.sh
set update_sh_url=https://raw.githubusercontent.com/FHIR/sample-ig/master/_updatePublisher.sh
  1. (update the promping logic with the ifs /elses

  2. for each of the urls, download the file under a new name, and if no errors, start a new process to copy the downloaded file to the right name , delete the downloaded file, and exit the new process

:dl_script_6
ECHO Updating _updatePublisher.bat
call POWERSHELL -command if ('System.Net.WebClient' -as [type]) {(new-object System.Net.WebClient).DownloadFile(\"%update_bat_url%\",\"_updatePublisher.new.bat\") } else { Invoke-WebRequest -Uri "%update_bat_url%" -Outfile "_updatePublisher.new.bat" }
if %ERRORLEVEL% == 0 goto upd_script_6
echo "Errors encountered during download: %errorlevel%"
goto end
:upd_script_6
start copy /y "_updatePublisher.new.bat" "_updatePublisher.bat" ^&^& del "_updatePublisher.new.bat" ^&^& exit

(trick is to make sure that the action performed by _updatePublisher.sh is to launch a new process to replace itself, this way the file is no longer in use and can be replaced).

view this post on Zulip Jose Costa Teixeira (Jul 22 2020 at 15:10):

ping anyone?

view this post on Zulip David Pyke (Jul 22 2020 at 15:41):

I'll take a kick at it.

view this post on Zulip Jose Costa Teixeira (Jul 22 2020 at 15:46):

thanks


Last updated: Apr 12 2022 at 19:14 UTC