From 7a4e0b6b3825726c9eaf2e9977b3c6c22a9bc380 Mon Sep 17 00:00:00 2001 From: Julia Afeltra Date: Mon, 16 Mar 2020 15:42:16 -0400 Subject: [PATCH 1/2] Minor updates to IG scripts - Update updatePublisher scripts to have more clear options for prompts. Add space after prompt for clarity. - Update genonce.sh script to not depend on wget. Instead use curl to check internet connection since it is used in updatePublisher. - Update gencontinuous scripts to reference relative genonce scripts. --- _gencontinuous.bat | 2 +- _gencontinuous.sh | 2 +- _genonce.sh | 2 +- _updatePublisher.bat | 4 ++-- _updatePublisher.sh | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/_gencontinuous.bat b/_gencontinuous.bat index 8a6218a..ca2867a 100644 --- a/_gencontinuous.bat +++ b/_gencontinuous.bat @@ -1,2 +1,2 @@ @ECHO OFF -CALL _genonce.bat -watch \ No newline at end of file +CALL ./_genonce.bat -watch \ No newline at end of file diff --git a/_gencontinuous.sh b/_gencontinuous.sh index a99fe5f..b9ac593 100644 --- a/_gencontinuous.sh +++ b/_gencontinuous.sh @@ -1,2 +1,2 @@ #!/bin/bash -_genonce.sh -watch +./_genonce.sh -watch diff --git a/_genonce.sh b/_genonce.sh index 6949a9f..65db3b7 100755 --- a/_genonce.sh +++ b/_genonce.sh @@ -3,7 +3,7 @@ publisher_jar=org.hl7.fhir.publisher.jar input_cache_path=./input-cache/ set -e echo Checking internet connection... -wget -q --spider tx.fhir.org +curl -sSf tx.fhir.org > /dev/null if [ $? -eq 0 ]; then echo "Online" diff --git a/_updatePublisher.bat b/_updatePublisher.bat index 93b55b2..ac9459d 100644 --- a/_updatePublisher.bat +++ b/_updatePublisher.bat @@ -27,7 +27,7 @@ IF NOT EXIST "%input_cache_path%%publisher_jar%" ( :create ECHO Will place publisher jar here: %input_cache_path%%publisher_jar% -SET /p create="Ok? (Y/N)" +SET /p create="Ok? (Y/N) " IF /I "%create%"=="Y" ( MKDIR "%input_cache_path%" 2> NUL GOTO:download @@ -35,7 +35,7 @@ IF /I "%create%"=="Y" ( GOTO:done :upgrade -SET /p overwrite="Overwrite %jarlocation%? (Y/N)" +SET /p overwrite="Overwrite %jarlocation%? (Y/N) " IF /I "%overwrite%"=="Y" ( GOTO:download ) diff --git a/_updatePublisher.sh b/_updatePublisher.sh index 7307202..d953ea9 100755 --- a/_updatePublisher.sh +++ b/_updatePublisher.sh @@ -32,10 +32,10 @@ else fi if "$upgrade"; then - message="Overwrite $jarlocation?" + message="Overwrite $jarlocation? (Y/N) " else echo Will place publisher jar here: "$jarlocation" - message="Ok?" + message="Ok? (Y/N) " fi read -r -p "$message" response From 00c4a72152b24097ad6fdb6e1a288a704bfd4baa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9tur=20=C3=9E=C3=B3r=20Valdimarsson?= Date: Fri, 3 Apr 2020 11:43:39 +0200 Subject: [PATCH 2/2] Enable passing answer to overwrite question in _upgradePublisher.sh as a flag --- _updatePublisher.sh | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/_updatePublisher.sh b/_updatePublisher.sh index d953ea9..2d5c09f 100755 --- a/_updatePublisher.sh +++ b/_updatePublisher.sh @@ -9,6 +9,20 @@ if ! type "curl" > /dev/null; then exit 1 fi +FORCE=false + +while :; do + case $1 in + -f|--force) FORCE=true ;; + --) + shift + break + ;; + *) break + esac + shift +done + publisher="$input_cache_path$publisher_jar" if test -f "$publisher"; then echo "IG Publisher FOUND in input-cache" @@ -31,15 +45,17 @@ else fi fi -if "$upgrade"; then - message="Overwrite $jarlocation? (Y/N) " -else - echo Will place publisher jar here: "$jarlocation" - message="Ok? (Y/N) " +if [[ "$FORCE" != true ]]; then + if "$upgrade"; then + message="Overwrite $jarlocation? (Y/N) " + else + echo Will place publisher jar here: "$jarlocation" + message="Ok? (Y/N) " + fi + read -r -p "$message" response fi -read -r -p "$message" response -if [[ "$response" =~ ^([yY])$ ]]; then +if [[ "$FORCE" ]] || [[ "$response" =~ ^([yY])$ ]]; then echo "Downloading most recent publisher to $jarlocationname - it's ~100 MB, so this may take a bit" # wget "https://fhir.github.io/latest-ig-publisher/org.hl7.fhir.publisher.jar" -O "$jarlocation" curl $dlurl -o "$jarlocation" --create-dirs