diff options
author | Ramón M. Gómez <ramongomez@us.es> | 2018-06-12 11:54:56 +0200 |
---|---|---|
committer | Ramón M. Gómez <ramongomez@us.es> | 2018-06-12 11:54:56 +0200 |
commit | 3bbaf79bf5961f05f2a6f278f6f222b8e3ba49f7 (patch) | |
tree | cc98b2a705b92d88f937aec04ca5d82d1f1377dd | |
parent | 22087adb0242fbd6ed6896a6227bb41c1c1af668 (diff) |
#843: Installer and updater use new version file.
-rwxr-xr-x | installer/opengnsys_installer.sh | 15 | ||||
-rwxr-xr-x | installer/opengnsys_update.sh | 14 |
2 files changed, 16 insertions, 13 deletions
diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh index 7d41bd6b..523aaaf2 100755 --- a/installer/opengnsys_installer.sh +++ b/installer/opengnsys_installer.sh @@ -1556,21 +1556,22 @@ function installationSummary() local VERSIONFILE REVISION # Crear fichero de versión y revisión, si no existe. - VERSIONFILE="$INSTALL_TARGET/doc/VERSION.txt" - [ -f $VERSIONFILE ] || echo "OpenGnsys Server" >$VERSIONFILE - # Incluir datos de revisión, si se está instaladno desde el repositorio + VERSIONFILE="$INSTALL_TARGET/doc/VERSION.json" + [ -f $VERSIONFILE ] || echo '{ "project": "OpenGnsys" }' >$VERSIONFILE + # Incluir datos de revisión, si se está instalando desde el repositorio # de código o si no está incluida en el fichero de versión. - if [ $REMOTE -eq 1 ] || [ -z "$(awk '$3~/r[0-9]*/ {print}' $VERSIONFILE)" ]; then + if [ $REMOTE -eq 1 ] || [ -z "$(jq -r '.release' $VERSIONFILE)" ]; then # Revisión: rAñoMesDía.Gitcommit (8 caracteres de fecha y 7 primeros de commit). - REVISION=$(curl -s "$API_URL" | jq -r '"r" + (.commit.commit.committer.date | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])') - sed -ri "s/($| r[.0-9a-f]+)/ $REVISION/" $VERSIONFILE + REVISION=$(curl -s "$API_URL" | jq '"r" + (.commit.commit.committer.date | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])') + jq ".release=$REVISION" $VERSIONFILE | sponge $VERSIONFILE fi + VERSION="$(jq -r '[.project, .version, .codename, .release] | join(" ")' $VERSIONFILE 2>/dev/null)" # Mostrar información. echo echoAndLog "OpenGnsys Installation Summary" echo "==============================" - echoAndLog "Project version: $(cat $VERSIONFILE 2>/dev/null)" + echoAndLog "Project version: $VERSION" echoAndLog "Installation directory: $INSTALL_TARGET" echoAndLog "Installation log file: $LOG_FILE" echoAndLog "Repository directory: $INSTALL_TARGET/images" diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh index f8689673..642d948d 100755 --- a/installer/opengnsys_update.sh +++ b/installer/opengnsys_update.sh @@ -1028,17 +1028,19 @@ function updateSummary() { # Actualizar fichero de versión y revisión. local VERSIONFILE REVISION - VERSIONFILE="$INSTALL_TARGET/doc/VERSION.txt" + VERSIONFILE="$INSTALL_TARGET/doc/VERSION.json" # Revisión: rAñoMesDía.Gitcommit (8 caracteres de fecha y 7 primeros de commit). - REVISION=$(curl -s "$API_URL" | jq -r '"r" + (.commit.commit.committer.date | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])') - - [ -f $VERSIONFILE ] || echo "OpenGnsys" >$VERSIONFILE - sed -ri "s/($| r[.0-9a-f]+)/ $REVISION/" $VERSIONFILE + REVISION=$(curl -s "$API_URL" | jq '"r" + (.commit.commit.committer.date | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])') + [ -f $VERSIONFILE ] || echo '{ "project": "OpenGnsys" }' > $VERSIONFILE + jq ".release=$REVISION" $VERSIONFILE | sponge $VERSIONFILE + VERSION="$(jq -r '[.project, .version, .codename, .release] | join(" ")' $VERSIONFILE 2>/dev/null)" + # Borrar antiguo fichero de versión. + rm -f "${VERSIONFILE/json/txt}" echo echoAndLog "OpenGnsys Update Summary" echo "========================" - echoAndLog "Project version: $(cat $VERSIONFILE)" + echoAndLog "Project version: $VERSION" echoAndLog "Update log file: $LOG_FILE" if [ -n "$NEWFILES" ]; then echoAndLog "Check new config files: $(echo $NEWFILES)" |