[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 #!/bin/bash 2 3 ## $Id: corrige_se3.sh 7723 2013-03-18 23:57:26Z keyser $ ## 4 5 # ********************************************************** 6 # Auteur: Olivier LECLUSE 7 # Colorisation: 18/05/2005 8 # Ce script est distribué selon les termes de la licence GPL 9 # ********************************************************** 10 11 cd /var/cache/se3_install 12 13 CONT=$1 14 15 #Couleurs - désactivation des couleurs - keyser car posant pb avec 16 # lors de l'affichage ds une page web 17 18 19 #date et heure 20 LADATE=$(date +%d-%m-%Y) 21 22 # path fichier de logs 23 LOG_DIR="/var/log/se3" 24 25 # 26 # Détection de la distribution 27 # 28 29 # Creation de l'utilisateur www-se3 et du rep cgi-binse -- a retirer par la suite 30 clear 31 32 echo -e "$COLTITRE" 33 echo "*************************" 34 echo "* SCRIPT DE CORRECTION *" 35 echo "* DE SAMBAEDU3 *" 36 echo "*************************" 37 38 echo -e "$COLCMD\c" 39 cat /etc/passwd | grep www-se3 > /dev/null || ADDWWWSE3="1" 40 41 if [ "$ADDWWWSE3" = "1" ]; then 42 useradd -d /var/remote_adm -s /bin/bash 43 sleep 5 44 fi 45 46 if [ ! -d /usr/lib/cgi-binse ]; then 47 mkdir /usr/lib/cgi-binse 48 fi 49 if [ ! -d /usr/share/se3/scripts ]; then 50 mkdir -p /usr/share/se3/scripts 51 fi 52 if [ ! -d /usr/share/se3/sbin ]; then 53 mkdir -p /usr/share/se3/sbin 54 fi 55 if [ ! -d /usr/share/se3/scripts-alertes ]; then 56 mkdir -p /usr/share/se3/scripts-alertes 57 fi 58 59 echo -e "$COLTXT" 60 echo "Détection de la distribution..." 61 echo -e "$COLCMD\c" 62 63 if [ -e /etc/redhat-release ]; then 64 DISTRIB="RH" 65 WWWPATH="/var/www/html" 66 APACHE="apache" 67 CGIPATH="/var/www/cgi-bin" 68 SMBCONF="/etc/samba/smb.conf" 69 APACHECONF="/etc/httpd/conf/httpd.conf" 70 PAMLDAPCONF="/etc/ldap.conf" 71 NSSLDAPCONF="" 72 NSSWITCH="/etc/nsswitch.conf" 73 MRTGCFG="/etc/mrtg/mrtg.cfg" 74 INITDSAMBA="/etc/init.d/smb" 75 INITDAPACHE="/etc/init.d/httpd" 76 fi 77 if [ -e /etc/mandrake-release ]; then 78 cat /etc/mandrake-release 79 DISTRIB="MDK" 80 WWWPATH="/var/www/html" 81 APACHE="apache" 82 CGIPATH="/var/www/cgi-bin" 83 SMBCONF="/etc/samba/smb.conf" 84 APACHECONF="/etc/httpd/conf/httpd.conf" 85 PAMLDAPCONF="/etc/ldap.conf" 86 NSSLDAPCONF="" 87 NSSWITCH="/etc/nsswitch.conf" 88 MRTGCFG="/etc/mrtg/mrtg.cfg" 89 INITDSAMBA="/etc/init.d/smb" 90 INITDAPACHE="/etc/init.d/httpd" 91 fi 92 if [ -e /etc/debian_version ]; then 93 echo -e "$COLINFO\c" 94 echo "Debian détectée, félicitation ;-)" 95 DISTRIB="DEB" 96 WWWPATH="/var/www" 97 APACHE="www-se3" 98 CGIPATH="/usr/lib/cgi-binse" 99 SMBCONF="/etc/samba/smb.conf" 100 APACHECONF="/etc/apache/httpdse.conf" 101 PAMLDAPCONF="/etc/pam_ldap.conf" 102 NSSLDAPCONF="/etc/libnss-ldap.conf" 103 NSSWITCH="/etc/nsswitch.conf" 104 MRTGCFG="/etc/mrtg.cfg" 105 INITDSAMBA="/etc/init.d/samba" 106 INITDAPACHE="/etc/init.d/apache" 107 fi 108 109 # 110 # Récupération des paramètres de connexion à la base 111 # 112 113 echo -e "$COLCMD\c" 114 if [ -e $WWWPATH/se3/includes/config.inc.php ]; then 115 dbhost=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbhost=" | cut -d = -f 2 |cut -d \" -f 2` 116 dbname=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbname=" | cut -d = -f 2 |cut -d \" -f 2` 117 dbuser=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbuser=" | cut -d = -f 2 |cut -d \" -f 2` 118 dbpass=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbpass=" | cut -d = -f 2 |cut -d \" -f 2` 119 else 120 echo -e "$COLERREUR" 121 echo "Fichier de conf inaccessible." 122 echo -e "$COLTXT" 123 exit 1 124 fi 125 LDAPIP=`echo "SELECT value FROM params WHERE name='ldap_server'" | mysql -h $dbhost $dbname -u $dbuser -p$dbpass -N` 126 if [ -z "$LDAPIP" ]; then 127 echo -e "$COLERREUR" 128 echo "Impossible d'accéder aux paramètres SambaEdu." 129 echo -e "$COLTXT" 130 exit 1 131 fi 132 133 cp -ax /var/cache/se3_install/conf/sudoers /etc/sudoers 134 chmod 0440 /etc/sudoers 135 136 137 # 138 # Mise à jour des scripts et de l'interface 139 # 140 echo -e "$COLTXT" 141 echo "Mise à jour de l'interface..." 142 echo -e "$COLCMD\c" 143 tar -zxf wwwse3.tgz -C $WWWPATH 2>/dev/null 144 145 # Supprerssion du menu sauvegarde 146 if [ ! -d /etc/backuppc ]; then 147 rm /var/www/se3/includes/menu.d/95sauvegarde.inc 148 fi 149 150 # Mise en place de la protection sur le dossier setup 151 # rm $WWWPATH/se3/setup/index.php 152 # ln $WWWPATH/se3/edit_params.php $WWWPATH/se3/setup/index.php 153 # echo "AuthUserFile $WWWPATH/se3/setup/.htpasswd" >> $WWWPATH/se3/setup/.htaccess 154 155 if [ ! -z $(grep "3.1" /etc/debian_version) ]; then 156 adminpass=`getent passwd admin | cut -d: -f2` 157 if [ "$adminpass" = "x" ]; then 158 adminpass=`getent shadow admin | cut -d: -f2` 159 fi 160 echo "admin:$adminpass" > $WWWPATH/se3/setup/.htpasswd 161 chgrp root $WWWPATH/se3/setup/ -R 162 chmod 750 $WWWPATH/se3/setup/ -R 163 fi 164 165 chown -R $APACHE $WWWPATH/se3 166 cp -a gepcgi/gep*.cgi $CGIPATH 167 chown $APACHE $CGIPATH/gep*.cgi 168 cp -a gepcgi/Se.pm /usr/lib/perl5 169 chown $APACHE /usr/lib/perl5/Se.pm 170 chown $APACHE scripts/* 171 cp -a scripts/* /usr/share/se3/sbin 172 chown $APACHE sudoscripts/* 173 cp -a sudoscripts/* /usr/share/se3/scripts 174 cp -a scripts-alertes/* /usr/share/se3/scripts-alertes 175 176 cp -ax /var/cache/se3_install/conf/se3-logrotate /etc/logrotate.d/se3 177 178 # Mise a jour de l'exe de fond d'ecran 179 cp -a reg/fde.exe /home/netlogon 180 cp -a reg/killexplorer.exe /home/netlogon 181 cp -a reg/majdll.exe /home/netlogon 182 chown admin.admins /home/netlogon/ 183 184 # 185 # Rétablissement du script mkslurpd 186 # 187 echo -e "$COLCMD\c" 188 mv /usr/share/se3/sbin/mkslurpd /usr/share/se3/sbin/mkslurpd.old 189 cat /usr/share/se3/sbin/mkslurpd.old | sed -e "s/#MYSQLIP#/$dbhost/g" | sed -e "s/#SE3DBPASS#/$dbpass/g" > /usr/share/se3/sbin/mkslurpd 190 rm /usr/share/se3/sbin/mkslurpd.old 191 chmod 750 /usr/share/se3/sbin/mkslurpd 192 chown root.root /usr/share/se3/sbin/mkslurpd 193 194 /usr/share/se3/sbin/update-share.sh -v -d 195 196 VERSION=`cat /var/cache/se3_install/version` 197 echo "DELETE FROM params WHERE name=\"version\""| mysql -h $dbhost $dbname -u $dbuser -p$dbpass 198 echo "INSERT INTO params (\`name\`,\`value\`,\`descr\`,\`cat\`) VALUES ('version',\"$VERSION\",'No de version','4')"| mysql -h $dbhost $dbname -u $dbuser -p$dbpass 199 echo "UPDATE params SET value=\"$MAJNBR\" WHERE name=\"majnbr\""| mysql -h $dbhost $dbname -u $dbuser -p$dbpass 200 echo -e "$COLTXT" 201 202 cd -
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Mar 17 22:47:18 2015 | Cross-referenced by PHPXref 0.7.1 |