918-git-images-111dconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacion
Last change
on this file since 6bf7eae was
08b7e126,
checked in by Ramón M. Gómez <ramongomez@…>, 5 years ago
|
#914: Adapting all scripts to use the master branch.
|
-
Property mode set to
100755
|
File size:
1.6 KB
|
Line | |
---|
1 | #!/bin/bash |
---|
2 | # |
---|
3 | # Script: opengnsys_compress.sh |
---|
4 | # Descripción: Programa para descargar y generar un fichero comprimido con los |
---|
5 | # datos de la última revisión de código del Proyecto OpenGnsys. |
---|
6 | # Salida: Datos del fichero comprimido generado. |
---|
7 | # Versión: 1.0 - Incluido en OpenGnSys 1.0.1 |
---|
8 | # Autor: Ramón Gómez, Universidad de Sevilla |
---|
9 | # Fecha: 10/05/2011 |
---|
10 | # Versión: 1.1.1 - Descarga desde repositorio de GitHub |
---|
11 | # Autor: Ramón Gómez, Universidad de Sevilla |
---|
12 | # Fecha: 27/05/2018 |
---|
13 | |
---|
14 | |
---|
15 | # Comprobaciones. |
---|
16 | for PROG in jq unzip; do |
---|
17 | if ! which $PROG &>/dev/null; then |
---|
18 | echo "Please, install \"$PROG\" package." |
---|
19 | exit 1 |
---|
20 | fi |
---|
21 | done |
---|
22 | |
---|
23 | # Variables. |
---|
24 | BRANCH="master" |
---|
25 | CODE_URL="https://codeload.github.com/opengnsys/OpenGnsys/zip/$BRANCH" |
---|
26 | API_URL="https://api.github.com/repos/opengnsys/OpenGnsys/branches/$BRANCH" |
---|
27 | REVISION=$(curl -s "$API_URL" | jq '"r" + (.commit.commit.committer.date | split("-") | join("")[:8]) + "." + (.commit.sha[:7])') |
---|
28 | |
---|
29 | # Descargar del repositorio de código. |
---|
30 | cd /tmp |
---|
31 | rm -fr opengnsys |
---|
32 | curl "$CODE_URL" -o opengnsys.zip && unzip opengnsys.zip && mv "OpenGnsys-$BRANCH" opengnsys |
---|
33 | |
---|
34 | # Asisgnar propietario de los ficheros descargados. |
---|
35 | chown -R root.root opengnsys |
---|
36 | WARNING=$? |
---|
37 | |
---|
38 | # Parchear datos de revisión del código. |
---|
39 | jq ".release=$REVISION" opengnsys/doc/VERSION.json | sponge opengnsys/doc/VERSION.json |
---|
40 | |
---|
41 | # Generar fichero comprimido. |
---|
42 | VERSION=$(jq -r '.version+"-"+.release' opengnsys/doc/VERSION.json) |
---|
43 | tar cvzf opengnsys-$VERSION.tar.gz opengnsys |
---|
44 | rm -fr opengnsys opengnsys.zip |
---|
45 | |
---|
46 | # Revisar salida. |
---|
47 | [ $WARNING != 0 ] && echo "*** WARNING: cannot change owner of files to \"root\" user before compressing." |
---|
48 | ls -lh $(readlink -e opengnsys-$VERSION.tar.gz) |
---|
49 | |
---|
Note: See
TracBrowser
for help on using the repository browser.