[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3master/usr/share/se3/sbin/ -> update-smbconf.sh (source)

   1  #!/bin/bash
   2  ## $Id: update-smbconf.sh 7603 2013-01-10 17:23:37Z keyser $ ##
   3  # Update smb.conf based on current template version and current logon script (pl, py)
   4  # Keep user defined shares
   5  . /usr/share/se3/includes/config.inc.sh -cml
   6  #. /usr/share/se3/includes/functions.inc.sh
   7  
   8  [ ! -d /home/profiles ] && mkdir /home/profiles
   9  chown root.root /home/profiles
  10  chmod 777 /home/profiles
  11  [ -z "$se3_domain" ] && se3_domain=$(grep "workgroup" /etc/samba/smb.conf|cut -d '=' -f2|sed -e 's/ //g')
  12  [ -z "$netbios_name" ] && netbios_name=$(grep "netbios name" /etc/samba/smb.conf|cut -d '=' -f2|sed -e 's/ //g')
  13  [ -z "$se3ip" ] && se3ip="$(expr "$(LC_ALL=C /sbin/ifconfig eth0 | grep 'inet addr')" : '.*inet addr:\([^ ]*\)')"
  14  
  15  [ -z "$se3mask" ] && se3mask=$(grep netmask  /etc/network/interfaces | head -n1 | sed -e "s/netmask//g" | tr "\t" " " | sed -e "s/ //g")
  16  CHARSET=$(grep "unix charset" /etc/samba/smb.conf |grep -v "#"| head -n1 | cut -d"=" -f2 | sed -e "s/ //")
  17  [ -z "$CHARSET" ] && CHARSET="UTF-8"
  18  
  19  cp -f /etc/samba/smb.conf /etc/samba/smb.conf.old
  20  sed -e "s/#DOMAIN#/$se3_domain/g;s/#NETBIOSNAME#/$netbios_name/g;s/#IPSERVEUR#/$se3ip/g;s/#MASK#/$se3mask/g;s/#SLAPDIP#/$ldap_server/g;s/#BASEDN#/$ldap_base_dn/g;s/#ADMINRDN#/$adminRdn/g;s/#COMPUTERS#/$computersRdn/g;s/#PEOPLE#/$peopleRdn/g;s/#GROUPS#/$groupsRdn/g;s/#CHARSET#/$CHARSET/g" /var/cache/se3_install/conf/smb_3.conf.in >/etc/samba/smb.conf
  21  
  22  
  23  if [ ! -e /etc/samba/smb_etab.conf ]; then
  24      echo "Analyse des partages ajoutes via l'interface par l'etablissement"
  25      touch /etc/samba/smb_etab.conf
  26      grep -A1000 "include = /etc/samba/printers_se3/%m.inc" /etc/samba/smb.conf.old | grep -v "include =" >/etc/samba/smb_etab.conf
  27      SMB_ETAB=$(cat /etc/samba/smb_etab.conf)
  28      if [ -z "$SMB_ETAB" ]; then
  29          echo "Attention : AUCUN partage propre a l'etablissement trouve dans le smb.conf d'origine. A noter que c'est normal si vous n'en avez jamais crees"
  30      else
  31          echo "Les partages propres a l'etablissement suivants ont ete trouve et exportes dans /etc/samba/smb_etab.conf"  
  32          echo "$SMB_ETAB" 
  33      fi
  34      
  35  fi
  36  
  37  
  38  #size=$(wc -l /root/smb.conf |cut -d ' ' -f1)
  39  #line=$(grep -m1 -n '<.*>' /root/smb.conf |cut -d ':' -f1)
  40  #if [ "$line" != "" ]
  41  #then
  42  #    tail -n $(( size - line + 1 )) /root/smb.conf | grep -v "include = " >> /etc/samba/smb_perso.conf
  43  #fi
  44  #rm -f /root/smb.conf
  45  
  46  
  47  
  48  
  49  # SSL="start_tls" fix bug libnss squeeze desactivation tls
  50  SSL="off"
  51  
  52  if [ "$replica_status" = "2" ]
  53  then
  54      SSL="off"
  55  fi
  56  # Pas de ssl si le ldap est local
  57  if [ "$replica_status" == "" -o "$replica_status" = "0" ]
  58  then    
  59      if [ "$ldap_server" == "$se3ip" ]
  60      then
  61          SSL="off"
  62      fi
  63  fi
  64  
  65  sed -i "s!ldap ssl.*!ldap ssl = $SSL!" /etc/samba/smb.conf
  66  sed -i "s!recycle:repository=/home/%u/profil/Bureau/Corbeille_Reseau!recycle:repository=/home/%u/Corbeille_Reseau!" /etc/samba/smb*.conf
  67  sed -i "s!recycle:touch !recycle:touch_mtime !" /etc/samba/smb*.conf
  68  sed -i "s!recycle:touch=no!recycle:touch_mtime=yes!" /etc/samba/smb*.conf
  69  /usr/share/se3/sbin/vide_corbeille.sh clean
  70  if [ "$corbeille" == "0" ]
  71  then
  72      sed -i "s/recycle:exclude=.*/recycle:exclude=\*\.\*/" /etc/samba/smb*.conf
  73  else
  74      sed -i "s/recycle:exclude=\*\.\*/recycle:exclude=\?\~\$\*,\~\$\*,\*\.tmp,index\*\.pl,index\*\.htm\*,\*\.temp,\*\.TMP/" /etc/samba/smb*.conf
  75  fi
  76  chmod 644 /etc/samba/smb_*
  77  
  78  /etc/init.d/samba reload >/dev/null 2>&1


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