[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-dhcp/sources/debian/ -> postrm (source)

   1  #! /bin/sh
   2  # postrm script for se3-dhcpd
   3  #
   4  # see: dh_installdeb(1)
   5  
   6  set -e
   7  
   8  # summary of how this script can be called:
   9  #        * <postrm> `remove'
  10  #        * <postrm> `purge'
  11  #        * <old-postrm> `upgrade' <new-version>
  12  #        * <new-postrm> `failed-upgrade' <old-version>
  13  #        * <new-postrm> `abort-install'
  14  #        * <new-postrm> `abort-install' <old-version>
  15  #        * <new-postrm> `abort-upgrade' <old-version>
  16  #        * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
  17  # for details, see http://www.debian.org/doc/debian-policy/ or
  18  # the debian-policy package
  19  
  20  
  21  case "$1" in
  22      purge)
  23  
  24  ### on suppose que l'on est sous debian  ####
  25  WWWPATH="/var/www"
  26  ## recuperation des variables necessaires pour interoger mysql ###
  27  if [ -e $WWWPATH/se3/includes/config.inc.php ]; then
  28      dbhost=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbhost=" | cut -d = -f2 | cut -d \" -f2`
  29      dbname=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbname=" | cut    -d = -f 2 |cut -d \" -f 2`
  30       dbuser=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbuser=" | cut -d = -f 2 | cut -d \" -f 2`
  31       dbpass=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbpass=" | cut -d = -f 2 | cut -d \" -f 2`
  32  else
  33      echo "Fichier de configuration inaccessible, le script ne peut se poursuivre."
  34      exit 1
  35  fi
  36  ##### Remove mysql entry in DHCP slis table
  37  echo "DROP TABLE  se3_dhcp" | mysql -h $dbhost $dbname -u $dbuser -p$dbpass -N
  38  echo "DELETE FROM  params WHERE name REGEXP '^dhcp*'" | mysql -h $dbhost $dbname -u $dbuser -p$dbpass -N
  39  echo "INSERT INTO params VALUES ('', 'dhcp', '0', 0, 'Activation du dhcp', 6)" | mysql -h $dbhost $dbname -u $dbuser -p$dbpass -N
  40  ##### REMOVE sudoers entry
  41  if [ "`cat /etc/sudoers | grep SE3DHCP`" ]; then
  42  sed -i 's/^\(www-se3.*\),NOPASSWD:SE3DHCP\(.*\)$/\1\2/'  /etc/sudoers
  43  sed -i '/^Cmnd_Alias SE3DHCP.*$/d' /etc/sudoers
  44  /etc/init.d/sudo restart
  45  fi
  46  #####
  47  
  48  
  49  exit 0
  50  
  51      ;;
  52      remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)    
  53      ;;
  54  
  55      *)
  56          echo "postrm called with unknown argument \`$1'" >&2 | grep -v NOTICE
  57          exit 1
  58  
  59  esac
  60  
  61  # dh_installdeb will replace this with shell code automatically
  62  # generated by other debhelper scripts.
  63  
  64  #DEBHELPER#
  65  
  66  exit 0


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