[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 #!/bin/bash 2 # postinst script for se3-ocs-clientwin 3 # 4 # see: dh_installdeb(1) 5 6 set -e 7 8 # summary of how this script can be called: 9 # * <postinst> `configure' <most-recently-configured-version> 10 # * <old-postinst> `abort-upgrade' <new version> 11 # * <conflictor's-postinst> `abort-remove' `in-favour' <package> 12 # <new-version> 13 # * <postinst> `abort-remove' 14 # * <deconfigured's-postinst> `abort-deconfigure' `in-favour' 15 # <failed-install-package> <version> `removing' 16 # <conflicting-package> <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 install|configure) 23 24 . /usr/share/se3/includes/config.inc.sh -svm > /dev/null 25 26 27 if [ "X$xppass" = "X" ]; then # if empty 28 echo "pas de mot de pass defini pour adminse3" 29 exit 1 30 fi 31 32 if [ -e /var/se3/Progs/install/ocs-config.bat ]; then 33 echo "Suppression de ocs-config.bat devenu inutile." 34 rm -rf /var/se3/Progs/install/ocs-config.bat 35 fi 36 37 ##### SUPPRESSION de ocs-config.bat. Gereration du job CPAU cote serveur. ### 38 OcsDir="/var/se3/Progs/ro/inventory/deploy" 39 # Fix for wine when running from sudo 40 export HOME=/root 41 JOB=cpauOcs.job 42 WINECMD="env WINEDEBUG=-all wine" 43 rm -f $OcsDir/$JOB 44 echo "Creation du $JOB CPAU destine a installer ocs-clientwin sur les postes." 45 TASK="echo Veuillez patienter...&&c:\\tmpOcs\\OcsAgentSetup.exe /S /server:$se3ip /pnum:909 /np /debug" 46 echo "TASK se3 : $TASK" | sed -e "s/$xppass/XXXXXX/g" 47 cd /tmp 48 $WINECMD /home/netlogon/CPAU.exe -u adminse3 -wait -p $xppass -file $JOB -lwop -c -ex "$TASK" -enc > /dev/null 49 mv $JOB $OcsDir 50 51 52 ### CREATION DE ocs.bat cote serveur pour les postes Clients W98 ou WinXP ### 53 echo "Creation de $OcsDir/ocs.bat" 54 OcsDirWin="\\\\$netbios_name\\Progs\\ro\\inventory\\deploy" 55 echo ":: Installation du service OCS sur les postes clients">$OcsDir/ocs.bat 56 echo "@echo OFF">>$OcsDir/ocs.bat 57 # Test si OCS est deja installe>$OcsDir/ocs.bat 58 echo "If \"%ProgramFiles%\" == \"\" Set ProgramFiles=C:\Program Files">>$OcsDir/ocs.bat 59 echo "If Exist \"%ProgramFiles(x86)%\" Set ProgramFiles=%ProgramFiles(x86)%">>$OcsDir/ocs.bat 60 echo "If Exist \"%ProgramFiles%\OCS Inventory Agent\OCSInventory.exe\" Goto FIN">>$OcsDir/ocs.bat 61 echo "Set TMPOCS=c:\\tmpOcs">>$OcsDir/ocs.bat 62 echo "Set CPAU=\\\\$netbios_name\\netlogon\\CPAU.exe">>$OcsDir/ocs.bat 63 echo "If Not Exist %TMPOCS% mkdir %TMPOCS%">>$OcsDir/ocs.bat 64 echo "if \"%OS%\" == \"Windows_NT\" goto InstWnt">>$OcsDir/ocs.bat 65 echo "" >>$OcsDir/ocs.bat 66 67 echo ":InstW9x">>$OcsDir/ocs.bat 68 echo ":: Pour les Win98, execution de OcsAgentSetup.exe directement a partir du serveur">>$OcsDir/ocs.bat 69 echo "echo Installation OCS-NG pour Win9x">>$OcsDir/ocs.bat 70 echo "\"$OcsDirWin\\OcsAgentSetup.exe\" /S /server:$se3ip /pnum:909 /np /debug">>$OcsDir/ocs.bat 71 echo "Goto InstOk">>$OcsDir/ocs.bat 72 echo "">>$OcsDir/ocs.bat 73 74 echo ":InstWnt">>$OcsDir/ocs.bat 75 echo "echo Installation OCS-NG pour WinXP">>$OcsDir/ocs.bat 76 echo "xcopy /I /H /R /Y /Z /Q \"$OcsDirWin\\*\" %TMPOCS% >NUL">>$OcsDir/ocs.bat 77 echo "If Not Exist \"%TMPOCS%\\$JOB\" Goto Err2">>$OcsDir/ocs.bat 78 echo "\"%CPAU%\" -dec -file \"%TMPOCS%\\$JOB\" -nowarn -lwp -wait -outprocexit 2>NUL >NUL">>$OcsDir/ocs.bat 79 echo "If ErrorLevel 1 Goto Err3">>$OcsDir/ocs.bat 80 #echo "rmdir /S /Q \"%TMPOCS%\"">>$OcsDir/ocs.bat 81 echo "Goto InstOk">>$OcsDir/ocs.bat 82 echo "">>$OcsDir/ocs.bat 83 84 echo ":Err2">>$OcsDir/ocs.bat 85 echo "Echo Le fichier \"%TMPOCS%\\$JOB\" n'existe pas !">>$OcsDir/ocs.bat 86 echo "">>$OcsDir/ocs.bat 87 88 echo ":Err3">>$OcsDir/ocs.bat 89 echo "rmdir /S /Q \"%TMPOCS%\"">>$OcsDir/ocs.bat 90 echo "echo Erreur lors de l'installation d'OCS">>$OcsDir/ocs.bat 91 echo "goto FIN">>$OcsDir/ocs.bat 92 echo "">>$OcsDir/ocs.bat 93 94 echo ":InstOk">>$OcsDir/ocs.bat 95 echo "Echo Installation OCS : OK.">>$OcsDir/ocs.bat 96 echo "">>$OcsDir/ocs.bat 97 #echo ":FIN">>$OcsDir/ocs.bat 98 99 100 ## AJOUT : REMONTEE IMMEDIATE DE L'INVENTAIRE (Olikin) ### 101 JOB=cpauOcsRemontee.job 102 rm -f $OcsDir/$JOB 103 echo "Creation du $JOB CPAU destine a remonter immediatement l'inventaire sur le serveur $netbios_name." 104 TASK="call $OcsDirWin\\ocsremontee.bat" 105 echo "TASK se3 : $TASK" | sed -e "s/$xppass/XXXXXX/g" 106 cd /tmp 107 $WINECMD /home/netlogon/CPAU.exe -u adminse3 -wait -p $xppass -file $JOB -lwop -c -ex "$TASK" -enc > /dev/null 108 mv $JOB $OcsDir 109 110 echo "Creation du script $OcsDir/ocs.bat (remontee immediate d'inventaire)." 111 echo "">>$OcsDir/ocs.bat 112 echo "echo Remontee immediate de l'inventaire OCS sur le SE3.">>$OcsDir/ocs.bat 113 echo "If Not Exist \"%TMPOCS%\\$JOB\" Goto Err4">>$OcsDir/ocs.bat 114 echo "\"%CPAU%\" -dec -file \"%TMPOCS%\\$JOB\" -nowarn -lwp -wait -outprocexit 2>NUL >NUL">>$OcsDir/ocs.bat 115 echo "If ErrorLevel 1 Goto Err5">>$OcsDir/ocs.bat 116 echo "rmdir /S /Q \"%TMPOCS%\"">>$OcsDir/ocs.bat 117 echo "Goto RemOk">>$OcsDir/ocs.bat 118 echo "">>$OcsDir/ocs.bat 119 echo ":Err4">>$OcsDir/ocs.bat 120 echo "Echo Le fichier \"%TMPOCS%\\$JOB\" n'existe pas ! Pas de remontee immediate de l'inventaire !">>$OcsDir/ocs.bat 121 echo "">>$OcsDir/ocs.bat 122 echo ":Err5">>$OcsDir/ocs.bat 123 echo "rmdir /S /Q \"%TMPOCS%\"">>$OcsDir/ocs.bat 124 echo "echo Erreur lors de la remontee du rapport OCS.">>$OcsDir/ocs.bat 125 echo "goto FINRem">>$OcsDir/ocs.bat 126 echo "">>$OcsDir/ocs.bat 127 echo ":RemOk">>$OcsDir/ocs.bat 128 echo "Echo Remontee du premier inventaire OCS : OK.">>$OcsDir/ocs.bat 129 echo "">>$OcsDir/ocs.bat 130 echo ":FIN">>$OcsDir/ocs.bat 131 132 echo "@echo OFF">$OcsDir/ocsremontee.bat 133 echo "echo Remontee immediate de l'inventaire.">>$OcsDir/ocsremontee.bat 134 echo "set OCSINI=%ProgramFiles%\\OCS Inventory Agent\\service.ini">>$OcsDir/ocsremontee.bat 135 echo "echo Arret du service OCS...">>$OcsDir/ocsremontee.bat 136 echo "net stop \"OCS INVENTORY SERVICE\" >NUL">>$OcsDir/ocsremontee.bat 137 echo "Copy \"%OCSINI%\" %systemdrive%\\FILEOCSINI.TMP >NUL">>$OcsDir/ocsremontee.bat 138 echo "echo Modification du parametre TTO_WAIT pour remontee de l'inventaire dans 2 sec.">>$OcsDir/ocsremontee.bat 139 echo "type %systemdrive%\\FILEOCSINI.TMP | Findstr /V /I \"\\<TTO_WAIT\" > \"%OCSINI%\"">>$OcsDir/ocsremontee.bat 140 echo "Del %systemdrive%\\FILEOCSINI.TMP >NUL">>$OcsDir/ocsremontee.bat 141 echo "echo TTO_WAIT=2 >> \"%OCSINI%\"">>$OcsDir/ocsremontee.bat 142 echo "echo Redemarrage du service OCS...">>$OcsDir/ocsremontee.bat 143 echo "net start \"OCS INVENTORY SERVICE\" >NUL">>$OcsDir/ocsremontee.bat 144 145 146 #### AJOUT DE LA LIGNE DANS base/logon.bat ##### 147 if [ "$(cat /home/templates/base/logon.bat | grep "ocs.bat")" = "" ]; then 148 echo "Ajout de la ligne necessaire dans /home/templates/base/logon.bat" 149 echo -e "\r">>/home/templates/base/logon.bat 150 DEBVERS=$(cat /etc/debian_version) 151 if [ "$DEBVERS" == "4.0" ]; then 152 echo -e "::call \\\\\\\\$netbios_name\\Progs\\\\ro\\inventory\\deploy\\ocs.bat\r">>/home/templates/base/logon.bat 153 else 154 echo -e "call \\\\\\\\$netbios_name\\Progs\\\\ro\\inventory\\deploy\\ocs.bat\r">>/home/templates/base/logon.bat 155 fi 156 else 157 echo "Template base deja correctement configure pour se3-ocs-clientwin." 158 fi 159 160 #### DROITS SUR Progs #### 161 echo "Positionnement correct des droits sur le dossier de deploiement." 162 chown -R admin:admins /var/se3/Progs/ro/inventory 163 setfacl -R -m m:rwx /var/se3/Progs/ro/inventory 164 165 [ -e /home/admin/Bureau/conf-ocs.bat ] && rm -f /home/admin/Bureau/conf-ocs.bat 166 167 # on vire le vieux script de config (historique) pour eviter les erreurs... 168 [ -e /var/se3/Progs/install/ocs-config.bat ] && rm -f /var/se3/Progs/install/ocs-config.bat 169 170 echo "Configuration de se3-ocs-clientwin terminee." 171 172 ;; 173 174 abort-upgrade|abort-remove|abort-deconfigure) 175 ;; 176 177 *) 178 echo "postinst called with unknown argument \`$1'" >&2 179 exit 1 180 ;; 181 esac 182 183 # dh_installdeb will replace this with shell code automatically 184 # generated by other debhelper scripts. 185 186 #DEBHELPER# 187 188 exit 0
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 |