[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-clonage/sources/scripts/ -> se3_get_udpcast.sh (source)

   1  #!/bin/bash
   2  
   3  # $Id: se3_get_udpcast.sh 6661 2011-11-30 18:20:55Z crob $
   4  # Auteur: Stephane Boireau
   5  # Derniere modification: 30/11/2011
   6  
   7  # Ajout en visudo:
   8  # Cmnd_Alias SE3CLONAGE=/usr/share/se3/scripts/se3_tftp_boot_pxe.sh,/usr/share/se3/scripts/se3_get_sysresccd.sh
   9  
  10  # Coquille vide pour le moment
  11  # - telecharger udpcast depuis http://wawadeb.crdp.ac-caen.fr/iso/udpcast/
  12  
  13  . /usr/share/se3/includes/config.inc.sh -d
  14  . /usr/share/se3/includes/functions.inc.sh
  15  
  16  COLTITRE="\033[1;35m"   # Rose
  17  COLPARTIE="\033[1;34m"  # Bleu
  18  
  19  COLTXT="\033[0;37m"     # Gris
  20  COLCHOIX="\033[1;33m"   # Jaune
  21  COLDEFAUT="\033[0;33m"  # Brun-jaune
  22  COLSAISIE="\033[1;32m"  # Vert
  23  
  24  COLCMD="\033[1;37m"     # Blanc
  25  
  26  COLERREUR="\033[1;31m"  # Rouge
  27  COLINFO="\033[0;36m"    # Cyan
  28  
  29  # Parametres
  30  timestamp=$(date +%s)
  31  timedate=$(date "+%Y%m%d_%H%M%S")
  32  
  33  src="http://wawadeb.crdp.ac-caen.fr/iso/udpcast"
  34  
  35  tmp="/var/se3/tmp_udpcast_$timedate}"
  36  mkdir -p "$tmp"
  37  chmod 700 $tmp
  38  
  39  # ========================================
  40  
  41  # Valeurs des versions en place recuperees de se3db.params:
  42  version_noyo_udpcast_en_place="$udpcast_noyo_version"
  43  version_initrd_udpcast_en_place="$udpcast_initrd_version"
  44  version_noyo_old_udpcast_en_place="$udpcast_noyo_old_version"
  45  version_initrd_old_udpcast_en_place="$udpcast_initrd_old_version"
  46  
  47  # ========================================
  48  
  49  t=$(echo "$*" | grep "check_version")
  50  if [ -n "$t" ]; then
  51      cd $tmp
  52      wget $src/versions.txt > /dev/null 2>&1
  53  
  54      #vmlu26
  55      #udprd
  56      #vmlu26.old
  57      #udprd.old
  58  
  59      if [ "$?" = 0 -a -e versions.txt ]; then
  60          version_noyo_udpcast_en_ligne=$(grep ";vmlu26$" $tmp/versions.txt | cut -d";" -f1)
  61          version_initrd_udpcast_en_ligne=$(grep ";udprd$" $tmp/versions.txt | cut -d";" -f1)
  62          version_noyo_old_udpcast_en_ligne=$(grep ";vmlu26.old$" $tmp/versions.txt | cut -d";" -f1)
  63          version_initrd_old_udpcast_en_ligne=$(grep ";udprd.old$" $tmp/versions.txt | cut -d";" -f1)
  64  
  65  
  66          # Pour le premier lancement: mise en place du nouveau dispositif
  67          if [ -z "$version_noyo_udpcast_en_place" ]; then
  68              md5_en_ligne=$(grep ";vmlu26$" $tmp/versions.txt | cut -d";" -f2)
  69              if [ -e "/tftpboot/vmlu26" ]; then
  70                  md5_en_place=$(md5sum /tftpboot/vmlu26|cut -d" " -f1)
  71                  if [ "$md5_en_place" = "$md5_en_ligne" ]; then
  72                      udpcast_noyo_version=$version_noyo_udpcast_en_ligne
  73                      SETMYSQL udpcast_noyo_version "$udpcast_noyo_version" "version actuelle du noyau udpcast" 7
  74                      version_noyo_udpcast_en_place=$version_noyo_udpcast_en_ligne
  75                  fi
  76              fi
  77          
  78          fi
  79          
  80          if [ -z "$version_initrd_udpcast_en_place" ]; then
  81              md5_en_ligne=$(grep ";udprd$" $tmp/versions.txt | cut -d";" -f2)
  82              if [ -e "/tftpboot/udprd" ]; then
  83                  md5_en_place=$(md5sum /tftpboot/udprd|cut -d" " -f1)
  84                  if [ "$md5_en_place" = "$md5_en_ligne" ]; then
  85                      udpcast_initrd_version=$version_initrd_udpcast_en_ligne
  86                      SETMYSQL udpcast_initrd_version "$udpcast_initrd_version" "version actuelle du initrd udpcast" 7
  87                      version_initrd_udpcast_en_place=$version_initrd_udpcast_en_ligne
  88                  fi
  89              fi
  90          
  91          fi
  92          
  93          
  94          if [ -z "$version_noyo_old_udpcast_en_place" ]; then
  95              md5_en_ligne=$(grep ";vmlu26.old$" $tmp/versions.txt | cut -d";" -f2)
  96              if [ -e "/tftpboot/vmlu26.old" ]; then
  97                  md5_en_place=$(md5sum /tftpboot/vmlu26.old|cut -d" " -f1)
  98                  if [ "$md5_en_place" = "$md5_en_ligne" ]; then
  99                      udpcast_noyo_old_version=$version_noyo_old_udpcast_en_ligne
 100                      SETMYSQL udpcast_noyo_old_version "$udpcast_noyo_old_version" "version old du noyau old udpcast" 7
 101                      version_noyo_old_udpcast_en_place=$version_noyo_old_udpcast_en_ligne
 102                  fi
 103              fi
 104          
 105          fi
 106          
 107          if [ -z "$version_initrd_old_udpcast_en_place" ]; then
 108              md5_en_ligne=$(grep ";udprd.old$" $tmp/versions.txt | cut -d";" -f2)
 109              if [ -e "/tftpboot/udprd.old" ]; then
 110                  md5_en_place=$(md5sum /tftpboot/udprd.old|cut -d" " -f1)
 111                  if [ "$md5_en_place" = "$md5_en_ligne" ]; then
 112                      udpcast_initrd_old_version=$version_initrd_old_udpcast_en_ligne
 113                      SETMYSQL udpcast_initrd_old_version "$udpcast_initrd_old_version" "version old du initrd udpcast" 7
 114                      version_initrd_old_udpcast_en_place=$version_initrd_old_udpcast_en_ligne
 115                  fi
 116              fi
 117          
 118          fi
 119  
 120          temoin_erreur="n"
 121          temoin_fichier_manquant="n"
 122          if [ ! -e "/tftpboot/vmlu26" ]; then
 123              temoin_fichier_manquant="y"
 124              version_noyo_udpcast_en_place="<span style='color:red'>Absent</span>"
 125          else
 126              md5_en_place=$(md5sum /tftpboot/vmlu26|cut -d" " -f1)
 127              md5_en_ligne=$(grep ";vmlu26$" $tmp/versions.txt | cut -d";" -f2)
 128      
 129              if [ "$md5_en_ligne" != "$md5_en_place" ]; then
 130                  version_noyo_udpcast_en_place="<span style='color:red'>Somme MD5 incorrecte</span>"
 131                  temoin_erreur="y"
 132              fi
 133          fi
 134  
 135          if [ ! -e "/tftpboot/udprd" ]; then
 136              temoin_fichier_manquant="y"
 137              version_initrd_udpcast_en_place="<span style='color:red'>Absent</span>"
 138          else
 139              md5_en_place=$(md5sum /tftpboot/udprd|cut -d" " -f1)
 140              md5_en_ligne=$(grep ";udprd$" $tmp/versions.txt | cut -d";" -f2)
 141      
 142              if [ "$md5_en_ligne" != "$md5_en_place" ]; then
 143                  version_initrd_udpcast_en_place="<span style='color:red'>Somme MD5 incorrecte</span>"
 144                  temoin_erreur="y"
 145              fi
 146          fi
 147  
 148          if [ ! -e "/tftpboot/vmlu26.old" ]; then
 149              temoin_fichier_manquant="y"
 150              version_noyo_old_udpcast_en_place="<span style='color:red'>Absent</span>"
 151          else
 152              md5_en_place=$(md5sum /tftpboot/vmlu26.old|cut -d" " -f1)
 153              md5_en_ligne=$(grep ";vmlu26.old$" $tmp/versions.txt | cut -d";" -f2)
 154      
 155              if [ "$md5_en_ligne" != "$md5_en_place" ]; then
 156                  version_noyo_old_udpcast_en_place="<span style='color:red'>Somme MD5 incorrecte</span>"
 157                  temoin_erreur="y"
 158              fi
 159          fi
 160  
 161          if [ ! -e "/tftpboot/udprd.old" ]; then
 162              temoin_fichier_manquant="y"
 163              version_initrd_old_udpcast_en_place="<span style='color:red'>Absent</span>"
 164          else
 165              md5_en_place=$(md5sum /tftpboot/udprd.old|cut -d" " -f1)
 166              md5_en_ligne=$(grep ";udprd.old$" $tmp/versions.txt | cut -d";" -f2)
 167      
 168              if [ "$md5_en_ligne" != "$md5_en_place" ]; then
 169                  version_initrd_old_udpcast_en_place="<span style='color:red'>Somme MD5 incorrecte</span>"
 170                  temoin_erreur="y"
 171              fi
 172          fi
 173  
 174          if [ "$temoin_erreur" != "y" -a "$temoin_fichier_manquant" != "y" -a "$version_noyo_udpcast_en_ligne" = "$version_noyo_udpcast_en_place" -a "$version_initrd_udpcast_en_ligne" = "$version_initrd_udpcast_en_place" -a "$version_noyo_old_udpcast_en_ligne" = "$version_noyo_old_udpcast_en_place" -a "$version_initrd_old_udpcast_en_ligne" = "$version_initrd_old_udpcast_en_place" ]; then
 175              echo "<p><span style='color:green'>Dispositif &agrave; jour</span></p>";
 176          else
 177              echo "<p><span style='color:red'>Mise &agrave; jour disponible</span></p>";
 178          fi
 179  
 180          echo "<table class='crob'>
 181  <tr>
 182      <th>&nbsp;</th>
 183      <th>Sur votre SE3</th>
 184      <th>En ligne</th>
 185  </tr>
 186  <tr>
 187      <th>Noyau udpcast</th>
 188      <td>$version_noyo_udpcast_en_place</td>
 189      <td>$version_noyo_udpcast_en_ligne</td>
 190  </tr>
 191  <tr>
 192      <th>initrd udpcast</th>
 193      <td>$version_initrd_udpcast_en_place</td>
 194      <td>$version_initrd_udpcast_en_ligne</td>
 195  </tr>
 196  <tr>
 197      <th>Noyau old udpcast</th>
 198      <td>$version_noyo_old_udpcast_en_place</td>
 199      <td>$version_noyo_old_udpcast_en_ligne</td>
 200  </tr>
 201  <tr>
 202      <th>initrd old udpcast</th>
 203      <td>$version_initrd_old_udpcast_en_place</td>
 204      <td>$version_initrd_old_udpcast_en_ligne</td>
 205  </tr>
 206  </table>";
 207  
 208      else
 209          echo "<p><span style='color:red'>ECHEC du telechargement du fichier des versions.</span></p>"
 210      fi
 211  
 212      exit
 213  fi
 214  
 215  # ========================================
 216  
 217  t=$(echo "$*" | grep "mode=html")
 218  if [ -z "$t" ]; then
 219      mode="cmdline"
 220  else
 221      mode="html"
 222  fi
 223  
 224  if [ "$mode" = "cmdline" ]; then
 225      echo -e "$COLTXT"
 226  else
 227      echo "<pre>"
 228      echo "<h3>"
 229  fi
 230  echo "Mise en place des fichiers utiles pour udpcast en boot PXE."
 231  if [ "$mode" = "cmdline" ]; then
 232      echo -e "$COLCMD"
 233  else
 234      echo "</h3>"
 235  fi
 236  
 237  # Telecharger
 238  cd $tmp
 239  wget $src/versions.txt
 240  if [ "$?" != "0" ]; then
 241      if [ "$mode" = "cmdline" ]; then
 242          echo -e "$COLERREUR"
 243      else
 244          echo "<span style='color:red'>"
 245      fi
 246      echo "ERREUR lors du telechargement de $src/versions.txt"
 247      echo "ABANDON."
 248      if [ "$mode" = "cmdline" ]; then
 249          echo -e "$COLTXT"
 250      else
 251          echo "</span>"
 252          echo "</pre>"
 253      fi
 254      exit
 255  else
 256      if [ "$mode" = "cmdline" ]; then
 257          echo -e "$COLINFO"
 258      else
 259          echo "<span style='color:green'>"
 260      fi
 261      echo "SUCCES du telechargement de $src/versions.txt"
 262      if [ "$mode" = "cmdline" ]; then
 263          echo -e "$COLTXT"
 264      else
 265          echo "</span>"
 266      fi
 267  fi
 268  
 269  version_noyo_udpcast_en_ligne=$(grep ";vmlu26$" $tmp/versions.txt | cut -d";" -f1)
 270  version_initrd_udpcast_en_ligne=$(grep ";udprd$" $tmp/versions.txt | cut -d";" -f1)
 271  version_noyo_old_udpcast_en_ligne=$(grep ";vmlu26.old$" $tmp/versions.txt | cut -d";" -f1)
 272  version_initrd_old_udpcast_en_ligne=$(grep ";udprd.old$" $tmp/versions.txt | cut -d";" -f1)
 273  
 274  # On controle si des fichiers udpcast sont deja en place
 275  if [ -e "/tftpboot/vmlu26" -a -e "/tftpboot/udprd" -a -e "/tftpboot/vmlu26.old" -a -e "/tftpboot/udprd.old" ]; then
 276  
 277      # Pour le premier lancement: mise en place du nouveau dispositif
 278      if [ -z "$version_noyo_udpcast_en_place" ]; then
 279          md5_en_ligne=$(grep ";vmlu26$" $tmp/versions.txt | cut -d";" -f2)
 280          if [ -e "/tftpboot/vmlu26" ]; then
 281              md5_en_place=$(md5sum /tftpboot/vmlu26|cut -d" " -f1)
 282              if [ "$md5_en_place" = "$md5_en_ligne" ]; then
 283                  udpcast_noyo_version=$version_noyo_udpcast_en_ligne
 284                  SETMYSQL udpcast_noyo_version "$udpcast_noyo_version" "version actuelle du noyau udpcast" 7
 285                  version_noyo_udpcast_en_place=$version_noyo_udpcast_en_ligne
 286              fi
 287          fi
 288      
 289      fi
 290      
 291      if [ -z "$version_initrd_udpcast_en_place" ]; then
 292          md5_en_ligne=$(grep ";udprd$" $tmp/versions.txt | cut -d";" -f2)
 293          if [ -e "/tftpboot/udprd" ]; then
 294              md5_en_place=$(md5sum /tftpboot/udprd|cut -d" " -f1)
 295              if [ "$md5_en_place" = "$md5_en_ligne" ]; then
 296                  udpcast_initrd_version=$version_initrd_udpcast_en_ligne
 297                  SETMYSQL udpcast_initrd_version "$udpcast_initrd_version" "version actuelle du initrd udpcast" 7
 298                  version_initrd_udpcast_en_place=$version_initrd_udpcast_en_ligne
 299              fi
 300          fi
 301      
 302      fi
 303      
 304      
 305      if [ -z "$version_noyo_old_udpcast_en_place" ]; then
 306          md5_en_ligne=$(grep ";vmlu26.old$" $tmp/versions.txt | cut -d";" -f2)
 307          if [ -e "/tftpboot/vmlu26.old" ]; then
 308              md5_en_place=$(md5sum /tftpboot/vmlu26.old|cut -d" " -f1)
 309              if [ "$md5_en_place" = "$md5_en_ligne" ]; then
 310                  udpcast_noyo_old_version=$version_noyo_old_udpcast_en_ligne
 311                  SETMYSQL udpcast_noyo_old_version "$udpcast_noyo_old_version" "version old du noyau old udpcast" 7
 312                  version_noyo_old_udpcast_en_place=$version_noyo_old_udpcast_en_ligne
 313              fi
 314          fi
 315      
 316      fi
 317      
 318      if [ -z "$version_initrd_old_udpcast_en_place" ]; then
 319          md5_en_ligne=$(grep ";udprd.old$" $tmp/versions.txt | cut -d";" -f2)
 320          if [ -e "/tftpboot/udprd.old" ]; then
 321              md5_en_place=$(md5sum /tftpboot/udprd.old|cut -d" " -f1)
 322              if [ "$md5_en_place" = "$md5_en_ligne" ]; then
 323                  udpcast_initrd_old_version=$version_initrd_old_udpcast_en_ligne
 324                  SETMYSQL udpcast_initrd_old_version "$udpcast_initrd_old_version" "version old du initrd udpcast" 7
 325                  version_initrd_old_udpcast_en_place=$version_initrd_old_udpcast_en_ligne
 326              fi
 327          fi
 328      
 329      fi
 330  
 331  
 332  
 333      if [ -e "/tftpboot/vmlu26" ]; then
 334          md5_en_place=$(md5sum /tftpboot/vmlu26|cut -d" " -f1)
 335          md5_en_ligne=$(grep ";vmlu26$" $tmp/versions.txt | cut -d";" -f2)
 336  
 337          if [ "$md5_en_ligne" != "$md5_en_place" ]; then
 338              version_noyo_udpcast_en_place=""
 339          fi
 340      fi
 341  
 342      if [ -e "/tftpboot/udprd" ]; then
 343          md5_en_place=$(md5sum /tftpboot/udprd|cut -d" " -f1)
 344          md5_en_ligne=$(grep ";udprd$" $tmp/versions.txt | cut -d";" -f2)
 345  
 346          if [ "$md5_en_ligne" != "$md5_en_place" ]; then
 347              version_initrd_udpcast_en_place=""
 348          fi
 349      fi
 350  
 351      if [ -e "/tftpboot/vmlu26.old" ]; then
 352          md5_en_place=$(md5sum /tftpboot/vmlu26.old|cut -d" " -f1)
 353          md5_en_ligne=$(grep ";vmlu26.old$" $tmp/versions.txt | cut -d";" -f2)
 354  
 355          if [ "$md5_en_ligne" != "$md5_en_place" ]; then
 356              version_noyo_old_udpcast_en_place=""
 357          fi
 358      fi
 359  
 360      if [ -e "/tftpboot/udprd.old" ]; then
 361          md5_en_place=$(md5sum /tftpboot/udprd.old|cut -d" " -f1)
 362          md5_en_ligne=$(grep ";udprd.old$" $tmp/versions.txt | cut -d";" -f2)
 363  
 364          if [ "$md5_en_ligne" != "$md5_en_place" ]; then
 365              version_initrd_old_udpcast_en_place=""
 366          fi
 367      fi
 368  
 369  
 370      # On controle la version des fichiers
 371      if [ "$version_noyo_udpcast_en_ligne" = "$version_noyo_udpcast_en_place" -a "$version_initrd_udpcast_en_ligne" = "$version_initrd_udpcast_en_place" -a "$version_noyo_old_udpcast_en_ligne" = "$version_noyo_old_udpcast_en_place" -a "$version_initrd_old_udpcast_en_ligne" = "$version_initrd_old_udpcast_en_place" ]; then
 372          if [ "$mode" = "cmdline" ]; then
 373              echo -e "$COLINFO"
 374          else
 375              echo "<span style='color:green'>"
 376          fi
 377          echo "Les fichiers vmlu26 et udprd de udpcast sont deja les plus recents; On ne les re-telecharge pas."
 378          if [ "$mode" = "cmdline" ]; then
 379              echo -e "$COLTXT"
 380          else
 381              echo "</span>"
 382          fi
 383          temoin_telech_requis="n"
 384      else
 385          # La version a change.
 386          temoin_telech_requis="y"
 387      fi
 388  else
 389      # Il manque au moins un fichier, on telecharge pour mettre a jour
 390      temoin_telech_requis="y"
 391  fi
 392  
 393  if [ "$temoin_telech_requis" = "y" ]; then
 394  
 395      md5_en_place=""
 396      md5_en_ligne=""
 397      if [ -e "/tftpboot/vmlu26" ]; then
 398          md5_en_place=$(md5sum /tftpboot/vmlu26|cut -d" " -f1)
 399          md5_en_ligne=$(grep ";vmlu26$" $tmp/versions.txt | cut -d";" -f2)
 400      fi
 401  
 402      if [ ! -e "/tftpboot/vmlu26" -o "$md5_en_ligne" != "$md5_en_place" -o "$version_noyo_udpcast_en_ligne" != "$version_noyo_udpcast_en_place" ]; then
 403          wget $src/vmlu26
 404          if [ "$?" != "0" ]; then
 405              if [ "$mode" = "cmdline" ]; then
 406                  echo -e "$COLERREUR"
 407              else
 408                  echo "<span style='color:red'>"
 409              fi
 410              echo "ERREUR lors du telechargement de $src/vmlu26"
 411              echo "ABANDON."
 412              if [ "$mode" = "cmdline" ]; then
 413                  echo -e "$COLTXT"
 414              else
 415                  echo "</span>"
 416                  echo "</pre>"
 417              fi
 418              exit
 419          fi
 420      
 421          if [ "$mode" = "cmdline" ]; then
 422              echo -e "$COLINFO"
 423          else
 424              echo "<span style='color:green'>"
 425          fi
 426          echo "SUCCES du telechargement de $src/vmlu26"
 427          if [ "$mode" = "cmdline" ]; then
 428              echo -e "$COLTXT"
 429          else
 430              echo "</span>"
 431          fi
 432  
 433          md5_telech=$(md5sum vmlu26|cut -d" " -f1)
 434          md5_en_ligne=$(grep ";vmlu26$" $tmp/versions.txt | cut -d";" -f2)
 435          if [ "$md5_telech" != "$md5_en_ligne" ]; then
 436              if [ "$mode" = "cmdline" ]; then
 437                  echo -e "$COLERREUR"
 438              else
 439                  echo "<span style='color:red'>"
 440              fi
 441              echo "ANOMALIE: La somme MD5 ne coincide pas: $md5_en_ligne en ligne et $md5_telech telecharge."
 442              echo "ABANDON."
 443              if [ "$mode" = "cmdline" ]; then
 444                  echo -e "$COLTXT"
 445              else
 446                  echo "</span>"
 447                  echo "</pre>"
 448              fi
 449              exit
 450          fi
 451  
 452          liste_fichiers_a_copier="$liste_fichiers_a_copier vmlu26"
 453      fi
 454  
 455      md5_en_place=""
 456      md5_en_ligne=""
 457      if [ -e "/tftpboot/udprd" ]; then
 458          md5_en_place=$(md5sum /tftpboot/udprd|cut -d" " -f1)
 459          md5_en_ligne=$(grep ";udprd$" $tmp/versions.txt | cut -d";" -f2)
 460      fi
 461  
 462      if [ ! -e "/tftpboot/udprd" -o "$md5_en_ligne" != "$md5_en_place" -o "$version_initrd_udpcast_en_ligne" != "$version_initrd_udpcast_en_place" ]; then
 463          wget $src/udprd
 464          if [ "$?" != "0" ]; then
 465              if [ "$mode" = "cmdline" ]; then
 466                  echo -e "$COLERREUR"
 467              else
 468                  echo "<span style='color:red'>"
 469              fi
 470              echo "ERREUR lors du telechargement de $src/udprd"
 471              echo "ABANDON."
 472              if [ "$mode" = "cmdline" ]; then
 473                  echo -e "$COLTXT"
 474              else
 475                  echo "</span>"
 476                  echo "</pre>"
 477              fi
 478              exit
 479          fi
 480  
 481          if [ "$mode" = "cmdline" ]; then
 482              echo -e "$COLINFO"
 483          else
 484              echo "<span style='color:green'>"
 485          fi
 486          echo "SUCCES du telechargement de $src/udprd"
 487          if [ "$mode" = "cmdline" ]; then
 488              echo -e "$COLTXT"
 489          else
 490              echo "</span>"
 491          fi
 492  
 493          md5_telech=$(md5sum udprd|cut -d" " -f1)
 494          md5_en_ligne=$(grep ";udprd$" $tmp/versions.txt | cut -d";" -f2)
 495          if [ "$md5_telech" != "$md5_en_ligne" ]; then
 496              if [ "$mode" = "cmdline" ]; then
 497                  echo -e "$COLERREUR"
 498              else
 499                  echo "<span style='color:red'>"
 500              fi
 501              echo "ANOMALIE: La somme MD5 ne coincide pas: $md5_en_ligne en ligne et $md5_telech telecharge."
 502              echo "ABANDON"
 503              if [ "$mode" = "cmdline" ]; then
 504                  echo -e "$COLTXT"
 505              else
 506                  echo "</span>"
 507                  echo "</pre>"
 508              fi
 509              exit
 510          fi
 511  
 512          liste_fichiers_a_copier="$liste_fichiers_a_copier udprd"
 513      fi
 514  
 515  
 516      md5_en_place=""
 517      md5_en_ligne=""
 518      if [ -e "/tftpboot/vmlu26.old" ]; then
 519          md5_en_place=$(md5sum /tftpboot/vmlu26.old|cut -d" " -f1)
 520          md5_en_ligne=$(grep ";vmlu26.old$" $tmp/versions.txt | cut -d";" -f2)
 521      fi
 522  
 523      if [ ! -e "/tftpboot/vmlu26.old" -o "$md5_en_ligne" != "$md5_en_place" -o "$version_noyo_old_udpcast_en_ligne" != "$version_noyo_old_udpcast_en_place" ]; then
 524          wget $src/vmlu26.old
 525          if [ "$?" != "0" ]; then
 526              if [ "$mode" = "cmdline" ]; then
 527                  echo -e "$COLERREUR"
 528              else
 529                  echo "<span style='color:red'>"
 530              fi
 531              echo "ERREUR lors du telechargement de $src/vmlu26.old"
 532              echo "ABANDON."
 533              if [ "$mode" = "cmdline" ]; then
 534                  echo -e "$COLTXT"
 535              else
 536                  echo "</span>"
 537                  echo "</pre>"
 538              fi
 539              exit
 540          fi
 541      
 542          if [ "$mode" = "cmdline" ]; then
 543              echo -e "$COLINFO"
 544          else
 545              echo "<span style='color:green'>"
 546          fi
 547          echo "SUCCES du telechargement de $src/vmlu26.old"
 548          if [ "$mode" = "cmdline" ]; then
 549              echo -e "$COLTXT"
 550          else
 551              echo "</span>"
 552          fi
 553  
 554          md5_telech=$(md5sum vmlu26.old|cut -d" " -f1)
 555          md5_en_ligne=$(grep ";vmlu26.old$" $tmp/versions.txt | cut -d";" -f2)
 556          if [ "$md5_telech" != "$md5_en_ligne" ]; then
 557              if [ "$mode" = "cmdline" ]; then
 558                  echo -e "$COLERREUR"
 559              else
 560                  echo "<span style='color:red'>"
 561              fi
 562              echo "ANOMALIE: La somme MD5 ne coincide pas: $md5_en_ligne en ligne et $md5_telech telecharge."
 563              echo "ABANDON."
 564              if [ "$mode" = "cmdline" ]; then
 565                  echo -e "$COLTXT"
 566              else
 567                  echo "</span>"
 568                  echo "</pre>"
 569              fi
 570              exit
 571          fi
 572  
 573          liste_fichiers_a_copier="$liste_fichiers_a_copier vmlu26.old"
 574      fi
 575  
 576      md5_en_place=""
 577      md5_en_ligne=""
 578      if [ -e "/tftpboot/udprd.old" ]; then
 579          md5_en_place=$(md5sum /tftpboot/udprd.old|cut -d" " -f1)
 580          md5_en_ligne=$(grep ";udprd.old$" $tmp/versions.txt | cut -d";" -f2)
 581      fi
 582  
 583      if [ ! -e "/tftpboot/udprd.old" -o "$md5_en_ligne" != "$md5_en_place" -o "$version_initrd_old_udpcast_en_ligne" != "$version_initrd_old_udpcast_en_place" ]; then
 584          wget $src/udprd.old
 585          if [ "$?" != "0" ]; then
 586              if [ "$mode" = "cmdline" ]; then
 587                  echo -e "$COLERREUR"
 588              else
 589                  echo "<span style='color:red'>"
 590              fi
 591              echo "ERREUR lors du telechargement de $src/udprd.old"
 592              echo "ABANDON."
 593              if [ "$mode" = "cmdline" ]; then
 594                  echo -e "$COLTXT"
 595              else
 596                  echo "</span>"
 597                  echo "</pre>"
 598              fi
 599              exit
 600          fi
 601  
 602          if [ "$mode" = "cmdline" ]; then
 603              echo -e "$COLINFO"
 604          else
 605              echo "<span style='color:green'>"
 606          fi
 607          echo "SUCCES du telechargement de $src/udprd.old"
 608          if [ "$mode" = "cmdline" ]; then
 609              echo -e "$COLTXT"
 610          else
 611              echo "</span>"
 612          fi
 613  
 614          md5_telech=$(md5sum udprd.old|cut -d" " -f1)
 615          md5_en_ligne=$(grep ";udprd.old$" $tmp/versions.txt | cut -d";" -f2)
 616          if [ "$md5_telech" != "$md5_en_ligne" ]; then
 617              if [ "$mode" = "cmdline" ]; then
 618                  echo -e "$COLERREUR"
 619              else
 620                  echo "<span style='color:red'>"
 621              fi
 622              echo "ANOMALIE: La somme MD5 ne coincide pas: $md5_en_ligne en ligne et $md5_telech telecharge."
 623              echo "ABANDON"
 624              if [ "$mode" = "cmdline" ]; then
 625                  echo -e "$COLTXT"
 626              else
 627                  echo "</span>"
 628                  echo "</pre>"
 629              fi
 630              exit
 631          fi
 632  
 633          liste_fichiers_a_copier="$liste_fichiers_a_copier udprd.old"
 634      fi
 635  
 636  
 637      if [ "$mode" = "cmdline" ]; then
 638          echo -e "$COLTXT"
 639      else
 640          echo "<b>"
 641      fi
 642      echo "Copie des fichiers vers leur emplacement..."
 643      if [ "$mode" = "cmdline" ]; then
 644          echo -e "$COLCMD"
 645      else
 646          echo "</b>"
 647      fi
 648      cp -fv $liste_fichiers_a_copier /tftpboot/
 649  
 650      if [ "$?" != "0"  ]; then
 651          if [ "$mode" = "cmdline" ]; then
 652              echo -e "$COLERREUR"
 653          else
 654              echo "<span style='color:red'>"
 655          fi
 656  
 657          echo "ERREUR lors de la copie"
 658  
 659          if [ "$mode" = "cmdline" ]; then
 660              echo -e "$COLTXT"
 661          else
 662              echo "</span>"
 663              echo "</pre>"
 664          fi
 665      else
 666          SETMYSQL udpcast_noyo_version "$version_noyo_udpcast_en_ligne" "version actuelle du noyau udpcast" 7
 667          SETMYSQL udpcast_initrd_version "$version_initrd_udpcast_en_ligne" "version actuelle du initrd udpcast" 7
 668      
 669          SETMYSQL udpcast_noyo_old_version "$version_noyo_old_udpcast_en_ligne" "version old du noyau udpcast" 7
 670          SETMYSQL udpcast_initrd_old_version "$version_initrd_old_udpcast_en_ligne" "version old du initrd udpcast" 7
 671      fi
 672  fi
 673  
 674  rm -fr $tmp
 675  
 676  if [ "$mode" = "cmdline" ]; then
 677      echo -e "$COLTITRE"
 678  else
 679      echo "<b>"
 680  fi
 681  echo "Termine."
 682  if [ "$mode" = "cmdline" ]; then
 683      echo -e "$COLTXT"
 684  else
 685      echo "</b>"
 686      echo "</pre>"
 687  fi


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1