meta données pour cette page
  •  

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
info:geonetwork:geonetwork-maj [2017/05/24 17:16:25] – [Avant de lancer le script] cmartininfo:geonetwork:geonetwork-maj [2017/05/27 09:11:40] (Version actuelle) cmartin
Ligne 1: Ligne 1:
 ====== Update de geonetwork ====== ====== Update de geonetwork ======
  
-2017/05/18 17:45:03.+samedi 27 mai 2017, 09:08:59 (UTC+0200)
 cmartin cmartin
  
 Contient un script à lancer pour faire les mises à jour de geonetwork. Contient un script à lancer pour faire les mises à jour de geonetwork.
-Tout ce qu'il faut c'est connaitre le dossier qui contient le WAR +Tout ce qu'il faut c'est 
-de geonetwork et un nouveau WAR.+  - connaître le dossier où le war courant est déployé 
 +  - connaître le chemin du war actuel 
 +  - avoir un nouveau war sous la main
  
 <note importante> <note importante>
-valable pour les installations de geonetwork faites +Valable pour les installations de geonetwork faites 
-en déployant un WAR, pas en utilisant le JAR d'installation.+en déployant un WAR, pas en utilisant le JAR d'installation
  
 \\ \\
Ligne 24: Ligne 26:
   * avoir une copie du dossier de geonetwork (tar ou autre)   * avoir une copie du dossier de geonetwork (tar ou autre)
 En cas d'échec ça permettra de remettre les choses comme il faut. En cas d'échec ça permettra de remettre les choses comme il faut.
 +  * S'assurer que le jre installé correspond à la nouvelle version du war de geonetwork. Ainsi pour geonetwork 3.2.1, il **faut** un JRE version 8, possiblement openjdk-8-jre-headless .
  
 ===== Avant de lancer le script ===== ===== Avant de lancer le script =====
  
-  * Arreter tomcat avant de lancer le script !! +Arreter tomcat avant de lancer le script !!
-  * Disposer du fichier war de la nouvelle version sur la machine ou geonetwork sera mis à jour. +
-  * S'assurer que le jre installé correspond à la nouvelle version de geonetwork (par exemple, openjdk-8-jre-headless, c'est à dire la version **8** du JRE pour geonetwork 3.2.1)+
  
 ===== fonctionnement du script ===== ===== fonctionnement du script =====
Ligne 48: Ligne 49:
  
 Redémarrage de tomcat à votre charge. Redémarrage de tomcat à votre charge.
 +
 +===== Un mot sur le script =====
 +
 +C'était un machin en bash, fait par copier/coller de
 +l'historique de mon shell lors des sessions de mise à jour.
 +Évidemment, un tel machin est très instable et ne demande
 +qu'à se casser la figure à la première occasion. Ce qui n'a
 +pas manqué de se produire, lorsque que la locale était
 +différente sur la machine de test par rapport à la machine
 +de prod...
 +
 +Tout réécrit en python. Le script n'est pas plus clair, AMHA,
 +mais plus robuste certainement. Réécrit dans la nuit d'un
 +vendredi à un samedi, d'où le copyright à Schplurtz.
 +
 +**NB** pour moi même :\\
 +Le script à utiliser est ''update-geonetwork''. Il est généré
 +par le Makefile qui inclut le .mo en français. Le script
 +a éditer est ''enpython''
  
 ===== Le script ===== ===== Le script =====
  
-**note perso**:\\ Ce script est dans le git IUEM des sysadmins.+**note perso** :\\ 
 +Ce script est dans le git IUEM des sysadmins.
  
-Cliquer sur le titre pour télécharger. +Cliquez sur le titre pour télécharger.  
-<code bash update-geonetwork> + 
-#! /bin/bash+<code python update-geonetwork> 
 +#! /usr/bin/env python
 # encoding: utf-8 # encoding: utf-8
 +# vim: se ts=2 sw=2 et ai:
 +license='''
 +
 +
 +         +-----------------------------------------------------------+
 +                                                                   |
 +          Attention, ce logiciel est potentiellement dangereux !   |
 +               Warting ! This software may be dangerous            |
 +                                                                   |
 +         | Veuillez prendre connaissance de la licence d'utilisation |
 +                   Please read the following license text          |
 +                                                                   |
 +         +-----------------------------------------------------------+
 +
 +
 +Software author : Christophe Martin, Schplurtz@laposte•net
    
-<<'42' +                          Copyright (C) Schplurtz le Déboulonné 2017
-Author : Christophe Martin, Christophe•Martin@univ-brest•fr +
-  +
-                          Copyright (C) UMR6538, 2015+
    
                FRENCH                             ENGLISH                FRENCH                             ENGLISH
Ligne 121: Ligne 156:
  les termes.                          |  les termes.                          |
    
-42+'''
  
-set -e # stop on error+import glob 
 +import zipfile 
 +import filecmp 
 +import tempfile 
 +import atexit 
 +import os 
 +import sys 
 +import subprocess 
 +import shutil 
 +import re 
 +import gettext 
 +import base64
  
-# setp variable-name1 variable-name2 
-setp() { 
-  eval "$1=\${$2}" 
-} 
-# setv var-name value 
-setv() { 
-  eval "$1=\$2" 
-} 
-warn() { 
-  echo "$@" >&2 
-} 
-fatal() { 
-  warn "$@" 
-  exit 
-  kill $$ 
-} 
  
-# ouinon [-default oui|non] question +def error*txt ): 
-# return code : +  sys.stderr.write( "\n".join(txt"\n")
-#                0 oui +
-#                1 non +
-#exemple +
-# ouinon -default non 'aimez vous le saucisson ?' && 'echo vous êtes gourmand' +
-ouinon() { +
-  local def= +
-  local rep +
-  if test '-default'"$1"; then +
-    case "$2" in  +
-    ([yYoO]|oui|Oui|oUi|ouI|OUi|OuI|oUI|OUI|yes|YES|Yes|YEs|YeS|yES|yEs|yeS) +
-      def=0 +
-    ;; +
-    ([nN]|non|Non|nOn|noN|NOn|NoN|nON|NON|no|No|nO|NO) +
-      def=1 +
-    ;; +
-    esac +
-    shift +
-    shift 2>/dev/null || : +
-  fi +
-  +
-  while : ; do +
-  read -p "$1 (o/n) : rep +
-  case "$rep" in +
-  ([yYoO]|oui|Oui|oUi|ouI|OUi|OuI|oUI|OUI|yes|YES|Yes|YEs|YeS|yES|yEs|yeS) +
-    return 0 +
-  ;; +
-  ([nN]|non|Non|nOn|noN|NOn|NoN|nON|NON|no|No|nO|NO) +
-    return 1 +
-  ;; +
-  esac +
-  done +
-}+
  
 +# thanks to stackoverflow
 +def which(program):
 +  import os
 +  def is_exe(fpath):
 +    return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
 +
 +  fpath, fname = os.path.split(program)
 +  if fpath:
 +    if is_exe(program):
 +      return program
 +  else:
 +    for path in os.environ['PATH'].split(os.pathsep):
 +      path = path.strip('"')
 +      exe_file = os.path.join(path, program)
 +      if is_exe(exe_file):
 +        return exe_file
 +
 +  return None
 +
 +def cleanup():
 +  os.chdir('/')
 +  # rmr(tmpdir) # Surtout pas ! Il peut y rester des fichiers importants
 +  rmr(os.path.join(tmpdir,'locale')) # C'est le moins qu'on puisse faire.
 +
 +def question( var, txt ):
 +  rep=raw_input( '{0} ({1}) '.format(txt, var) ).strip()
 +  if rep == 'exit':
 +    exit(0)
 +  if rep == '':
 +    return var
 +  return rep
 +
 +def yn(txt):
 +  while True:
 +    rep=''
 +    rep=question( rep, txt ).strip().lower()
 +    if re.match( '\A(o|oui|y|yes)\Z', rep ):
 +      return True
 +    if re.match( '\A(n|non|no)\Z', rep ):
 +      return False
 +
 +def iswar( fn ):
 +  '''
 +  a good war file is an existing zip file that
 +  contains at least META-INF/MANIFEST.MF .
 +  '''
 +  ret=True
 +  try:
 +    zip=zipfile.ZipFile( fn )
 +    zip.getinfo('META-INF/MANIFEST.MF')
 +  except:
 +    ret=False
 +  return ret
 +
 +def rmr( *fname ):
 +  for filename in fname:
 +    if os.path.islink(filename) or os.path.isfile(filename):
 +      os.remove(filename)
 +      # print 'rm    {0}'.format(filename)
 +    else:
 +      for root, dirs, files in os.walk(filename, False):
 +        for fn in files:
 +          os.remove(os.path.join(root,fn))
 +          # print 'rm    {0}'.format(os.path.join(root,fn))
 +        for dn in dirs:
 +          os.rmdir(os.path.join(root,dn))
 +          # print 'rmdir {0}'.format(os.path.join(root,dn))
 +      os.rmdir(filename)
 +      # print 'rmdir {0}'.format(filename)
 +
 +def bindata(fn):
 +  lines=''
 +  with open(fn) as data:
 +    ok=False
 +    for line in data:
 +      if not ok and line == '# __DATA__\n':
 +        ok=True
 +        continue
 +      if ok:
 +        lines += line[1:]
 +  return base64.b64decode(lines)
  
-# question varname "question text" 
-question() { 
-  local __vname=$1 __rep __value 
-  setp __value "$__vname" 
-  shift 
-  printf '%s ' "$@" 
-  printf "(%s) " "$__value" 
-  read __rep 
-  test "$__rep" || __rep=$__value 
-  setv "$__vname" "$__rep" 
-} 
  
 # #
-MAIN Main main+ Main main Main
 # #
 + 
 +me=os.path.abspath(__file__.rstrip('co'))
 +tmpdir=tempfile.mkdtemp()
 +os.makedirs(os.path.join(tmpdir,'locale/fr_FR/LC_MESSAGES'))
 +with open(os.path.join(tmpdir,'locale/fr_FR/LC_MESSAGES','cat.mo'),'w',0644) as cat:
 +  cat.write(bindata(me))
 +#gettext.install('enpython', os.path.join(os.path.dirname(__file__), 'locale'))
 +gettext.install('cat', os.path.join(os.path.join(tmpdir,'locale')))
  
-missing= +atexit.register( cleanup ) 
-for cmd in diff tar sed unzip less tee find split xargs sed awk; do +missing=False 
-  test "$(type -p $cmd)" || missing="$missing${missing+ }$cmd" +for cmd in ['less']: 
-done +  if not which( cmd )
-test "$missing" && +    error( _('missing '+ cmd ) 
-  fatal "Les commandes suivantes manquent : $missing"+    missing=True
  
-# approuver la licence +if( missing ): 
-+  error( ''
-echo +         _("There are missing commands")
-echo +         _(  bye bye") 
-echo "      +-----------------------------------------------------------+" +       ) 
-echo "      |                                                           |" +  exit( 1 )
-echo "      |  Attentionce logiciel est potentiellement dangereux     |" +
-echo                                                                |" +
-echo "      | Veuillez prendre connaissance de la licence d'utilisation |" +
-echo "      |                                                           |" +
-echo "      +-----------------------------------------------------------+" +
-echo +
-echo +
-sed -ne '/^Autho/,/^42/p' "$0" | +
-  sed -e '/^42$/d' +
-} | less +
-if ! ouinon -default non "Accepetez vous les risques et la licence ?+
-then +
-  fatal "Ok, fin du programme" +
-fi+
  
 +#
 +# Accept the license. Or not...
 +#
 +fnlic=os.path.join(tmpdir,'license')
 +with open(fnlic,'w',0644) as f:
 +  f.write(license)
 +subprocess.call(['less',
 +                 '-E', '-X', '-K',
 +                 _('-PSpace for next page'),
 +                 fnlic
 +                ]
 +               )
 +os.remove(fnlic)
 +if not yn( _("Do you accept the risks and the license ?") ):
 +  print _('Ok. exiting')
 +  exit(0)
  
- 
-geodir=/var/lib/tomcat8/webapps/geonetwork 
-while : ; do 
-  question geodir "Quel est le dossier de geonetwork ? " 
  
-  case "$geodir" in + 
-  (/*) +# 
-    geodir=${geodir%/} +# Now the real job 
-    test "$geodir" -a -r "$geodir.war" && { +
-      test -d "$geodir" || { +geonetdir='/var/lib/tomcat8/webapps/geonetwork' 
-        warn "Hum \"$geodir\" n'est pas un dossier..." +while True: 
-        continue +  geonetdir = question( geonetdir, 
-      }+                _('Directory containing current geonetwork')) 
 +  if os.path.isdir( geonetdir ): 
 +    webinf=os.path.join( geonetdir, 'WEB-INF' ) 
 +    if os.path.isdir( webinf ):
       break       break
-    } +  error( _('{0not a dir or not a geonetwork dir...').format(geonetdir), _('try again.')
-    warn "Impossible de lire \"$geodir.war\" le dossier est-il vraiment le bon ?" +
-    continue +
-  ;; +
-  (exitexit 0 ;; +
-  (*warn "Pas un dossier absolu" ;; +
-  esac +
-done+
  
-newwar+ 
-while : ; do +oldwar=geonetdir + '.war' 
-  question newwar Ou se trouve votre nouveau war '?' +while True
-  case "$geodir" in +  oldwar = question( oldwar, 
-  (exitexit 0 ;; +                     _('current war file') 
-  (*) +                   
-    test exit = "$newwar" && { +  if iswar(oldwar):
-      echo "bye bye" +
-      exit +
-    } +
-    test -r "$newwar" || { +
-      warn "Fichier illisible ou inexistant" +
-      continue +
-    } +
-    test "$geodir.war" = "$newwar" && { +
-      warn "Pas bon. $newwar devrait être le war actuel, pas le nouveau." +
-      continue +
-    } +
-    case "$newwar" in +
-    (/*) : ;; +
-    (*) newwar=$PWD/$newwar ;; +
-    esac +
-    cmp "$geodir.war" "$newwar" && { +
-      warn "$newwar et $geodir.war sont les mêmes. Mise à jour impossible." +
-      continue +
-    }+
     break     break
-  ;; +  error( '{0} Not a valid/redeable war file.'.format(oldwar), 'try again.' )
-  esac +
-done+
  
-echo "geodir : $geodir" 
-echo "oldwar : $geodir.war" 
-echo "newwar : $newwar" 
  
-if ouinon -default oui "On va maintenant tout modifierContinuer ?" +newwar='geonetwork-3.2.1.war' 
-then +while 1: 
-  : +  newwar=question( newwar, 
-else +                   _('New war file') 
-  echo "Bye bye" +                 ) 
-  exit +  if iswar(newwar): 
-fi+    break 
 +  error( '{0} Not a valid/redeable war file.'.format(newwar), 'try again.' )
  
-cd /tmp 
  
-export LANG=C LANGUAGE=C LC_ALL=+geonetdir=os.path.abspath(geonetdir) 
-# Arreter tomcat +oldwar=os.path.abspath(oldwar) 
-warn Arret de tomcat8 +newwar=os.path.abspath(newwar)
-systemctl stop tomcat8+
  
-warn "inspection du war actuel" +print '' 
-rm -rf geonetwork-old ; mkdir geonetwork-old ; cd geonetwork-old +print _('geonetwork dir : '), geonetdir 
-unzip -q "$geodir.war" +print _('current war file :  '), oldwar 
-  +print _('new war file : '), newwar
-warn recherche des fichiers modifies et des fichiers ajoutes. +
-# faire et conserver un diff +
-diff -Bbwur . "$geodir" | tee /tmp/diff-geonetwork >/dev/null+
  
-# Conserver les fichiers avec différence +oldcontent=os.path.join(tmpdir,'oldcontent') 
-tar cCf "$geodir" /tmp/fichiers_diff.tar $( +os.mkdir(oldcontent) 
-  awk '/^diff/ { print $3 }/tmp/diff-geonetwork +os.chdir(oldcontent)
-)+
  
-# extraire liste des fichiers présents dans le dossier, non présents dans le WAR et les conserver +print _('Extracting current war in temp dir') 
-tar cCf "$geodir" /tmp/fichiers_en_plus.tar $( +zipfile.ZipFile(oldwar, 'r').extractall()
-  sed -ne '/^Only in /{s///;s,: ,/,;p}/tmp/diff-geonetwork | +
-  sed -e "s^$geodir/" +
-+
-# Lister ces fichiers en plus (on liste le taril pourrait y avoir des dossiers...) +
-tar tf /tmp/fichiers_en_plus.tar | +
-  grep -v '/$+
-  sort -o /tmp/liste.enplus-old+
  
-warn installation du nouveau war dans "$geodir.war" +# Can't easily get what I want with filecmp.dircmp. It does not have 
-installer le nouveau war +recursive capabilities. too bad. Let's do it the barbarian way : 
-rm "$geodir.war" +# get 2 full lists and compare
-cp "$newwar" "$geodir.war"+# diff_cur_old=filecmp.dircmp(geonetdir, oldcontent) 
 +# diff_cur_old.report_full_closure() 
 +#for file in diff_cur_old.diff_files: 
 +#  print file
  
-dézipper le nouveau war  +#print '+++++++++++++++++++++++++++++++++++++++++++++' 
-warn deploiement du nouveau war +print _('Finding all files in current war') 
-cd "$geodir" +os.chdir(oldcontent) 
-unzip -q -o "$geodir.war" # ecrabouiller tous les fichiersrépondre "all"+oldtree=set() 
 +for root, dirs, files in os.walk('.'): 
 +  for name in files: 
 +    oldtree.add(os.path.join(root,name)[2:]) 
 +#print '==============================================' 
 +#for x in oldtree: 
 +#  print x
  
-# lister la totalité des fichiers et dossiers présents  +print _('Finding all files in current installation') 
-find -type f |  sed -e 's,^\./,,' | sort -o /tmp/liste.total+os.chdir(geonetdir) 
 +currenttree=set() 
 +for rootdirsfiles in os.walk('.'): 
 +  for name in files: 
 +    currenttree.add(os.path.join(root,name)[2:]) 
 +  #for name in dirs: 
 +  #  currenttree.add(os.path.join(root,name)) 
 +#for x in currenttree: 
 +#  print x
  
-warn inspection du nouveau war +print _('Computing file diff between current war and current deployed app') 
-# lister le contenu du nouveau war +currenttreeenplus=currenttree.copy() 
-unzip -qql "$newwar" | +currenttreeenplus -= oldtree 
-  awk 'ok && ! /\/ *$/ print $NF } /META-INF/ { ok=1 }' | +print _('{0more files installed than files in current war').format(len(currenttreeenplus)) 
-  sed -e 's,^\./,,| +''
-  sort -o /tmp/liste.nouveau+for x in currenttreeenplus: 
 +  print x 
 +  '''
  
-warn determination des fichiers obsoletes +communstree=currenttree.copy() 
-# Les fichiers à enlever sont donc : +communstree -= currenttreeenplus 
-# total nouveau - enplus +print _('computed {0} files in common (should be {1})').format( len(communstree), len(oldtree))
-# Prepare pour soustraction +
-sed -e 's/^/^/-e 's/$/$/' -e 's/\./\\./g' /tmp/liste.enplus-old >/tmp/liste.enplus.regexp +
-sed -e 's/^/^/' -e 's/$/$/' -e 's/\./\\./g' /tmp/liste.nouveau >/tmp/liste.nouveau.regexp+
  
-# La liste des trucs qu'il faut enlever est donc : +print _('searching among {0} files, those that have been modified').format(len(communstree)) 
-#grep -v -f /tmp/liste.enplus.regexp /tmp/liste.total | +modifiedtree=set() 
-#  grep -v -f /tmp/liste.nouveau.regexp | +for file in sorted(communstree): 
- tee /tmp/liste.a-detruire >/dev/null +  if not filecmp.cmp( os.path.join(geonetdir,file)os.path.join(oldcontent, file)): 
-#  +    modifiedtree.add(file)
-# Mais on risque de faire peter la mémoire car il y a trop de regexp dans les +
-# fichiersOn va les splitter et progresser par étapesOn peut pas non plus +
-# fabriquer un pipe immensepour la même raisondonc, fichiers intermédiaires... +
-# Naz... +
-split -l 100 -a 4 /tmp/liste.enplus.regexp /tmp/liste.enplus.regexp.partial. +
-split -l 100 -a 4 /tmp/liste.nouveau.regexp /tmp/liste.nouveau.regexp.partial.+
  
-cp /tmp/liste.total /tmp/liste.total.000 +print _('Removing temporary files'
-set -- /tmp/liste.total.000 /tmp/liste.total.001 +rmr(oldcontent)
-for i in /tmp/liste.enplus.regexp.partial.* /tmp/liste.nouveau.regexp.partial.* +
-do +
-  echo "$2" >/tmp/liste.a.supprimer # se souvenir du fichier resultat +
-  grep -v -f "$i" "$1" >"$2" +
-  set -- $2 $1 +
-done +
-: echo fichier reduit est $(</tmp/liste.a.supprimer+
-cd "$geodir" +
-warn suppression des fichiers obsoletes +
-xargs -d \\n rm <$(</tmp/liste.a.supprimer)+
  
-# Remettre les fichiers modifiés +print _('saving {0} modified files for later use').format(len(modifiedtree)) 
-if ouinon -default oui "Remettre les fichiers modifiés +modifiedfiles=os.path.join( tmpdir, 'modified) 
-$( +os.mkdir(modifiedfiles
-  tar tf /tmp/fichiers_diff.tar | head -12 | +for filename in modifiedtree: 
-  sed -e 's/^/  /+  dir=os.path.join( modifiedfiles, os.path.dirname( filename )) 
-+  if not os.path.exists( dir ): 
-Et peut-etre d'autresils sont dans /tmp/fichiers_diff.tar +    os.makedirs( dir ) 
-" +  shutil.copyfile(os.path.join(geonetdir, filename), os.path.join( modifiedfiles, filename ))
-then +
-  tar xf /tmp/fichiers_diff.tar +
-fi+
  
-warn suppression du cache +print _('Analyzing new war') 
-# Supprimer le cache +newzip=zipfile.ZipFile(newwar, 'r') 
-rm -rf \ +newwartree=set() 
-  WEB-INF/data/data/resources/htmlcache/formatter-cache/public/* \ +for filename in newzip.namelist(): 
-  WEB-INF/data/data/resources/htmlcache/formatter-cache/private/* \ +  newwartree.add(filename)
-  WEB-INF/data/data/resources/htmlcache/formatter-cache/info-store.*.db \ +
-  WEB-INF/data/wro4j-cache.trace.db WEB-INF/data/wro4j-cache.h2.db+
  
-warn don des fichiers a tomcat8: +print _('Finding obsolete files') 
-chown -hR tomcat8/var/lib/tomcat8/.+obsoletetree=oldtree.copy() 
 +obsoletetree -= newwartree 
 +print _('Found {0} obsolete files').format(len(obsoletetree)) 
 +if yn( _('all checks are done. Start modifying ?') ): 
 +  print _("Let's go!"
 +else: 
 +  print _('Bye bye.') 
 +  exit(0)
  
 +print _('extracting new war into {0}').format(geonetdir)
 +os.chdir(geonetdir)
 +newzip.extractall()
  
-echo "Finia vous de redemarrer le serveur tomcat8"+print _('removing obsolete files'
 +for filename in obsoletetree: 
 +  os.remove(filename)
  
-</code>+print _('removing cache'
 +rmr(*glob.glob('WEB-INF/data/data/resources/htmlcache/formatter-cache/public/*' )) 
 +rmr(*glob.glob('WEB-INF/data/data/resources/htmlcache/formatter-cache/private/*')) 
 +rmr(*glob.glob('WEB-INF/data/data/resources/htmlcache/formatter-cache/info-store.*.db')) 
 +rmr(*glob.glob('WEB-INF/data/wro4j-cache.*'))
  
-===== Résultat =====+rep='all' 
 +while True: 
 +  rep=question( rep, _(''' 
 +There are {0} modified files, what do you want to do ?
  
-{{:geonetwork-maj-en-3.2.1-sans-perte.png?direct|}+restore all 
-===== Auteur =====+1 : stop now and examine yourself the diffs 
 +: ask for each file 
 +''').format(len(modifiedtree)) 
 +  ).strip().lower() 
 +  if re.match( '\A[012]\Z', rep ): 
 +    break 
 +  error( _('did not understand, sorry...') ) 
 + 
 +os.chdir( modifiedfiles ) 
 +if '1' == rep: 
 +  print _("OKYou have to examine the situation.\nmodified files are in {0}").format(modifiedfiles) 
 +elif '0' == rep: 
 +  for filename in sorted(modifiedtree): 
 +    print filename 
 +    shutil.copyfile(filename, os.path.join(geonetdir,filename)) 
 +else: 
 +  for filename in sorted(modifiedtree): 
 +    if yn( _("reinstall modified this modified file to that location ?\n{0}\n{1}\n ?"). 
 +           format(os.path.join(modifiedfiles,filename),os.path.join(geonetdir,filename))): 
 +      shutil.copyfile(filename, os.path.join(geonetdir,filename)) 
 +      os.remove(filename) 
 +  for root, dirs, files in os.walk(modifiedfiles, False): 
 +    for dn in dirs: 
 +      try: 
 +        os.rmdir(os.path.join(root,dn)) 
 +      except: 
 +        pass 
 +  print _('you will find remaining files (if any) in {0}').format(modifiedfiles) 
 + 
 +print 'don des fichiers à tomcat8.' 
 +subprocess.call(['chown', '-hR', 'tomcat8:', geonetdir]) 
 + 
 +# __DATA__ 
 +#3hIElQAAAAAlAAAAHAAAAEQBAAA1AAAAbAIAAAAAAABAAwAAiwAAAEEDAAAKAAAAzQMAABUAAADY 
 +#AwAAEQAAAO4DAABAAAAAAAQAACcAAABBBAAAKQAAAGkEAAAiAAAAkwQAACkAAAC2BAAAIAAAAOAE 
 +#AAAWAAAAAQUAABgAAAAYBQAACQAAADEFAAAMAAAAOwUAAEAAAABIBQAACwAAAIkFAAAYAAAAlQUA 
 +#ABoAAACuBQAAJgAAAMkFAAAsAAAA8AUAABAAAAAdBgAAFAAAAC4GAAAcAAAAQwYAABsAAABgBgAA 
 +#EQAAAHwGAAAIAAAAjgYAAA8AAACXBgAAQwAAAKcGAAAOAAAA6wYAABcAAAD6BgAAJwAAABIHAAA4 
 +#AAAAOgcAAAoAAABzBwAALQAAAH4HAAAyAAAArAcAACgAAADfBwAAewEAAAgIAAC+AAAAhAkAAAUA 
 +#AABDCgAAHAAAAEkKAAAZAAAAZgoAAGQAAACACgAAMwAAAOUKAAApAAAAGQsAADYAAABDCwAAPAAA 
 +#AHoLAAAvAAAAtwsAACQAAADnCwAAIAAAAAwMAAAJAAAALQwAABMAAAA3DAAATwAAAEsMAAAOAAAA 
 +#mwwAACcAAACqDAAAIAAAANIMAAA3AAAA8wwAAEEAAAAr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