Revision 42947

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/resources-application/tools/make-portable
32 32
#
33 33
##############################################################################
34 34

  
35
#set -x
35
set -x
36 36

  
37 37
#function handle_error() {
38 38
#    echo "FAILED: line $1, exit code $2"
......
59 59
}
60 60

  
61 61
function get_package_info() {
62
    PACKAGE_PATH="$1"
63
    PACKAGE_NAME="$(basename $PACKAGE_PATH)"
64
    PACKAGE_CODE=$(expr "$PACKAGE_NAME" : "gvSIG-desktop-[0-9.]*-\\([a-zA-Z0-9._]*\\)-")
65
    set +e
66
    PACKAGE_VERSION=$(expr "$PACKAGE_NAME" : "gvSIG-desktop-[0-9.]*-[a-zA-Z0-9._]*-\\([0-9.]*-[0-9]*\\)-")
67
    set -e
68
    if [ "X${PACKAGE_VERSION}X" == "XX" ] ; then
69
        PACKAGE_VERSION=$(expr "$PACKAGE_NAME" : "gvSIG-desktop-[0-9._]*-[a-zA-Z0-9._]*-\\([0-9.]*-[A-Z][.A-Za-z0-9_]*-[0-9]*\\)-")
70
    fi
71
    gpi_x =$(unzip -lc "${PACKAGE_PATH}" "${PACKAGE_CODE}/package.info" | grep type)
72
    PACKAGE_TYPE="${gpi_x/type=/}"
62
  PACKAGE_PATH="$1"
63

  
64
  #
65
  # A veces en el zip los archivos comienzan por "/" y otras no.
66
  # Asi que lo primero que hacemos es comprobar eso.
67
  #
68
  local prefix=""
69
  local line=""
70
  # El flag -Z1 muestra los ficheros unicamente, similar a -l pero
71
  # sin ningun tipo de cabezaras, resumenes o informacion adicional
72
  # por cada fichero. Solo el nombre con ruta de cada fichero.
73
  local x=$(unzip -Z1 "$PACKAGE_PATH" "*/package.info")
74
  if [ "${x:0:1}" == "/" ] ; then
75
    prefix="/"
76
  fi
77
  #
78
  # Usamos una redireccion y no un pipe ya que los elementos de un pipe se
79
  # ejecutan en un subshell separado y la asignacion a las variables dentro del
80
  # while solo tendria efecto en ese subshell.
81
  #
82
  # Atencion al parametro W del unzip, ya que si lo quitamos y en el zip hay
83
  # mas de un "package.info" nos los sacaria todos, y los resultados no serian
84
  # los esperados. Solo tenemos que leer el "package.info" que hay en el primer
85
  # subdirectorio del zip.
86
  # Con el tr intentamos eliminar lo \r ya que algunos package.info generados
87
  # desde windows tienen \r.
88
  #
89
  PACKE_INFO_CONTENTS=$(unzip -lpWc "$PACKAGE_PATH" "${prefix}*/package.info" | tr -d '\r')
90
  while read line ; do
91
    case "$line" in
92
    type=*)
93
      PACKAGE_TYPE=${line#type=}
94
      ;;
95
    version=*)
96
      PACKAGE_VERSION=${line#version=}
97
      ;;
98
    code=*)
99
      PACKAGE_CODE=${line#code=}
100
      ;;
101
    esac
102
  done <<END_OF_PACKAGE_INFO_CONTENTS
103
$PACKE_INFO_CONTENTS
104
END_OF_PACKAGE_INFO_CONTENTS
73 105
}
74 106

  
107

  
75 108
function install_symbols() {
76 109
    INSTALL_FOLDER="$1"
77 110

  
......
149 182
    do
150 183
      if [ -f "$PACKAGE_PATH" ] ; then
151 184
        PACKAGE_NAME="$(basename $PACKAGE_PATH)"
152
        get_package_info $PACKAGE_NAME
185
        get_package_info $PACKAGE_PATH
153 186
        if include_package $PACKAGE_CODE ; then
154 187
          case $PACKAGE_TYPE in
155 188
          plugin)
......
227 260
function mkdist() {
228 261
    cd $BASEFOLDER/standard
229 262

  
263
    # OS code (lin/win/darwin) + distribution + version
230 264
    export PORTABLE_OS="$1"
265

  
266
    # OS name (linux/windows/darwin) for show only
231 267
    export PORTABLE_OSNAME="$2"
268

  
269
    # Architectute X86, x86_64
232 270
    export PORTABLE_PLATFORM="$3"
233 271

  
234
    export ONLINE_OS="$PORTABLE_OSNAME"
235
    if [ "$PORTABLE_OSNAME" == "darwin" ] ; then
236
	export ONLINE_OS="lin"
237
    fi
272
    # OS used to locate the online zip
273
    export ONLINE_OS
274
    case "$PORTABLE_OSNAME" in
275
    darwin)
276
        ONLINE_OS="lin"
277
        ;;
278
    linux)
279
        ONLINE_OS="lin"
280
        ;;
281
    windows)
282
        ONLINE_OS="win"
283
        ;;
284
    *)
285
        ONLINE_OS="$PORTABLE_OS"
286
        ;;
287
    esac
238 288

  
239 289
    export PORTABLE_VERSION=$(expr *${ONLINE_OS}-${PORTABLE_PLATFORM}-online.zip : "gvSIG-desktop-\\([0-9.]*-[0-9]*\\)")
240 290
    export PORTABLE_STATUS=$(expr *${ONLINE_OS}-${PORTABLE_PLATFORM}-online.zip : "gvSIG-desktop-[0-9.]*-[0-9]*-\\([a-zA-Z]*[0-9]*\)")
......
306 356

  
307 357

  
308 358
function main() {
359
    mkdist win windows x86
360
    mkdist darwin_macos_10.11 darwin x86_64
361
    mkdist lin_ubuntu_16.04 linux x86_64
309 362
    mkdist lin linux x86
310 363
    mkdist lin linux x86_64
311
    mkdist win windows x86
312 364
    mkdist win windows x86_64
313
    mkdist darwin_macos_10.11 darwin x86_64
314
    mkdist lin_ubuntu_16.04 linux x86_64
315 365
    echo "Creation ended"
316 366
}
317 367

  
318 368
mkdir -p "$TARGET"
319 369
main | tee "$TARGET/${SCRIPT_NAME}.log"
320

  

Also available in: Unified diff