[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3master/usr/share/se3/scripts/ -> modifProxy.sh (source)

   1  #!/bin/bash
   2  
   3  #
   4  ## $Id: modifProxy.sh 7420 2012-09-24 22:12:04Z keyser $ ##
   5  #
   6  ##### script de modif de /etc/profile afin que la machine passe par un proxy #####
   7  ##### positionne egalement le proxy des clients FF 
   8  
   9  if [ "$1" = "--help" -o "$1" = "-h" ]
  10  then
  11      echo "Modifie /etc/profile pour ajouter la conf d'un proxy"
  12      echo "Relance la conf dhcp pour creation wpad et se3.pac si besoin"
  13      echo "Modifie les valeurs msql proxy_url et proxy_type"
  14      echo "Modifie les fichiers prefs.js Firefox"
  15      echo "Sans option le proxy est supprimé"
  16      echo "Usage : modifProxy.sh [adresse_ip:port]"
  17      exit
  18  fi    
  19  
  20  . /usr/share/se3/includes/config.inc.sh -cms
  21  . /usr/share/se3/includes/functions.inc.sh
  22  
  23  # Si on a deja un proxy
  24  proxy=`cat /etc/profile | grep http_proxy=` 
  25  if [ "$proxy" != "" ]
  26  then 
  27      perl -pi -e 's/http_proxy=.*\n//' /etc/profile
  28      perl -pi -e 's/https_proxy=.*\n//' /etc/profile
  29      perl -pi -e 's/ftp_proxy=.*\n//' /etc/profile
  30      perl -pi -e 's/.*http_proxy.*\n//' /etc/profile
  31      perl -pi -e 's/^http_proxy = .*\n//' /etc/wgetrc
  32      perl -pi -e 's/^https_proxy = .*\n//' /etc/wgetrc
  33      
  34      
  35  fi    
  36  if [ "$1" != "" ]
  37  then
  38      echo "http_proxy=\"http://$1\"" >> /etc/profile
  39      echo "https_proxy=\"http://$1\"" >> /etc/profile
  40      echo "ftp_proxy=\"http://$1\"" >> /etc/profile
  41      echo "export http_proxy https_proxy ftp_proxy" >> /etc/profile
  42      echo "http_proxy = http://$1" >> /etc/wgetrc
  43      echo "https_proxy = http://$1" >> /etc/wgetrc
  44      
  45  fi
  46  PROXY=$(echo $1 | cut -d: -f1)
  47  PORT=$(echo $1 | cut -d: -f2)
  48  
  49  #modif proxy firefox
  50  rm -f /etc/skel/user/profil/appdata/Mozilla/Firefox/Profiles/default/prefs.js 
  51  cp /etc/skel/user/profil/appdata/Mozilla/Firefox/Profiles/default/prefs.js.in /etc/skel/user/profil/appdata/Mozilla/Firefox/Profiles/default/prefs.js 
  52  PREF_JS_FF="/etc/skel/user/profil/appdata/Mozilla/Firefox/Profiles/default/prefs.js"
  53  
  54  
  55  if [ -n "$PROXY" ]; then
  56  
  57      if [ "$slisip" = "$PROXY"  ];    then
  58          SETMYSQL proxy_url "http://$slisip/cgi-bin/slis.pac" "url du proxy pour le navigateur" 1
  59          SETMYSQL proxy_type "2" "type du proxy (param IE / aucun / manuel / url auto" 1
  60      else
  61          if [ "$dhcp" = "1" ]; then 
  62              /usr/share/se3/scripts/makedhcpdconf 
  63              SETMYSQL proxy_url "http://$se3ip/se3.pac" "url du proxy pour le navigateur" 1
  64              SETMYSQL proxy_type "2" "type du proxy (param IE / aucun / manuel / url auto" 1
  65          else
  66              SETMYSQL proxy_url "$PROXY:$PORT" "url du proxy pour le navigateur" 1
  67              SETMYSQL proxy_type "1" "type du proxy (param IE / aucun / manuel / url auto" 1
  68          fi    
  69      fi
  70  
  71  else
  72  
  73      rm -f /var/www/se3.pac
  74      rm -f /var/www/wpad.dat
  75      
  76      if [ "$slisip" != "" ];    then
  77          SETMYSQL proxy_url "http://$slisip/cgi-bin/slis.pac" "url du proxy pour le navigateur" 1
  78          SETMYSQL proxy_type "2" "type du proxy (param IE / aucun / manuel / url auto" 1
  79      else
  80          SETMYSQL proxy_url "" "url du proxy pour le navigateur" 1
  81          SETMYSQL proxy_type "0" "type du proxy (param IE / aucun / manuel / url auto" 1
  82      fi
  83  
  84  fi
  85  
  86  ### Ajouter lancement profil FF
  87  /usr/share/se3/scripts/deploy_mozilla_ff_final.sh shedule
  88  
  89  SETMYSQL firefox_use_ie "default" "Firefox utilise ou non les param proxy de IE" 1
  90  exit 0
  91  


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