home *** CD-ROM | disk | FTP | other *** search
/ ftp.ac-grenoble.fr / 2015.02.ftp.ac-grenoble.fr.tar / ftp.ac-grenoble.fr / pub / slis / updates_rsync / slis_update-1.3 < prev    next >
Text File  |  2001-02-01  |  29KB  |  965 lines

  1. #!/bin/bash
  2.  
  3. # Script de mise α jour tΘlΘchargΘ rΘguliΦrement par rsync par tous les
  4. # serveurs SLIS dans les Θtablissements. 
  5.  
  6. # Script pour les SLIS version 1.3
  7. # Ce script est une conversion du script destine a l'ancien systeme (tftp)
  8. # jusqu'a la MAJ 136
  9.  
  10. # This script is part of the SLIS Project initiated by the CARMI-Internet
  11. # (AcadΘmie de Grenoble - France 38).
  12. # Ce script fait partie du projet SLIS dΘmarrΘ par le CARMI-Internet
  13. # (AcadΘmie de Grenoble - France 38).
  14. #
  15. # SLIS : Serveur de communications Linux pour l'Internet Scolaire.
  16. # Copyright (C) 1998-2000 Bruno Bzeznik
  17. #
  18. #    This program is free software; you can redistribute it and/or modify
  19. #    it under the terms of the GNU General Public License as published by
  20. #    the Free Software Foundation; either version 2 of the License, or
  21. #    (at your option) any later version.
  22. #
  23. #    This program is distributed in the hope that it will be useful,
  24. #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  26. #    GNU General Public License for more details.
  27. #    You should have received a copy of the GNU General Public License
  28. #    along with this program (For example ./COPYING);
  29. #    if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  30. #    Cambridge, MA 02139, USA.
  31. #
  32. # Please send all comments and bug reports by electronic mail to:
  33. #   Bruno Bzeznik <Bruno@ac-grenoble.fr>
  34. # or to <slis@ac-grenoble.fr>
  35. #
  36. # Envoyez vos suggestions et reports de bugs par e-mail α
  37. #   Bruno Bzeznik <Bruno@ac-grenoble.fr>
  38. # ou α <slis@ac-grenoble.fr>
  39. #
  40.  
  41. ### VARIABLES ###
  42. UPDDIR=/home/hadmin/updates # Rep pour les flags
  43. LOGTAG="slis_update[$$]" # Ce qui apparait en syslog
  44. PAS_UPD_KERNEL=0        # Si ce flag est a un, alors la mise a jour du noyau
  45.                 # (qui necessite reboot) ne sera pas faite cette fois.
  46. # Recuperation de la variable HOSTNAME :
  47. grep HOSTNAME /etc/sysconfig/network > /tmp/hostname
  48. . /tmp/hostname
  49. rm -rf /tmp/hostname
  50.  
  51. QUEUE=/home/hadmin/cgi-bin/queue     # File d'attente SLIS
  52. BASE=/home/hadmin/cgi-bin/base        # Base SLIS
  53. BINDIR=/usr/local/sbin            # Scripts et binaires SLIS
  54. ACAD_DOMAIN=ac-grenoble.fr        # Domaine
  55. MAILSERVER=pluton            # Serveur de messagerie du domaine (nom sans le domaine)
  56. IPMAILSERVER=193.54.149.10        # Adresse ip du serveur de messagerie
  57. TFTP=pluton.ac-grenoble.fr        # Serveur tftp des mises α jour (obsolete)
  58. RSYNC=pluton.ac-grenoble.fr        # Serveur rsync des mises α jour
  59. MODULE=slis-updates                     # Module rsync du serveur des mises α jour
  60. FTP=ftp.ac-grenoble.fr            # Serveur anonyme de mises α jour RedHat
  61. TIME=pluton.ac-grenoble.fr        # Serveur d'heure
  62. SLISMASTER=Bruno@ac-grenoble.fr        # Administrateur acadΘmique SLIS
  63. WEBMASTER=`ls -ld /home/httpd/html |awk '{print $3}'` # Webmaster designΘ par l'admin local
  64.  
  65. . /home/hadmin/slis.conf
  66.  
  67. ##################
  68.  
  69. # Gestion d'un lock
  70. if [ -e /var/lock/slis_upd ]
  71. then 
  72.   logger -t "$LOGTAG" "Deja en cours. Abandon."
  73.   exit
  74. fi
  75. touch /var/lock/slis_upd
  76. sleep 1
  77.  
  78. logger -t "$LOGTAG" "Script Version 1.3 Debut."
  79.  
  80. ############################################################################
  81. ### Mise a jour 137 - 04/07/2000
  82. # Update securite wu_ftpd
  83. # Rend obsolete :
  84. ############################################################################
  85.  
  86. if [ ! \( -e $UPDDIR/137 \) ]
  87. then
  88.  
  89.   cd /tmp
  90.   rsync rsync://$RSYNC/$MODULE/wu-ftpd-2.6.0-2.5.x.i386.rpm .
  91.   rpm -U ./wu-ftpd-2.6.0-2.5.x.i386.rpm
  92.  
  93.   touch $UPDDIR/137
  94.   logger -t "$LOGTAG" "Update 137 effectuee."
  95. fi
  96. ###
  97.  
  98. ############################################################################
  99. ### Mise a jour 1.3-6 - 31/08/2000
  100. # Update securite makewhatis
  101. # Rend obsolete :
  102. ############################################################################
  103.  
  104. if [ ! \( -e $UPDDIR/1.3-6 \) ]
  105. then
  106.  
  107.   cd /tmp
  108.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/man-1.5h1-2.5.x.i386.rpm .
  109.   rpm -U ./man-1.5h1-2.5.x.i386.rpm
  110.  
  111.   touch $UPDDIR/1.3-6
  112.   logger -t "$LOGTAG" "Update 1.3-6 effectuee."
  113. fi
  114. ###
  115.  
  116. ############################################################################
  117. ### Mise a jour 1.3-7 - 18/09/2000 
  118. # Update securite portmap (sunrpc udp/tcp 111)
  119. # Arret et suppression de portmap
  120. # Rend obsolete :
  121. ############################################################################
  122.  
  123. if [ ! \( -e $UPDDIR/1.3-7 \) ]
  124. then
  125.   
  126.   /etc/rc.d/init.d/portmap stop
  127.   rpm -e yp-tools
  128.   rpm -e ypbind
  129.   rpm -e portmap               
  130.  
  131.   touch $UPDDIR/1.3-7
  132.   logger -t "$LOGTAG" "Update 1.3-7 effectuee."
  133. fi 
  134. ### 
  135.  
  136. ############################################################################
  137. ### Mise a jour 1.3-8b - 27/09/2000
  138. # Nouvelle fonction: aspiration de sites
  139. # Rend obsolete :
  140. ############################################################################
  141.  
  142. if [ ! \( -e $UPDDIR/1.3-8b \) ]
  143. then
  144.  
  145.   cd /tmp
  146.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/wget-1.5.3-2.i386.rpm .
  147.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/upd-web-get.tgz .
  148.   rpm -U ./wget-1.5.3-2.i386.rpm
  149.   cd /
  150.   tar zxf /tmp/upd-web-get.tgz
  151.   $SLIS_BINDIR/mkwgetlauncher
  152.  
  153.   touch $UPDDIR/1.3-8b
  154.   logger -t "$LOGTAG" "Update 1.3-8b effectuee."
  155. fi
  156. ###
  157.  
  158. ############################################################################
  159. ### Mise a jour CS-1b - 28/09/2000
  160. # Ameliorations fonction aspiration de sites
  161. # Rend obsolete : 2.0-9,2.0-9b,2.0-9c
  162. ############################################################################
  163.  
  164. if [ ! \( -e $UPDDIR/CS-1b \) ]
  165. then
  166.  
  167.   cd /tmp
  168.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/upd-web-get-1.tgz .
  169.   cd /
  170.   tar zxf /tmp/upd-web-get-1.tgz
  171.   # Generation d'une heure de mirroring aleatoire
  172.   r=`/usr/local/sbin/rand60`
  173.   if [ $r -ge 0 -a $r -lt 10 ]; then h="21"; fi
  174.   if [ $r -ge 10 -a $r -lt 20 ]; then h="22"; fi
  175.   if [ $r -ge 20 -a $r -lt 30 ]; then h="23"; fi
  176.   if [ $r -ge 30 -a $r -lt 40 ]; then h="00"; fi
  177.   if [ $r -ge 40 -a $r -lt 50 ]; then h="01"; fi
  178.   if [ $r -ge 50 ]; then h="02"; fi
  179.   $SLIS_BINDIR/remplace 23 $h $SLIS_BINDIR/mkwgetlauncher
  180.   mkdir /home/httpd/html/miroirs
  181.   touch /home/httpd/html/miroirs/.miroirs
  182.   chmod 755 $SLIS_BINDIR/mkwgetlauncher
  183.   $SLIS_BINDIR/mkwgetlauncher
  184.  
  185.   touch $UPDDIR/CS-1b
  186.   logger -t "$LOGTAG" "Update CS-1b effectuee."
  187. fi
  188. ###
  189.  
  190. ############################################################################
  191. ### Mise a jour CS-2 - 02/10/2000
  192. # Correction de quelques petits bugs:
  193. # - web_get*: simplification et modif de la fonction d'aspiration et ajout
  194. # d'explications sur la recursivite. Correc faute d'orthographe.
  195. # - users_listdel.html: message "obsolete"
  196. # - squid_purge: ajout d'un GMT-2 pour workaround heures affichees par prostat
  197. # Rend obsolete : CS-2
  198. ############################################################################
  199.  
  200. if [ ! \( -e $UPDDIR/CS-2 \) ]
  201. then
  202.   cd /tmp
  203.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/upd-CS-2.tgz .
  204.   cd /
  205.   tar zxf /tmp/upd-CS-2.tgz
  206.  
  207.   touch $UPDDIR/CS-2
  208.   logger -t "$LOGTAG" "Update CS-2 effectuee."
  209. fi
  210. ###
  211.  
  212. ############################################################################
  213. ### Mise a jour 1.3-10 - 02/10/2000
  214. # Update securite syslog
  215. # Rend obsolete :
  216. ############################################################################
  217.  
  218. if [ ! \( -e $UPDDIR/1.3-10 \) ]
  219. then
  220.  
  221.   cd /tmp
  222.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/sysklogd-1.3.31-1.6.i386.rpm .
  223.   rpm -U ./sysklogd-1.3.31-1.6.i386.rpm
  224.   /etc/rc.d/init.d/syslog restart
  225.  
  226.   touch $UPDDIR/1.3-10
  227.   logger -t "$LOGTAG" "Update 1.3-10 effectuee."
  228. fi
  229. ###
  230.  
  231. ############################################################################
  232. ### Mise a jour 1.3-11 - 09/10/2000
  233. # Ajout du code mime de shockwave
  234. # Rend obsolete :
  235. ############################################################################
  236.  
  237. if [ ! \( -e $UPDDIR/1.3-11 \) ]
  238. then
  239.   echo "application/x-shockwave-flash   swf" >> /etc/mime.types
  240.   echo "application/x-shockwave-flash   swf" >> /usr/local/etc/mime.types
  241.  
  242.   touch $UPDDIR/1.3-11
  243.   logger -t "$LOGTAG" "Update 1.3-11 effectuee."
  244. fi
  245. ###
  246.  
  247. ############################################################################
  248. ### Mise a jour 1.3-13 - 22/10/2000
  249. # Nouveau binaire sendmail et nouvelle conf avec anti-spam
  250. # Rend obsolete :
  251. ############################################################################
  252.  
  253. if [ ! \( -e $UPDDIR/1.3-13 \) ]
  254. then
  255.  
  256.   # Telechargement de l'update
  257.   cd /tmp
  258.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/upd-1.x-13.tgz .
  259.  
  260.   # Arret de sendmail
  261.   /etc/rc.d/init.d/sendmail stop >/dev/null 2>/dev/null
  262.   sleep 3
  263.   /etc/rc.d/init.d/sendmail stop >/dev/null 2>/dev/null
  264.   sleep 1
  265.   killall -9 sendmail >/dev/null 2>/dev/null
  266.   # Si apres ca, il n'est pas mort..!
  267.  
  268.   # Decompactage
  269.   cd /
  270.   tar zxf /tmp/upd-1.x-13.tgz
  271.   touch /etc/mail/statistics
  272.   ln -s /etc/sendmail.cf /etc/mail/sendmail.cf
  273.  
  274.   # Lancement du configurateur
  275.   $SLIS_BINDIR/mksendmailcf
  276.  
  277.   # Demarrage de sendmail
  278.   /etc/rc.d/init.d/sendmail start >/dev/null 2>/dev/null
  279.  
  280.   touch $UPDDIR/1.3-13
  281.   logger -t "$LOGTAG" "Update 1.3-13 effectuee."
  282. fi
  283. ###
  284.  
  285. ############################################################################
  286. ### Mise a jour CS-3 - 26/10/2000
  287. # Nouveau sendmail.cf
  288. # Rend obsolete :
  289. ############################################################################
  290.  
  291. if [ ! \( -e $UPDDIR/CS-3 \) ]
  292. then
  293.  
  294.   # Telechargement de l'update
  295.   cd /etc
  296.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/sendmail.cf.slis.gz .
  297.   rm -rf sendmail.cf.slis
  298.   gzip -d sendmail.cf.slis.gz
  299.  
  300.   # Arret de sendmail
  301.   /etc/rc.d/init.d/sendmail stop >/dev/null 2>/dev/null
  302.   sleep 3
  303.   /etc/rc.d/init.d/sendmail stop >/dev/null 2>/dev/null
  304.   sleep 1
  305.   killall -9 sendmail >/dev/null 2>/dev/null
  306.   # Si apres ca, il n'est pas mort..!
  307.  
  308.   # Lancement du configurateur
  309.   $SLIS_BINDIR/mksendmailcf
  310.  
  311.   # Demarrage de sendmail
  312.   /etc/rc.d/init.d/sendmail start >/dev/null 2>/dev/null
  313.  
  314.   touch $UPDDIR/CS-3
  315.   logger -t "$LOGTAG" "Update CS-3 effectuee."
  316. fi
  317. ###
  318.  
  319. ############################################################################
  320. ### Mise a jour CS-5 - 04/12/2000
  321. # Bug de mkwgetlaucher et mkpushsiteconf (crontab mal programmee)
  322. # Rend obsolete : C-5
  323. ############################################################################
  324.   
  325. if [ ! \( -e $UPDDIR/CS-5 \) ]
  326. then
  327.   # Aspiration
  328.   cd /usr/local/sbin
  329.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/mkwgetlauncher .
  330.   chmod 755 /usr/local/sbin/mkwgetlauncher
  331.   /usr/local/sbin/mkwgetlauncher
  332.  
  333.   # Replication
  334.   cd /usr/local/sbin
  335.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/mkpushsiteconf .
  336.   chmod 755 /usr/local/sbin/mkpushsiteconf
  337.   /usr/local/sbin/mkpushsiteconf
  338.  
  339.   touch $UPDDIR/CS-5
  340.   logger -t "$LOGTAG" "UPDATE CS-5 effectuee"
  341. fi
  342. ###
  343.  
  344. ############################################################################
  345. ### Mise a jour 1.3-15 - 09/12/2000
  346. # Mise a jour du systeme rpm
  347. # Rend obsolete :
  348. ############################################################################
  349.  
  350. if [ ! \( -e $UPDDIR/1.3-15 \) ]
  351. then
  352.  
  353.   # Telechargement du RPM
  354.   cd /tmp
  355.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/rpm-3.0.5-9.5x.i386.rpm .
  356.  
  357.   # Installation du RPM
  358.   rpm -U rpm-3.0.5-9.5x.i386.rpm
  359.   rpm --rebuilddb
  360.  
  361.   # Verification et fin de la MAJ
  362.   rpm -q rpm-3.0.5-9.5x > /dev/null 2> /dev/null
  363.   if [ $? = 0 ]
  364.   then
  365.     touch $UPDDIR/1.3-15
  366.     logger -t "$LOGTAG" "Update 1.3-15 effectuee."
  367.   else
  368.     logger -t "$LOGTAG" "Update 1.3-15 ECHEC."
  369.   fi
  370. fi
  371. ###
  372.  
  373. ############################################################################
  374. ### Mise a jour 1.3-16 - 09/12/2000
  375. # Install de postgres
  376. # Rend obsolete :
  377. ############################################################################
  378.  
  379. if [ ! \( -e $UPDDIR/1.3-16 \) ]
  380. then
  381.  
  382.   # Telechargement des RPMS
  383.   cd /tmp
  384.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/postgresql-7.0.3-2rh5x.i386.rpm .
  385.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/postgresql-server-7.0.3-2rh5x.i386.rpm .  
  386.  
  387.   # Installation des RPMS
  388.   rpm -U postgresql-7.0.3-2rh5x.i386.rpm
  389.   rpm -U postgresql-server-7.0.3-2rh5x.i386.rpm 2> /dev/null
  390.   /sbin/ldconfig
  391.  
  392.   # Verification et fin de la MAJ
  393.   rpm -q postgresql-server-7.0.3-2 > /dev/null 2> /dev/null
  394.   if [ $? = 0 ]
  395.   then
  396.     touch $UPDDIR/1.3-16
  397.     logger -t "$LOGTAG" "Update 1.3-16 effectuee."
  398.   else
  399.     logger -t "$LOGTAG" "Update 1.3-16 ECHEC."
  400.   fi
  401. fi
  402. ###
  403.  
  404. ############################################################################
  405. ### Mise a jour 1.3-17 - 10/12/2000
  406. # Install de php4+mod_php4+php-pgsql
  407. # Rend obsolete :
  408. ############################################################################
  409.  
  410. if [ ! \( -e $UPDDIR/1.3-17 \) ]
  411. then
  412.  
  413.   # Telechargement des RPMS
  414.   cd /tmp
  415.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/php-4.0.3pl1-1slis1x.i386.rpm .
  416.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/php-pgsql-4.0.3pl1-1slis1x.i386.rpm .
  417.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/mod_php-4.0.3pl1-1slis1x.i386.rpm .
  418.  
  419.   # Installation des RPMS
  420.   rpm -U php-4.0.3pl1-1slis1x.i386.rpm
  421.   rpm -U php-pgsql-4.0.3pl1-1slis1x.i386.rpm
  422.   rpm -U mod_php-4.0.3pl1-1slis1x.i386.rpm
  423.  
  424.   # Verification et fin de la MAJ
  425.   rpm -q php-pgsql-4.0.3pl1-1slis1x > /dev/null 2> /dev/null
  426.   RC1=$?
  427.   rpm -q mod_php-4.0.3pl1-1slis1x > /dev/null 2> /dev/null
  428.   if [ $? = 0 -a $RC1 = 0 ]
  429.   then
  430.     # Un php.ini specifique pour hadmin
  431.     sed "s/max_execution_time = 30/max_execution_time = 120/" /etc/php.ini > /etc/hadmin/php.ini
  432.     sed "s,/etc/hadmin/httpd -d /etc/hadmin 2> /tmp/herr,export PHPRC=\"/etc/hadmin\";/usr/sbin/httpd -f /etc/hadmin/conf/httpd.conf;export -n PHPRC," /etc/rc.d/rc.local > /tmp/rc.local
  433.     cp -f /etc/rc.d/rc.local /etc/rc.d/rc.local.upd-1.4-17
  434.     mv -f /tmp/rc.local /etc/rc.d/rc.local
  435.     chmod 755 /etc/rc.d/rc.local
  436.     
  437.     # Activation du safe mode php dans le php.ini du httpd standard
  438.     sed "s/^safe_mode.*=.*Off/safe_mode = On/" /etc/php.ini > /tmp/php.ini
  439.     mv -f /tmp/php.ini /etc/php.ini
  440.     sed "s,safe_mode_exec_dir.*=.*,safe_mode_exec_dir = /usr/local/phpexec," /etc/php.ini > /tmp/php.ini
  441.     mv -f /tmp/php.ini /etc/php.ini
  442.     mkdir /usr/local/phpexec
  443.  
  444.     # Flag de la MAJ
  445.     touch $UPDDIR/1.3-17
  446.     logger -t "$LOGTAG" "Update 1.3-17 effectuee."
  447.   else
  448.     logger -t "$LOGTAG" "Update 1.3-17 ECHEC."
  449.   fi
  450. fi
  451. ###
  452.  
  453. ############################################################################
  454. ### Mise a jour 1.3-18 - 10/12/2000
  455. # MAJ d'apache
  456. # Rend obsolete :
  457. ############################################################################
  458.  
  459. if [ ! \( -e $UPDDIR/1.3-18 \) ]
  460. then
  461.  
  462.   # Telechargement des paquetages
  463.   cd /tmp
  464.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/apache-1.3.14-2.5.x.i386.rpm .
  465.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/upd-1.x-18.tgz .
  466.  
  467.   # Installation du RPM apache et de l'archive contenant la conf
  468.   /etc/rc.d/init.d/httpd stop
  469.   killall httpd
  470.   rpm -U apache-1.3.14-2.5.x.i386.rpm
  471.   cd /
  472.   tar zxf /tmp/upd-1.x-18.tgz
  473.   RC1=$?
  474.  
  475.   # Remise en etat des droits au cas ou l'archive ne soit pas correcte
  476.   chown -R hadmin.hadmin /etc/hadmin
  477.   chmod -R 750 /etc/hadmin
  478.   chown -R nobody.nobody /etc/httpd
  479.   chmod -R 750 /etc/httpd
  480.  
  481.   # Lien pour les modules (version slis < 2.0)
  482.   ln -fs /etc/httpd/modules/ /etc/hadmin/modules
  483.  
  484.   # Redemarrage
  485.   /etc/rc.d/init.d/httpd start
  486.   export PHPRC="/etc/hadmin"
  487.   /usr/sbin/httpd -f /etc/hadmin/conf/httpd.conf
  488.   export -n PHPRC
  489.  
  490.   # Verifications et fin de la MAJ  
  491.   rpm -q apache-1.3.14-2.5.x > /dev/null 2> /dev/null
  492.   if [ $? = 0 -a $RC1 = 0 ]
  493.   then
  494.     touch $UPDDIR/1.3-18
  495.     logger -t "$LOGTAG" "Update 1.3-18 effectuee."
  496.   else
  497.     logger -t "$LOGTAG" "Update 1.3-18 ECHEC."
  498.   fi
  499. fi
  500. ###
  501.  
  502. ############################################################################
  503. ### Mise a jour CS-6 - 05/12/2000
  504. # Initialisation de postgres
  505. # Rend obsolete :
  506. ############################################################################
  507.  
  508. if [ ! \( -e $UPDDIR/CS-6 \) ]
  509. then
  510.   # Telechargement du tar
  511.   cd /tmp
  512.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/upd-CS-6.tgz .
  513.   cd /
  514.   tar zxf /tmp/upd-CS-6.tgz
  515.   chmod 1777 /tmp
  516.  
  517.   # mot de passe postgres
  518.   POSTGRESPASS=`$SLIS_BINDIR/pspg`
  519.  
  520.   # mot de passe hadmin
  521.   ADMINPASS=`$SLIS_BINDIR/pspg`
  522.  
  523.   # mot de passe slis
  524.   SLISPASS=`$SLIS_BINDIR/pspg`
  525.  
  526.   #  Stockage des mots de passe dans des fichiers de conf
  527.   # Fichier de conf pour le php de l'interface SLIS
  528.   echo "<?php" > /home/hadmin/html/config_pgsql.inc.php
  529.   echo "\$POSTGRESPASS=\"$POSTGRESPASS\";" >> /home/hadmin/html/config_pgsql.inc.php
  530.   echo "\$POSTGRESUSER=\"postgres\";" >> /home/hadmin/html/config_pgsql.inc.php
  531.   echo "\$ADMINPASS=\"$ADMINPASS\";" >> /home/hadmin/html/config_pgsql.inc.php
  532.   echo "\$ADMINUSER=\"hadmin\";" >> /home/hadmin/html/config_pgsql.inc.php
  533.   echo "\$SLISPASS=\"$SLISPASS\";" >> /home/hadmin/html/config_pgsql.inc.php
  534.   echo "\$SLISUSER=\"slis\";" >> /home/hadmin/html/config_pgsql.inc.php
  535.   echo "\$PGSQL_SERVER=\"127.0.0.1\";" >> /home/hadmin/html/config_pgsql.inc.php
  536.   echo "\$BASE_HADMIN=\"hadmin\";" >> /home/hadmin/html/config_pgsql.inc.php
  537.   echo "\$BASE_DHCP=\"dhcp\";" >> /home/hadmin/html/config_pgsql.inc.php
  538.   echo "\$BASE_SLIS=\"slis\";" >> /home/hadmin/html/config_pgsql.inc.php
  539.   echo "?>" >> /home/hadmin/html/config_pgsql.inc.php  
  540.  
  541.   # Fichier de conf pour perl
  542.   echo "\$POSTGRESPASS=\"$POSTGRESPASS\";" > /home/hadmin/cgi-bin/base/config_pgsql.inc.pl
  543.   echo "\$POSTGRESUSER=\"postgres\";" >> /home/hadmin/cgi-bin/base/config_pgsql.inc.pl
  544.   echo "\$ADMINPASS=\"$ADMINPASS\";" >> /home/hadmin/cgi-bin/base/config_pgsql.inc.pl
  545.   echo "\$ADMINUSER=\"hadmin\";" >> /home/hadmin/cgi-bin/base/config_pgsql.inc.pl
  546.   echo "\$SLISPASS=\"$SLISPASS\";" >> /home/hadmin/cgi-bin/base/config_pgsql.inc.pl
  547.   echo "\$SLISUSER=\"slis\";" >> /home/hadmin/cgi-bin/base/config_pgsql.inc.pl
  548.   echo "\$PGSQL_SERVER=\"127.0.0.1\";" >> /home/hadmin/cgi-bin/base/config_pgsql.inc.pl
  549.   echo "\$BASE_HADMIN=\"hadmin\";" >> /home/hadmin/cgi-bin/base/config_pgsql.inc.pl
  550.   echo "\$BASE_DHCP=\"dhcp\";" >> /home/hadmin/cgi-bin/base/config_pgsql.inc.pl
  551.   echo "\$BASE_SLIS=\"slis\";" >> /home/hadmin/cgi-bin/base/config_pgsql.inc.pl
  552.  
  553.   # Fichier de conf pour le php des utilisateurs
  554.   echo "<?php" > /home/httpd/html/config_pgsql.inc.php
  555.   echo "\$PGSQL_PASS=\"$SLISPASS\";" >> /home/httpd/html/config_pgsql.inc.php
  556.   echo "\$PGSQL_USER=\"slis\";" >> /home/httpd/html/config_pgsql.inc.php
  557.   echo "\$PGSQL_SERVER=\"127.0.0.1\";" >> /home/httpd/html/config_pgsql.inc.php
  558.   echo "\$PGSQL_BASE=\"slis\";" >> /home/httpd/html/config_pgsql.inc.php
  559.   echo "?>" >> /home/httpd/html/config_pgsql.inc.php  
  560.  
  561.   # Securite sur ces fichiers de config
  562.   chmod 750 /home/hadmin/html/config_pgsql.inc.php
  563.   chown hadmin.hadmin /home/hadmin/html/config_pgsql.inc.php
  564.   chmod 750 /home/hadmin/cgi-bin/base/config_pgsql.inc.pl
  565.   chown hadmin.hadmin /home/hadmin/cgi-bin/base/config_pgsql.inc.pl
  566.   chmod 750 /home/httpd/html/config_pgsql.inc.php
  567.   chown nobody.nobody /home/httpd/html/config_pgsql.inc.php
  568.  
  569.   # Premier demarrage de postgres
  570.   /etc/rc.d/init.d/postgresql start
  571.  
  572.   # Config du boot
  573.   /sbin/chkconfig --add postgresql
  574.  
  575.   # Appel du script d'init qui tourne sous postgres
  576.   su - postgres -c "$SLIS_BINDIR/init_pgsql.sh $POSTGRESPASS $ADMINPASS $SLISPASS> /dev/null"
  577.   rm -rf /tmp/dhcp.dump
  578.  
  579.   touch $UPDDIR/CS-6
  580.   logger -t "$LOGTAG" "UPDATE CS-6 effectuee"   
  581. fi
  582. ###
  583.  
  584. ############################################################################
  585. ### Mise a jour CS-7 - 05/12/2000
  586. # Installation de l'interface d'administration dhcp
  587. # Rend obsolete :
  588. ############################################################################
  589.  
  590. if [ ! \( -e $UPDDIR/CS-7 \) ]
  591. then
  592.   # Telechargement du tar
  593.   cd /tmp
  594.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/upd-CS-7.tgz .
  595.   cd /
  596.   tar zxf /tmp/upd-CS-7.tgz
  597.   RC=$?
  598.  
  599.   # Verification et fin de la MAJ
  600.   if [ $RC = 0 ]
  601.   then
  602.     touch $UPDDIR/CS-7
  603.     logger -t "$LOGTAG" "Update CS-7 effectuee."
  604.   else
  605.     logger -t "$LOGTAG" "Update CS-7 ECHEC."
  606.   fi
  607. fi
  608. ###
  609.  
  610. ############################################################################
  611. ### Mise a jour CS-8 - 07/12/2000
  612. # Installation de phppgadmin
  613. # Rend obsolete :
  614. ############################################################################
  615.  
  616. if [ ! \( -e $UPDDIR/CS-8 \) ]
  617. then
  618.   # Telechargement du tar
  619.   cd /tmp
  620.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/upd-CS-8.tgz .
  621.   cd /
  622.   tar zxf /tmp/upd-CS-8.tgz
  623.   RC=$?
  624.  
  625.   # Verification et fin de la MAJ
  626.   if [ $RC = 0 ]
  627.   then
  628.     touch $UPDDIR/CS-8
  629.     logger -t "$LOGTAG" "Update CS-8 effectuee."
  630.   else
  631.     logger -t "$LOGTAG" "Update CS-8 ECHEC."
  632.   fi
  633. fi
  634. ###
  635.  
  636. ############################################################################
  637. ### Mise a jour CS-9 - 07/12/2000
  638. # Patch pour supprimmer postgres des users affich<E9>s
  639. # Rend obsolete :
  640. ############################################################################
  641.  
  642. if [ ! \( -e $UPDDIR/CS-9 \) ]
  643. then
  644.   # Telechargement du tar
  645.   cd /tmp
  646.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/upd-CS-9.tgz .
  647.   cd /
  648.   tar zxf /tmp/upd-CS-9.tgz
  649.   RC=$?
  650.  
  651.   # Verification et fin de la MAJ
  652.   if [ $RC = 0 ]
  653.   then
  654.     touch $UPDDIR/CS-9
  655.     logger -t "$LOGTAG" "Update CS-9 effectuee."
  656.   else
  657.     logger -t "$LOGTAG" "Update CS-9 ECHEC."
  658.   fi
  659. fi
  660. ###
  661.  
  662. ############################################################################
  663. ### Mise a jour CS-10 - 12/12/2000
  664. # MAJ de l'interface dhcp
  665. # Rend obsolete :
  666. ############################################################################
  667.  
  668. if [ ! \( -e $UPDDIR/CS-10 \) ]
  669. then
  670.   # Telechargement du tar
  671.   cd /tmp
  672.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/upd-CS-10.tgz .
  673.   cd /
  674.   tar zxf /tmp/upd-CS-10.tgz
  675.   RC=$?
  676.  
  677.   # Verification et fin de la MAJ
  678.   if [ $RC = 0 ]
  679.   then
  680.     touch $UPDDIR/CS-10
  681.     logger -t "$LOGTAG" "Update CS-10 effectuee."
  682.   else
  683.     logger -t "$LOGTAG" "Update CS-10 ECHEC."
  684.   fi
  685. fi
  686. ###
  687.  
  688. ############################################################################
  689. ### Mise a jour 1.3-20 - 10/12/2000
  690. # Conf de logrotate pour syslog
  691. # Rend obsolete :
  692. ############################################################################
  693.  
  694. if [ ! \( -e $UPDDIR/1.3-20 \) ]
  695. then
  696.   echo "
  697. /var/log/arpwatch {
  698.   postrotate
  699.         /usr/bin/killall -HUP syslogd
  700.   endscript
  701. }
  702.  
  703. /var/log/slis {
  704.   postrotate
  705.         /usr/bin/killall -HUP syslogd
  706.   endscript
  707. }
  708.  
  709. " >> /etc/logrotate.d/syslog
  710.     touch $UPDDIR/1.3-20
  711.     logger -t "$LOGTAG" "Update 1.3-20 effectuee."
  712. fi
  713. ###
  714.  
  715. ############################################################################
  716. ### Mise a jour 1.3-21 - 10/12/2000
  717. # Nouveaux menus "fonction avancees"
  718. # Rend obsolete : Les fichiers correspondant dans upd-CS-8.tgz
  719. ############################################################################
  720.  
  721. if [ ! \( -e $UPDDIR/1.3-21 \) ]
  722. then
  723.  
  724.   # Telechargement du tar
  725.   cd /tmp
  726.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/upd-1.x-21.tgz .
  727.   cd /
  728.   tar zxf /tmp/upd-1.x-21.tgz
  729.   RC=$?
  730.  
  731.   # Verification et fin de la MAJ
  732.   if [ $RC = 0 ]
  733.   then
  734.     touch $UPDDIR/1.3-21
  735.     logger -t "$LOGTAG" "Update 1.3-21 effectuee."
  736.   else   
  737.     logger -t "$LOGTAG" "Update 1.3-21 ECHEC."
  738.   fi
  739. fi
  740. ###
  741.  
  742. ############################################################################
  743. ### Mise a jour CS-11 - 15/12/2000
  744. # Patch de l'interface dhcp
  745. # Rend obsolete :
  746. ############################################################################
  747.  
  748. if [ ! \( -e $UPDDIR/CS-11 \) ]
  749. then
  750.   # Telechargement du tar
  751.   cd /tmp
  752.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/upd-CS-11.tgz .
  753.   cd /
  754.   tar zxf /tmp/upd-CS-11.tgz
  755.   RC=$?
  756.  
  757.   # Verification et fin de la MAJ
  758.   if [ $RC = 0 ]
  759.   then
  760.     touch $UPDDIR/CS-11
  761.     logger -t "$LOGTAG" "Update CS-11 effectuee."
  762.   else
  763.     logger -t "$LOGTAG" "Update CS-11 ECHEC."
  764.   fi
  765. fi
  766. ###
  767.  
  768. ############################################################################
  769. ### Mise a jour 1.3-17b - 18/12/2000
  770. # Bug de 1.3-17
  771. # Rend obsolete : 1.3-17a
  772. ############################################################################
  773.  
  774. if [ ! \( -e $UPDDIR/1.3-17b \) ]
  775. then
  776.     
  777.   sed "s,/etc/hadmin/httpd -d /etc/hadmin 2> /tmp/herr,export PHPRC=\"/etc/hadmin\";/usr/sbin/httpd -f /etc/hadmin/conf/httpd.conf;export -n PHPRC," /etc/rc.d/rc.local > /tmp/rc.local
  778.   /etc/rc.d/init.d/httpd stop
  779.   killall httpd
  780.   rm -rf /var/lock/subsys/httpd
  781.   rm -rf /var/run/httpd.pid
  782.   rm -rf /var/run/httpd*lock*
  783.   sleep 6
  784.   /etc/rc.d/init.d/httpd start
  785.   export PHPRC="/etc/hadmin"
  786.   /usr/sbin/httpd -f /etc/hadmin/conf/httpd.conf
  787.   export -n PHPRC  
  788.  
  789.   touch $UPDDIR/1.3-17b
  790.   logger -t "$LOGTAG" "Update 1.3-17b effectuee."
  791. fi
  792. ###
  793.  
  794. ############################################################################
  795. ### Mise a jour 1.3-24b - 02/02/2001
  796. # SECURITE BIND
  797. # Rend obsolete : 1.3-24
  798. ############################################################################
  799.  
  800. if [ ! \( -e $UPDDIR/1.3-24b \) ]
  801. then
  802.  
  803.   cd /tmp
  804.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/bind-8.2.3-0.5.x.i386.rpm .
  805.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/bind-utils-8.2.3-0.5.x.i386.rpm .
  806.   rpm -U bind-8.2.3-0.5.x.i386.rpm
  807.   rpm -U bind-utils-8.2.3-0.5.x.i386.rpm
  808.  
  809.   # Verifications
  810.   rpm -q bind-utils-8.2.3 2>/dev/null >/dev/null
  811.   RC=$?
  812.   rpm -q bind-8.2.3 2>/dev/null >/dev/null
  813.   if [ $? = 0 -a $RC = 0 ]
  814.   then
  815.     /etc/rc.d/init.d/named restart
  816.     sleep 2
  817.     touch $UPDDIR/1.3-24b
  818.     logger -t "$LOGTAG" "UPDATE 1.3-24b effectuee"
  819.   else
  820.     logger -t "$LOGTAG" "UPDATE 1.3-24b ECHEC."
  821.   fi
  822. fi
  823. ###
  824.  
  825.  
  826. ############################################################################
  827. ### Mise a jour 1.3-26 - 29/01/2001
  828. # Installation de xntpd
  829. # Rend obsolete :
  830. ############################################################################
  831.  
  832. if [ ! \( -e $UPDDIR/1.3-26 \) ]
  833. then
  834.  
  835.   cd /tmp
  836.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/xntp3-5.93-4.i386.rpm .
  837.   rpm -U xntp3-5.93-4.i386.rpm
  838.  
  839.   # Verifications et fin de l'install
  840.   rpm -q xntp3-5.93-4 2>/dev/null >/dev/null
  841.   RC=$?
  842.   if [ $RC = 0 ]
  843.   then
  844.     chkconfig --add xntpd
  845.     /etc/rc.d/init.d/xntpd start
  846.     touch $UPDDIR/1.3-26
  847.     logger -t "$LOGTAG" "UPDATE 1.3-26 effectuee"
  848.   else
  849.     logger -t "$LOGTAG" "UPDATE 1.3-26 ECHEC."
  850.   fi
  851. fi
  852. ###
  853.  
  854. ############################################################################
  855. ### Mise a jour 1.x-27 - 30/01/2001
  856. # Interface de configuration de l'onduleur
  857. # Rend obsolete :
  858. ############################################################################
  859.  
  860. if [ ! \( -e $UPDDIR/1.x-27 \) ]
  861. then
  862.  
  863.   # Si on ne tue pas mgeupsd, alors le tar va echouer
  864.   killall mgeupsd
  865.  
  866.   # Telechargement du tar
  867.   cd /tmp
  868.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/upd-1.x-27.tgz .
  869.   cd /
  870.   tar zxf /tmp/upd-1.x-27.tgz
  871.   RC=$?
  872.  
  873.   # Verification et fin de la MAJ
  874.   if [ $RC = 0 ]
  875.   then
  876.     touch $UPDDIR/1.x-27
  877.     logger -t "$LOGTAG" "Update 1.x-27 effectuee."
  878.   else
  879.     logger -t "$LOGTAG" "Update 1.x-27 ECHEC."
  880.   fi
  881. fi
  882. ###
  883.  
  884. ############################################################################
  885. ### Mise a jour CS-12 - 01/02/2001
  886. # Amelioration des fonctions de filtrage d'url
  887. # Rend obsolete :
  888. ############################################################################
  889.  
  890. if [ ! \( -e $UPDDIR/CS-12 \) ]
  891. then
  892.   # Telechargement du tar
  893.   cd /tmp
  894.   rsync rsync://$RSYNC_HOST/$RSYNC_MODULE/upd-CS-12.tgz .
  895.   cd /
  896.   tar zxf /tmp/upd-CS-12.tgz
  897.   RC=$?
  898.  
  899.   # Verification et fin de la MAJ
  900.   if [ $RC = 0 ]
  901.   then
  902.     touch $UPDDIR/CS-12
  903.     logger -t "$LOGTAG" "Update CS-12 effectuee."
  904.   else
  905.     logger -t "$LOGTAG" "Update CS-12 ECHEC."
  906.   fi
  907. fi
  908. ###
  909.  
  910.  
  911. ############################################################################
  912. ### Mise a jour PQ - 05/04/2000
  913. # Nouveau script /usr/local/sbin/process_queue
  914. # Rend obsolete : 004-0 a 004-7 et PQ-1 PQ-2 PQ-3 PQ-4 PQ-5
  915. # Si un nouveau process_queue est r<E9>alis<E9>, juste remplacer le numero de
  916. # version et le fichier.
  917. # ATTENTION: Laisser cette UPD en fin de fichier, avant les UPD KERNEL.
  918. ############################################################################
  919. VERSION=7
  920. DELAI=5 # Delai en minutes. C'est le temps estime que prendra l'execution de
  921.         # la fin de ce script plus une marge (install d'un nouveau slis)...
  922.  
  923. if [ ! \( -e $UPDDIR/PQ-$VERSION \) ]
  924. then
  925.   PAS_UPD_KERNEL=1 # Empeche de faire une update du noyau
  926.  
  927.   # Telechargement du nouveau fichier
  928.   cd /tmp
  929.   rsync rsync://$RSYNC/$MODULE/process_queue .
  930.   # slis_update est lance par process_queue, donc il faut faire attention
  931.   # a ne pas le remplacer tout de suite:
  932.   echo "mv -f /tmp/process_queue /usr/local/sbin/ ; chmod 700 /usr/local/sbin/process_queue" | at now + $DELAI minutes
  933.  
  934.   touch $UPDDIR/PQ-$VERSION
  935.   logger -t "$LOGTAG" "UPDATE PQ-$VERSION effectuee."
  936. fi
  937. ###
  938.  
  939. ############################################################################
  940. ### Mise a jour NOTIFY - 29/04/99
  941. # Notify
  942. # Rend obsolete : 
  943. ############################################################################
  944.  
  945. if [ ! \( -e $UPDDIR/NOTIFY \) ]
  946. then
  947.   echo "$HOSTNAME installe et MAJ" | mail -s "Nouveau SLIS 1.4" $SLISMASTER
  948.   sleep 2
  949.   /usr/lib/sendmail -q
  950.   killall crond
  951.   sleep 1
  952.   crond
  953.  
  954.   touch $UPDDIR/NOTIFY
  955.   logger -t "$LOGTAG" "NOTIFY envoye."
  956. fi
  957. ###
  958.  
  959.  
  960.  
  961. ##############################
  962. logger -t "$LOGTAG" "Script Version 1.3 Termine."
  963.  
  964. /bin/rm -rf /var/lock/slis_upd
  965.