diff options
author | Ramón M. Gómez <ramongomez@us.es> | 2018-06-12 13:08:52 +0200 |
---|---|---|
committer | Ramón M. Gómez <ramongomez@us.es> | 2018-06-12 13:08:52 +0200 |
commit | 9815cac93139ec0a4a155934819a887b6436081a (patch) | |
tree | 2885c6adab639d6ca71f1a6e87d077024e583ed8 | |
parent | c00832504a4a2d0c569850525ed95214a1cffbaa (diff) |
#843: Scripts in in^Caller directory use new version file.
-rwxr-xr-x | installer/ogGenerateDoc.sh | 8 | ||||
-rwxr-xr-x | installer/opengnsys_export.sh | 4 | ||||
-rwxr-xr-x | installer/opengnsys_import.sh | 6 | ||||
-rwxr-xr-x | installer/opengnsys_installer.sh | 4 | ||||
-rwxr-xr-x | installer/opengnsys_makecompress.sh | 6 | ||||
-rwxr-xr-x | installer/opengnsys_update.sh | 7 |
6 files changed, 19 insertions, 16 deletions
diff --git a/installer/ogGenerateDoc.sh b/installer/ogGenerateDoc.sh index 34a16ced..62839ef2 100755 --- a/installer/ogGenerateDoc.sh +++ b/installer/ogGenerateDoc.sh @@ -20,8 +20,10 @@ fi if [ $# = 2 ] then mkdir -p "$2" -VERSION=$(cat $(dirname "$0")/../doc/VERSION.txt) 2>/dev/null -VERSION=${VERSION:-"1.1"} +PROJECT=$(jq '.project' $(dirname "$0")/../doc/VERSION.json) 2>/dev/null +PROJECT=${PROJECT:-"OpenGnsys"} +VERSION=$(jq '.version+" "+.codename' $(dirname "$0")/../doc/VERSION.json) 2>/dev/null +VERSION=${VERSION:-"1.1.1"} cat > /tmp/doxyfile << EOF # Doxyfile 1.5.6 # Fichero para documentar codigo shellscripts linux. @@ -30,7 +32,7 @@ cat > /tmp/doxyfile << EOF # Project related configuration options #--------------------------------------------------------------------------- DOXYFILE_ENCODING = UTF-8 -PROJECT_NAME = "Proyecto OpenGnsys" +PROJECT_NAME = $PROJECT PROJECT_NUMBER = $VERSION OUTPUT_DIRECTORY = $2 PROJECT_LOGO = $(dirname "$0")/../doc/opengnsys-logo.png diff --git a/installer/opengnsys_export.sh b/installer/opengnsys_export.sh index 8e9c9ccd..747a795a 100755 --- a/installer/opengnsys_export.sh +++ b/installer/opengnsys_export.sh @@ -99,8 +99,8 @@ tar -cvzf $BACKUPFILE --transform="s!^!$BACKUPPREFIX/!" \ -C $TMPDIR IPSERVER.txt \ -C $DHCPDIR dhcpd.conf \ -C $OPENGNSYS/tftpboot menu.lst \ - -C $OPENGNSYS/doc VERSION.txt \ - -C $OPENGNSYS/client/etc engine.cfg \ + -C $OPENGNSYS/doc VERSION.json \ + -C $OPENGNSYS/client/etc engine.cfg engine.json \ -C $OPENGNSYS/www menus \ -C /etc default/opengnsys &>/dev/null diff --git a/installer/opengnsys_import.sh b/installer/opengnsys_import.sh index 26b7ede3..b2a9463b 100755 --- a/installer/opengnsys_import.sh +++ b/installer/opengnsys_import.sh @@ -220,12 +220,12 @@ if [ $? -ne 0 ]; then fi # Comprobamos si es la misma versión -OLDVERSION=$(awk '{print $2}' $TMPDIR/VERSION.txt) -NEWVERSION=$(awk '{print $2}' $OPENGNSYS/doc/VERSION.txt) +OLDVERSION=$(jq -r '.version' $TMPDIR/VERSION.json) +NEWVERSION=$(jq -r '.version' $OPENGNSYS/doc/VERSION.json) # FALTA: Comprobar que la versión OLD es menor que la NEW if [ $OLDVERSION != $NEWVERSION ] ; then echo "La versión del servidor no coincide con la del backup." - cat $OPENGNSYS/doc/VERSION.txt $TMPDIR/VERSION.txt + jq -r '[.project, .version, .codename] | join(" ")' $OPENGNSYS/doc/VERSION.json $TMPDIR/VERSION.json read -p "¿Quiere continuar? (y/n): " ANSWER if [ "${ANSWER^^}" != "Y" ]; then echo "Operación cancelada." diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh index 523aaaf2..c5375050 100755 --- a/installer/opengnsys_installer.sh +++ b/installer/opengnsys_installer.sh @@ -1711,7 +1711,7 @@ if [ $? -ne 0 ]; then errorAndLog "Error while copying the server files!" exit 1 fi -INSTVERSION=$(awk '{print $2}' $INSTALL_TARGET/doc/VERSION.txt) +INSTVERSION=$(jq -r '.version' $INSTALL_TARGET/doc/VERSION.json) # Instalar base de datos de OpenGnsys Admin. isInArray notinstalled "mysql-server" || isInArray notinstalled "mariadb-server" @@ -1771,7 +1771,7 @@ if [ $? -eq 0 ]; then fi else # Si existe fichero ogBDAdmin-VersLocal-VersRepo.sql; aplicar cambios. - REPOVERSION=$(awk '{print $2}' $WORKDIR/opengnsys/doc/VERSION.txt) + REPOVERSION=$(jq -r '.version' $WORKDIR/opengnsys/doc/VERSION.json) OPENGNSYS_DB_UPDATE_FILE="opengnsys/admin/Database/$OPENGNSYS_DATABASE-$INSTVERSION-$REPOVERSION.sql" if [ -f $WORKDIR/$OPENGNSYS_DB_UPDATE_FILE ]; then echoAndLog "Updating tables from version $INSTVERSION to $REPOVERSION" diff --git a/installer/opengnsys_makecompress.sh b/installer/opengnsys_makecompress.sh index 5c8aa729..ff267b1e 100755 --- a/installer/opengnsys_makecompress.sh +++ b/installer/opengnsys_makecompress.sh @@ -24,7 +24,7 @@ done BRANCH="devel" CODE_URL="https://codeload.github.com/opengnsys/OpenGnsys/zip/$BRANCH" API_URL="https://api.github.com/repos/opengnsys/OpenGnsys/branches/$BRANCH" -REVISION=$(curl -s "$API_URL" | jq -r '"r" + (.commit.commit.committer.date | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])') +REVISION=$(curl -s "$API_URL" | jq '"r" + (.commit.commit.committer.date | gsub("-"; "")[:8]) + "." + (.commit.sha[:7])') # Descargar repositorio SVN cd /tmp @@ -36,10 +36,10 @@ chown -R root.root opengnsys WARNING=$? # Parchear datos de revisión del código. -sed -ri "s/$/ $REVISION/" opengnsys/doc/VERSION.txt +jq ".release=$REVISION" opengnsys/doc/VERSION.json | sponge opengnsys/doc/VERSION.json # Generar fichero comprimido. -VERSION=$(awk '{print $2"-"$3}' opengnsys/doc/VERSION.txt) +VERSION=$(jq -r '.version+"-"+.release' opengnsys/doc/VERSION.json) tar cvzf opengnsys-$VERSION.tar.gz opengnsys rm -fr opengnsys opengnsys.zip diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh index 642d948d..3635f3d8 100755 --- a/installer/opengnsys_update.sh +++ b/installer/opengnsys_update.sh @@ -446,11 +446,12 @@ function checkVersion() local PRE # Obtener versión actual y versión a actualizar. - OLDVERSION=$(awk '{print $2}' $INSTALL_TARGET/doc/VERSION.txt 2>/dev/null) + [ -f $INSTALL_TARGET/doc/VERSION.txt ] && OLDVERSION=$(awk '{print $2}' $INSTALL_TARGET/doc/VERSION.txt 2>/dev/null) + [ -f $INSTALL_TARGET/doc/VERSION.json ] && OLDVERSION=$(jq -r '.version' $INSTALL_TARGET/doc/VERSION.json 2>/dev/null) if [ $REMOTE -eq 1 ]; then - NEWVERSION=$(curl -s $RAW_URL/doc/VERSION.txt 2>/dev/null | awk '{print $2}') + NEWVERSION=$(curl -s $RAW_URL/doc/VERSION.json 2>/dev/null | jq -r '.version') else - NEWVERSION=$(awk '{print $2}' $PROGRAMDIR/doc/VERSION.txt 2>/dev/null) + NEWVERSION=$(jq -r '.version' $PROGRAMDIR/doc/VERSION.json 2>/dev/null) fi [[ "$NEWVERSION" =~ pre ]] && PRE=1 |