[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3master/usr/share/se3/shares/shares.avail/ -> mkhome.sh (source)

   1  #!/bin/bash
   2  ## $Id: mkhome.sh 8305 2014-12-07 22:13:48Z dbo $ ##
   3  #shares_Win95: homes
   4  #shares_Win2K: homes
   5  #shares_WinXP: homes
   6  #shares_Vista: homes
   7  #shares_Seven: homes
   8  #shares_CIFSFS: homes
   9  #action: start
  10  #level: 09
  11  #
  12  #
  13  ##### Crée le répertoire personnel de user #####
  14  #
  15  #
  16  
  17  
  18  if [ "$1" = "--help" -o "$1" = "-h" ]
  19  then
  20      echo "Crée le répertoire personnel de user"
  21      echo "Usage : mkhome.sh user"
  22  fi    
  23      
  24  user=$1
  25  if [ -z "$1" ]
  26  then
  27      echo "Usage : mkhome.sh user"
  28      exit 1
  29  fi
  30  
  31  . /etc/se3/config_m.cache.sh
  32  
  33  # Creation du repertoire perso le cas echeant
  34  # -------------------------------------------
  35  if [ ! -d "/home/$user" -o ! -d "/home/$user/profil" ]; then
  36  
  37      . /etc/se3/config_c.cache.sh
  38       . /etc/se3/config_o.cache.sh
  39      . /etc/se3/config_p.cache.sh
  40      
  41      [ -d "/home/$user" ] || mkdir /home/$user
  42      cp -a $path2UserSkel/* /home/$user > /dev/null # 2>&1
  43      
  44      # kz - Ajout pour la construction du fichier de pref de moz TB uniquement car FF géré lors des maj
  45      # 
  46      PREF_JS_TB="/home/$user/profil/appdata/Thunderbird/Profiles/default/prefs.js"
  47  #     PREF_JS_FF="/home/$user/profil/appdata/Mozilla/Firefox/Profiles/default/prefs.js"
  48      
  49      
  50      SlisIp=`echo "SELECT value FROM params WHERE name='slisip'" | mysql -h $dbhost $dbname -u $dbuser -p$dbpass -N`
  51  #     if [ ! -z "$slissp" ]; then
  52  #     sed -e "s/slisip/$slisip/" -i $PREF_JS_FF
  53  #     else
  54  #         if [ -e /var/www/se3.pac ]; then
  55  #         
  56  #         sed -e "s§http://slisip/cgi-bin/slis.pac§http://$se3ip/se3.pac§" -i $PREF_JS_FF
  57  #         else
  58  #         sed -e "s§http://slisip/cgi-bin/slis.pac§§" -i $PREF_JS_FF
  59  #         sed -e "/network.proxy.type/d" -i $PREF_JS_FF
  60  #         fi
  61  #     fi
  62      
  63      MAIL=`ldapsearch -xLLL "uid=$user" | grep mail | cut -d " " -f2`
  64      PRENOM=`ldapsearch -xLLL "uid=$user" | grep gecos | cut -d " " -f2`
  65      NOM=`ldapsearch -xLLL "uid=$user" | grep gecos | cut -d " " -f3 | cut -d "," -f1`
  66      DOMNAME=`ldapsearch -xLLL "uid=$user" | grep mail | cut -d " " -f2 | cut -d "@" -f2`
  67      
  68      
  69      if [ -z "$lcsIp" ]; then
  70          cat "/home/$user/profil/appdata/Thunderbird/Profiles/default/prefs.js.slis"  \
  71          | sed -e "s/nom_compte_replace@domaine/$MAIL/g" \
  72          | sed -e "s/nom_compte_replace/$user/g" \
  73          | sed -e "s/domaine/$DOMNAME/g" \
  74          | sed -e "s/pop.replace.fr/$DOMNAME/g" \
  75          | sed -e "s/smtp.replace.fr/$DOMNAME/g" \
  76          | sed -e "s/votre_nom_replace/$PRENOM\ $NOM/g" \
  77          | sed -e "s/login_replace/$user/g" >  $PREF_JS_TB
  78          
  79      
  80      else
  81          cat "/home/$user/profil/appdata/Thunderbird/Profiles/default/prefs.js.lcs" \
  82          | sed -e "s/nom_compte_replace@domaine/$MAIL/g" \
  83          | sed -e "s/nom_compte_replace/$user/g" \
  84          | sed -e "s/domaine/$DOMNAME/g" \
  85          | sed -e "s/pop.replace.fr/$DOMNAME/g" \
  86          | sed -e "s/smtp.replace.fr/$DOMNAME/g" \
  87          | sed -e "s/votre_nom_replace/$PRENOM\ $NOM/g" \
  88          | sed -e "s/nom_serveur_replace/$lcsIp/g" \
  89          | sed -e "s/login_replace/$user/g" >  $PREF_JS_TB
  90      
  91      fi
  92      
  93      chown -R $user:admins /home/$user > /dev/null 2>&1
  94      chmod -R 700 /home/$user > /dev/null 2>&1
  95      setfacl -R -m d:u:$user:rwx /home/$user
  96  
  97      # fixe homepage selon categorie adm / profs / eleves
  98      if [ -n "$(ldapsearch -xLLL cn=administratifs memberuid | grep "$user")" ]; then
  99          [ -n "$administratifs_hp" ] && /usr/share/se3/scripts/modif_profil_mozilla_ff.sh $user "$administratifs_hp"
 100      
 101      elif [ -n "$(ldapsearch -xLLL cn=profs memberuid | grep "$user")" ]; then
 102          [ -n "$profs_hp" ] && /usr/share/se3/scripts/modif_profil_mozilla_ff.sh $user "$profs_hp"
 103      
 104      elif [ -n "$(ldapsearch -xLLL cn=eleves memberuid | grep "$user")" ]; then
 105          [ -n "$eleves_hp" ] && /usr/share/se3/scripts/modif_profil_mozilla_ff.sh $user "$eleves_hp"
 106      fi
 107      
 108  
 109  
 110  
 111  else
 112      if [ "localmenu" == "1" ]; then
 113          # il faut creer le menu dans profiles    
 114          pathDemarrer="/home/profiles/$user.V2/Demarrer"
 115          if [ -d /home/profiles/$user.V2 ]; then 
 116              find "$pathDemarrer" -group root # -delete
 117          else
 118              mkdir -p "$pathDemarrer" && chown -R  $user:lcs-users /home/profiles/$user.V2
 119          fi
 120          [ -d /home/$user/profil/Demarrer ] && mv /home/$user/profil/Demarrer /home/profiles/$user.V2
 121      fi
 122      useruid=`getent passwd $user | gawk -F ':' '{print $3}'`
 123      prop=`stat -c%u /home/$user`
 124      if [ "$prop" != "$useruid" ]; then
 125          chown -R $user:admins /home/$user > /dev/null 2>&1
 126          chown -R $user:admins /home/$user/profil/Bureau/* > /dev/null 2>&1
 127      fi
 128      if [ "localmenu" != "1" ]; then
 129          chown -R $user:admins /home/$user/profil/Demarrer/* > /dev/null 2>&1
 130      fi 
 131  fi
 132  


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