[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-wpkg/sources/debian/ -> postinst (source)

   1  #!/bin/sh
   2  #
   3  # see: dh_installdeb(1)
   4  
   5  set -e
   6  # postinst script for se3-wpkg
   7  #
   8  #  d'apres le script d'installation de Jean Le Bail
   9  #  juillet 2008
  10  #
  11  ## $Id$ ##
  12  
  13  
  14  # summary of how this script can be called:
  15  #        * <postinst> `configure' <most-recently-configured-version>
  16  #        * <old-postinst> `abort-upgrade' <new version>
  17  #        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
  18  #          <new-version>
  19  #        * <postinst> `abort-remove'
  20  #        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
  21  #          <failed-install-package> <version> `removing'
  22  #          <conflicting-package> <version>
  23  # for details, see http://www.debian.org/doc/debian-policy/ or
  24  # the debian-policy package
  25  
  26  case "$1" in
  27          install|configure)
  28      cd /var/cache/se3_install/
  29      chmod +x wpkg-install.sh
  30      if ( /bin/grep -q "3\.[01]" /etc/debian_version ) ; then
  31          ## charset ISO8859-15 pour woody et sarge ##
  32          /usr/bin/recode UTF8..ISO8859-15 wpkg-install.sh
  33          /usr/bin/recode UTF8..ISO8859-15 web-wpkg-install.sh
  34      fi
  35      ./wpkg-install.sh
  36  
  37      chown www-se3:root /usr/share/se3/scripts/wakeonlan
  38      chmod 750 /usr/share/se3/scripts/wakeonlan
  39  
  40      echo "retablissement des droits sur /var/www/se3/wpkg"
  41      chown -R www-se3:root /var/www/se3/wpkg
  42  
  43      echo "configuration de l'interface web de wpkg"
  44      chmod +x /var/cache/se3_install/web-wpkg-install.sh
  45      /var/cache/se3_install/web-wpkg-install.sh
  46  
  47      WWWPATH="/var/www"
  48      ## recuperation des variables necessaires pour interoger mysql ###
  49      if [ -e $WWWPATH/se3/includes/config.inc.php ]; then
  50          dbhost=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbhost=" | cut -d = -f2 | cut -d \" -f2`
  51          dbname=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbname=" | cut    -d = -f 2 |cut -d \" -f 2`
  52          dbuser=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbuser=" | cut -d = -f 2 | cut -d \" -f 2`
  53          dbpass=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbpass=" | cut -d = -f 2 | cut -d \" -f 2`
  54      else
  55          echo "Fichier de configuration inaccessible, le script ne peut se poursuivre."
  56          exit 1
  57      fi
  58      ##### Activation wpkg dans l'interface web 
  59      test_exist=`echo "SELECT id FROM params WHERE name='wpkg'" | mysql -h $dbhost $dbname -u $dbuser -p$dbpass -N`
  60      if [ "X$test_exist" = "X" ]; then # if empty
  61          echo "INSERT into params (name,value,srv_id,descr,cat) VALUES (\"wpkg\",\"1\",\"\",\"Activation ou désactivation de wpkg\",6) " | mysql -h $dbhost $dbname -u $dbuser -p$dbpass -N
  62      fi
  63      
  64      ###### Ajout des scripts wsusoffline ####
  65      if [ ! -e /var/se3/unattended/install/wsusoffline ] ; then
  66          echo "Telechargement des scripts wsusoffline"
  67          WSUSOFFLINEROOT=http://svn.tice.ac-caen.fr/svn/SambaEdu3/wpkg-packages/files/wsusoffline
  68          wget $WSUSOFFLINEROOT/wsusoffline.zip -O /var/se3/unattended/install/wsusoffline.zip > /dev/null
  69          # unzip est present car installe par se3-wpkg
  70          if [ -e /var/se3/unattended/install/wsusoffline.zip ]; then
  71              if ( ! unzip -o /var/se3/unattended/install/wsusoffline.zip -d /var/se3/unattended/install/ > /dev/null ) ; then
  72                  echo "Erreur unzip -o /var/se3/unattended/install/wsusoffline.zip"
  73              else
  74                  # mise en place initiale du fichier temoin
  75                  echo "Mise en place initiale du fichier temoin."
  76                  TEMOIN=/var/se3/unattended/install/wsusoffline/version.txt
  77                  wget -o $TEMOIN $WSUSOFFLINEROOT/version.txt > /dev/null
  78                  echo "Reglage des droits sur les fichiers wsusoffline."
  79                  chmod -R ug+rwx /var/se3/unattended/install/wsusoffline
  80                  chown -R admin:admins /var/se3/unattended/install/wsusoffline
  81              fi
  82              rm -f /var/se3/unattended/install/wsusoffline.zip
  83          else
  84              echo "Fichier wsusoffline.zip absent : le telechargement a echoue."
  85          fi
  86      fi
  87      
  88      RAPPORTDIR="/var/se3/unattended/install/wpkg/rapports"
  89      if [ -e "$RAPPORTDIR" ];then
  90        find $RAPPORTDIR/ -mtime +365 -delete 2> /dev/null
  91      fi
  92      ;;
  93  
  94      abort-upgrade|abort-remove|abort-deconfigure)
  95      ;;
  96  
  97      *)
  98          echo "postinst called with unknown argument \`$1'" >&2
  99          exit 1
 100      ;;
 101  esac
 102  


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