Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

nombre réponses : 25

#0 Re : -1 »  Script d'installation pour imprimantes Brother » Le 29/07/2014, à 18:23

galexis
Réponses : 2 756

Bonjour,
j'ai un multifonction DCP-115C que je souhaite faire fonctionner sous Linuxmint 17-64 bits (basé sur ubuntu 14.04).
J'ai utilisé le script d'installaton présent sur le site brothers: ici
J'ai choisit MFC210C au DC115C car cela a toujours été préconisé par Brothers jusqu'à présent et cela a toujours fonctionné, hors le script installe les drivers MFC410C à la place.
L'imprimante fonctionne bien.

En revanche le scanner ne fonctionne pas, il indique le message suivant: "Echec de démarrage du scanner : paramètre non valide"
Syslog contient cela à la connection d'imprimante:

... kernel: [ 8273.882575] usb 3-1: new full-speed USB device number 10 using xhci_hcd
... kernel: [ 8273.902609] usb 3-1: New USB device found, idVendor=04f9, idProduct=018c
... kernel: [ 8273.902613] usb 3-1: New USB device strings: Mfr=0, Product=0, SerialNumber=3
... kernel: [ 8273.902614] usb 3-1: SerialNumber: BROH6F126517
... kernel: [ 8273.902868] usb 3-1: ep 0x85 - rounding interval to 512 microframes, ep desc says 800 microframes
... kernel: [ 8273.904752] usblp 3-1:1.0: usblp0: USB Bidirectional printer dev 10 if 0 alt 0 proto 2 vid 0x04F9 pid 0x018C
... kernel: [ 8273.904853] usb-storage 3-1:1.2: USB Mass Storage device detected
... kernel: [ 8273.904936] scsi7 : usb-storage 3-1:1.2
... colord: Device added: sysfs-04f9-018c
... udev-configure-printer: add /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1:1.0
... udev-configure-printer: device devpath is /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1:1.0
... udev-configure-printer: MFG:Brother MDL:DCP-115C SERN:- serial:-
... kernel: [ 8274.913423] scsi 7:0:0:0: Direct-Access     Brother  DCP-115C         1.00 PQ: 0 ANSI: 2
... kernel: [ 8274.914126] sd 7:0:0:0: Attached scsi generic sg3 type 0
... kernel: [ 8274.953349] sd 7:0:0:0: [sdc] Attached SCSI removable disk
... kernel: [ 8274.958933] usblp0: removed
... kernel: [ 8274.963989] usblp 3-1:1.0: usblp0: USB Bidirectional printer dev 10 if 0 alt 0 proto 2 vid 0x04F9 pid 0x018C
... udev-configure-printer: URI matches without serial number: usb://Brother/DCP-115C?serial=BROH6F126517
... udev-configure-printer: No serial number URI matches so using those without
... udev-configure-printer: URI of detected printer: usb://Brother/DCP-115C?serial=BROH6F126517, normalized: brother dcp 115c serial broh6f126517
... udev-configure-printer: URI of print queue: lpd://192.168.1.15/LPT1, normalized: lpd 192 168 1 15 lpt1
... udev-configure-printer: URI of print queue: usb://Brother/DCP-115C, normalized: brother dcp 115c
... udev-configure-printer: Queue ipp://localhost:631/printers/DCP115C has matching device URI
... udev-configure-printer: URI of print queue: cups-pdf:/, normalized: cups pdf

Lors de l'ouverture de xsane, syslog:

... kernel: [ 8290.583794] usb 3-1: usbfs: interface 0 claimed by usblp while 'xsane' sets config #1
... kernel: [ 8290.583972] usb 3-1: usbfs: process 9806 (xsane) did not claim interface 1 before use
... kernel: [ 8339.928157] usb 3-1: usbfs: interface 0 claimed by usblp while 'xsane' sets config #1
... kernel: [ 8339.928212] usb 3-1: usbfs: process 9806 (xsane) did not claim interface 1 before use
... kernel: [ 8354.428292] usb 3-1: usbfs: interface 0 claimed by usblp while 'xsane' sets config #1
... kernel: [ 8354.428312] usb 3-1: usbfs: process 9806 (xsane) did not claim interface 1 before use
 $ dpkg  -l  |  grep  Brother
ii  brscan-skey                                                 0.2.4-1                                             amd64        Brother Linux scanner S-KEY tool
ii  brscan2                                                     0.2.5-1                                             amd64        Brother Scanner Driver
ii  cupswrappermfc210c                                          1.0.2-3                                             i386         Brother MFC210C CUPS wrapper driver
ii  mfc210clpr                                                  1.0.2-1                                             i386         Brother lpr Inkjet Printer Definitions
pi  mfc410cnlpr                                                 1.0.2-1                                             i386         Brother lpr Inkjet Printer Definitions

Merci pour votre aide.
Alexis

#1 Re : -1 »  Script d'installation pour imprimantes Brother » Le 29/07/2014, à 19:38

galexis
Réponses : 2 756
alca94 a écrit :

Bonjour
si vous avez utiliser le script "Brother" il faut voir ça avec eux ?
Autrement la prochaine fois utilisez celui là
http://forum.ubuntu-fr.org/viewtopic.ph … 1#p6368981
c'est quand même curieux cette histoire d'installer une MFC pour une DCP ?

Ce n'est pas le même script celui  de brothers et celui de Demonipuch ?
Je les ai contacté par mail, en gros ils ont botté en touche en m'indiquant le lien vers la page de téléchargement !

#2 Re : -1 »  Script d'installation pour imprimantes Brother » Le 30/07/2014, à 11:16

galexis
Réponses : 2 756
alca94 a écrit :

EDIT = Avez vous essayer avec "Simple-scan" (si ça existe sur linux-mint ?)

Ce n'est pas le même script celui  de brothers et celui de Demonipuch ?

aucune idée ,ils ont peut-être copier avec son aval ?
quoiqu'il en soit là je ne peux pas vraiment vous aider ,en plus sur linux-mint ? A tout hasard regardez si vous pouvez installer ces librairies

sudo dpkg --add-architecture i386

puis installer le paquet dont aura besoin le pilote :

sudo apt-get install libc6:i386

Autrement désinstaller tout dans la logithèque (la liste est celle ressortant de "dpkg  -l  |  grep  Brother")
et refaites le script sur cette page et en prenant bien DCP -115 C ,imprimantes connectée et allumée

Le paquet libc6 est déjà installé.
Le scanner ne fonctionne pas mieux avec simple-scan.
J'ai essayé le script du post: il ne se passe rien, le script se lance après le mot de passe, puis plus rien. DAns install.log il y a :

+ CheckZenity
+ dpkg -l
+ awk '{print $2}'
+ grep '^zenity$'
+ [[ 0 == 0 ]]
+ [[ ! -z :0 ]]
+ InstallWizard=zenity
+ case ${InstallWizard} in
+ Gui
+ CheckSourceList_GUI
+ case ${os} in
+ case ${codename} in
+ [[ x86_64 == \x\8\6\_\6\4 ]]
++ grep /etc/apt/sources.list
++ grep -E '^deb http://(ftp.[a-z]{2}.|[a-z]{2}.|packages.)?(archive.ubuntu.com|debian.org|linuxmint.com)/(LinuxMint)?(/)? qiana '

Zenity et whiptail sont bien installés.
Merci.

#3 Re : -1 »  Script d'installation pour imprimantes Brother » Le 30/07/2014, à 17:12

galexis
Réponses : 2 756

Alors en faite, le problème vient de la vérification de la source universe : le script cherche dans /etc/apt/source.list
alors qu'il est dans /etc/apt/sources.list.d/official-package-repositories.list sous LM17.
Sur le forum  https://www.linuxmint-fr.org/forum/gest … ur-mint-16
bnet22 indique qu'il faut:

bnet22 sur forum linuxmint-fr a écrit :

Dans passer outre, ouvre install.sh avec un éditeur de texte, et ajoute un # au début de la ligne 1261 :
# CheckSourceList

Et de la ligne 1273 :
# CheckSourceList_GUI

EDIT : il en parle aussi : http://forum.ubuntu-fr.org/viewtopic.php?pid=15642411

Cela permet de déclencher le script. (Je suis en train de compléter le script pour LM17 et les différences de sources.list.)
Par contre le script reste bloqué au paramétrage de UDEV:

 ~/Téléchargements/brother $ sudo ./install.sh

Installation des pré-requis
Mise à jour de la liste des paquets
Ign http://archive.canonical.com trusty InRelease
Ign http://security.ubuntu.com trusty-security InRelease                       
Réception de : 1 http://debian.qelectrotech.org unstable InRelease [2 567 B]   
Ign http://ppa.launchpad.net trusty InRelease                                  
Atteint http://archive.canonical.com trusty Release.gpg                        
Atteint http://security.ubuntu.com trusty-security Release.gpg                 
Ign http://archive.ubuntu.com trusty InRelease                                 
Réception de : 2 http://debian.qelectrotech.org unstable/main amd64 Packages [932 B]
Atteint http://ppa.launchpad.net trusty Release.gpg                            
Atteint http://archive.canonical.com trusty Release                            
Atteint http://security.ubuntu.com trusty-security Release                     
Ign http://extra.linuxmint.com qiana InRelease                                 
Réception de : 3 http://debian.qelectrotech.org unstable/main i386 Packages [938 B]
Ign http://packages.linuxmint.com qiana InRelease                              
Ign http://archive.ubuntu.com trusty-updates InRelease                         
Atteint http://archive.canonical.com trusty/partner amd64 Packages             
Atteint http://ppa.launchpad.net trusty Release                                
Atteint http://archive.canonical.com trusty/partner i386 Packages              
Réception de : 4 http://extra.linuxmint.com qiana Release.gpg [198 B]          
Atteint http://security.ubuntu.com trusty-security/main amd64 Packages         
Atteint http://archive.ubuntu.com trusty Release.gpg                           
Atteint http://ppa.launchpad.net trusty/main Sources                           
Réception de : 5 http://packages.linuxmint.com qiana Release.gpg [198 B]       
Atteint http://security.ubuntu.com trusty-security/restricted amd64 Packages   
Atteint http://ppa.launchpad.net trusty/main amd64 Packages                    
Réception de : 6 http://extra.linuxmint.com qiana Release [3 144 B]            
Réception de : 7 http://archive.ubuntu.com trusty-updates Release.gpg [933 B]  
Atteint http://security.ubuntu.com trusty-security/universe amd64 Packages     
Atteint http://ppa.launchpad.net trusty/main i386 Packages                     
Réception de : 8 http://packages.linuxmint.com qiana Release [18,6 kB]         
Atteint http://security.ubuntu.com trusty-security/multiverse amd64 Packages   
Atteint http://archive.ubuntu.com trusty Release                               
Réception de : 9 http://extra.linuxmint.com qiana/main amd64 Packages [7 904 B]
Atteint http://security.ubuntu.com trusty-security/main i386 Packages          
Atteint http://security.ubuntu.com trusty-security/restricted i386 Packages    
Réception de : 10 http://archive.ubuntu.com trusty-updates Release [58,5 kB]   
Réception de : 11 http://extra.linuxmint.com qiana/main i386 Packages [8 411 B]
Atteint http://security.ubuntu.com trusty-security/universe i386 Packages      
Réception de : 12 http://packages.linuxmint.com qiana/main amd64 Packages [30,3 kB]
Atteint http://security.ubuntu.com trusty-security/multiverse i386 Packages    
Réception de : 13 http://packages.linuxmint.com qiana/upstream amd64 Packages [23,6 kB]
Atteint http://security.ubuntu.com trusty-security/main Translation-en         
Atteint http://archive.ubuntu.com trusty/main amd64 Packages                   
Ign http://debian.qelectrotech.org unstable/main Translation-fr_FR             
Réception de : 14 http://packages.linuxmint.com qiana/import amd64 Packages [31,5 kB]
Ign http://debian.qelectrotech.org unstable/main Translation-fr                
Atteint http://archive.ubuntu.com trusty/restricted amd64 Packages             
Ign http://archive.canonical.com trusty/partner Translation-fr_FR              
Atteint http://security.ubuntu.com trusty-security/multiverse Translation-en   
Ign http://archive.canonical.com trusty/partner Translation-fr                 
Atteint http://archive.ubuntu.com trusty/universe amd64 Packages               
Ign http://debian.qelectrotech.org unstable/main Translation-en                
Ign http://archive.canonical.com trusty/partner Translation-en                 
Ign http://ppa.launchpad.net trusty/main Translation-fr_FR                     
Atteint http://archive.ubuntu.com trusty/multiverse amd64 Packages             
Ign http://ppa.launchpad.net trusty/main Translation-fr                        
Réception de : 15 http://packages.linuxmint.com qiana/main i386 Packages [29,7 kB]
Ign http://ppa.launchpad.net trusty/main Translation-en                        
Atteint http://security.ubuntu.com trusty-security/restricted Translation-en   
Atteint http://archive.ubuntu.com trusty/main i386 Packages                    
Atteint http://archive.ubuntu.com trusty/restricted i386 Packages              
Atteint http://security.ubuntu.com trusty-security/universe Translation-en     
Atteint http://archive.ubuntu.com trusty/universe i386 Packages                
Réception de : 16 http://packages.linuxmint.com qiana/upstream i386 Packages [23,6 kB]
Atteint http://archive.ubuntu.com trusty/multiverse i386 Packages              
Réception de : 17 http://packages.linuxmint.com qiana/import i386 Packages [31,6 kB]
Atteint http://archive.ubuntu.com trusty/main Translation-fr                   
Atteint http://archive.ubuntu.com trusty/main Translation-en                   
Atteint http://archive.ubuntu.com trusty/multiverse Translation-fr             
Ign http://extra.linuxmint.com qiana/main Translation-fr_FR                    
Atteint http://archive.ubuntu.com trusty/multiverse Translation-en             
Atteint http://archive.ubuntu.com trusty/restricted Translation-fr             
Ign http://extra.linuxmint.com qiana/main Translation-fr                       
Atteint http://archive.ubuntu.com trusty/restricted Translation-en             
Ign http://extra.linuxmint.com qiana/main Translation-en                       
Atteint http://archive.ubuntu.com trusty/universe Translation-fr               
Atteint http://archive.ubuntu.com trusty/universe Translation-en               
Ign http://security.ubuntu.com trusty-security/main Translation-fr_FR   
Ign http://security.ubuntu.com trusty-security/main Translation-fr      
Réception de : 18 http://archive.ubuntu.com trusty-updates/main amd64 Packages [275 kB]
Ign http://security.ubuntu.com trusty-security/multiverse Translation-fr_FR    
Ign http://security.ubuntu.com trusty-security/multiverse Translation-fr       
Ign http://security.ubuntu.com trusty-security/restricted Translation-fr_FR    
Ign http://security.ubuntu.com trusty-security/restricted Translation-fr       
Ign http://security.ubuntu.com trusty-security/universe Translation-fr_FR      
Ign http://security.ubuntu.com trusty-security/universe Translation-fr         
Réception de : 19 http://archive.ubuntu.com trusty-updates/restricted amd64 Packages [14 B]
Réception de : 20 http://archive.ubuntu.com trusty-updates/universe amd64 Packages [163 kB]
Réception de : 21 http://archive.ubuntu.com trusty-updates/multiverse amd64 Packages [7 392 B]
Réception de : 22 http://archive.ubuntu.com trusty-updates/main i386 Packages [272 kB]
Réception de : 23 http://archive.ubuntu.com trusty-updates/restricted i386 Packages [14 B]
Réception de : 24 http://archive.ubuntu.com trusty-updates/universe i386 Packages [164 kB]
Réception de : 25 http://archive.ubuntu.com trusty-updates/multiverse i386 Packages [7 587 B]
Atteint http://archive.ubuntu.com trusty-updates/main Translation-en           
Atteint http://archive.ubuntu.com trusty-updates/multiverse Translation-en     
Atteint http://archive.ubuntu.com trusty-updates/restricted Translation-en     
Atteint http://archive.ubuntu.com trusty-updates/universe Translation-en       
Ign http://packages.linuxmint.com qiana/import Translation-fr_FR               
Ign http://packages.linuxmint.com qiana/import Translation-fr                  
Ign http://packages.linuxmint.com qiana/import Translation-en                  
Ign http://packages.linuxmint.com qiana/main Translation-fr_FR                 
Ign http://packages.linuxmint.com qiana/main Translation-fr                    
Ign http://packages.linuxmint.com qiana/main Translation-en                    
Ign http://packages.linuxmint.com qiana/upstream Translation-fr_FR             
Ign http://packages.linuxmint.com qiana/upstream Translation-fr                
Ign http://packages.linuxmint.com qiana/upstream Translation-en                
Ign http://archive.ubuntu.com trusty/main Translation-fr_FR                    
Ign http://archive.ubuntu.com trusty/multiverse Translation-fr_FR              
Ign http://archive.ubuntu.com trusty/restricted Translation-fr_FR              
Ign http://archive.ubuntu.com trusty/universe Translation-fr_FR                
Ign http://archive.ubuntu.com trusty-updates/main Translation-fr_FR            
Ign http://archive.ubuntu.com trusty-updates/main Translation-fr               
Ign http://archive.ubuntu.com trusty-updates/multiverse Translation-fr_FR      
Ign http://archive.ubuntu.com trusty-updates/multiverse Translation-fr         
Ign http://archive.ubuntu.com trusty-updates/restricted Translation-fr_FR      
Ign http://archive.ubuntu.com trusty-updates/restricted Translation-fr         
Ign http://archive.ubuntu.com trusty-updates/universe Translation-fr_FR        
Ign http://archive.ubuntu.com trusty-updates/universe Translation-fr           
1 162 ko réceptionnés en 24s (47,4 ko/s)                                       
Lecture des listes de paquets... Fait
Installation des pilotes de l'imprimante
Téléchargement du fichier : mfc210clpr-1.0.2-1.i386.deb
--2014-07-30 16:38:13--  http://www.brother.com/pub/bsc/linux/dlf/mfc210clpr-1.0.2-1.i386.deb
Résolution de www.brother.com (www.brother.com)... 213.152.6.82, 213.152.6.75
Connexion vers www.brother.com (www.brother.com)|213.152.6.82|:80... connecté.
requête HTTP transmise, en attente de la réponse... 200 OK
Taille : 740022 (723K) [text/plain]
Enregistre : «./Packages/mfc210clpr-1.0.2-1.i386.deb»

100%[======================================>] 740 022      126KB/s   ds 5,7s   

2014-07-30 16:38:19 (126 KB/s) - «./Packages/mfc210clpr-1.0.2-1.i386.deb» enregistré [740022/740022]

Installation du fichier : mfc210clpr-1.0.2-1.i386.deb
Sélection du paquet mfc210clpr précédemment désélectionné.
(Lecture de la base de données... 173528 fichiers et répertoires déjà installés.)
Préparation du décompactage de .../mfc210clpr-1.0.2-1.i386.deb ...
Décompactage de mfc210clpr (1.0.2-1) ...
Paramétrage de mfc210clpr (1.0.2-1) ...
Téléchargement du fichier : cupswrapperMFC210C-1.0.2-3.i386.deb
--2014-07-30 16:38:20--  http://www.brother.com/pub/bsc/linux/dlf/cupswrapperMFC210C-1.0.2-3.i386.deb
Résolution de www.brother.com (www.brother.com)... 213.152.6.75, 213.152.6.82
Connexion vers www.brother.com (www.brother.com)|213.152.6.75|:80... connecté.
requête HTTP transmise, en attente de la réponse... 200 OK
Taille : 12224 (12K) [text/plain]
Enregistre : «./Packages/cupswrapperMFC210C-1.0.2-3.i386.deb»

100%[======================================>] 12 224      --.-K/s   ds 0,08s   

2014-07-30 16:38:21 (141 KB/s) - «./Packages/cupswrapperMFC210C-1.0.2-3.i386.deb» enregistré [12224/12224]

Installation du fichier : cupswrapperMFC210C-1.0.2-3.i386.deb
Sélection du paquet cupswrappermfc210c précédemment désélectionné.
(Lecture de la base de données... 173545 fichiers et répertoires déjà installés.)
Préparation du décompactage de .../cupswrapperMFC210C-1.0.2-3.i386.deb ...
Décompactage de cupswrappermfc210c (1.0.2-3) ...
Paramétrage de cupswrappermfc210c (1.0.2-3) ...
rm -f /usr/lib/cups/filter/brlpdwrapperMFC210C
 * Restarting Common Unix Printing System cupsd                          [ OK ] 
Installation des pilotes du scanner
Téléchargement du fichier : brscan2-0.2.5-1.amd64.deb
--2014-07-30 16:38:33--  http://www.brother.com/pub/bsc/linux/dlf/brscan2-0.2.5-1.amd64.deb
Résolution de www.brother.com (www.brother.com)... 213.152.6.75, 213.152.6.82
Connexion vers www.brother.com (www.brother.com)|213.152.6.75|:80... connecté.
requête HTTP transmise, en attente de la réponse... 200 OK
Taille : 82566 (81K) [text/plain]
Enregistre : «./Packages/brscan2-0.2.5-1.amd64.deb»

100%[======================================>] 82 566       127KB/s   ds 0,6s   

2014-07-30 16:38:34 (127 KB/s) - «./Packages/brscan2-0.2.5-1.amd64.deb» enregistré [82566/82566]

Installation du fichier : brscan2-0.2.5-1.amd64.deb
Sélection du paquet brscan2 précédemment désélectionné.
(Lecture de la base de données... 173550 fichiers et répertoires déjà installés.)
Préparation du décompactage de .../brscan2-0.2.5-1.amd64.deb ...
Décompactage de brscan2 (0.2.5-1) ...
Paramétrage de brscan2 (0.2.5-1) ...
Téléchargement du fichier : brscan-skey-0.2.4-1.amd64.deb
--2014-07-30 16:38:35--  http://www.brother.com/pub/bsc/linux/dlf/brscan-skey-0.2.4-1.amd64.deb
Résolution de www.brother.com (www.brother.com)... 213.152.6.75, 213.152.6.82
Connexion vers www.brother.com (www.brother.com)|213.152.6.75|:80... connecté.
requête HTTP transmise, en attente de la réponse... 200 OK
Taille : 50852 (50K) [text/plain]
Enregistre : «./Packages/brscan-skey-0.2.4-1.amd64.deb»

100%[======================================>] 50 852       138KB/s   ds 0,4s   

2014-07-30 16:38:36 (138 KB/s) - «./Packages/brscan-skey-0.2.4-1.amd64.deb» enregistré [50852/50852]

Installation du fichier : brscan-skey-0.2.4-1.amd64.deb
Sélection du paquet brscan-skey précédemment désélectionné.
(Lecture de la base de données... 173575 fichiers et répertoires déjà installés.)
Préparation du décompactage de .../brscan-skey-0.2.4-1.amd64.deb ...
Décompactage de brscan-skey (0.2.4-1) ...
Paramétrage de brscan-skey (0.2.4-1) ...
Téléchargement du fichier : brother-udev-rule-type1-1.0.0-1.all.deb
--2014-07-30 16:38:37--  http://www.brother.com/pub/bsc/linux/dlf/brother-udev-rule-type1-1.0.0-1.all.deb
Résolution de www.brother.com (www.brother.com)... 213.152.6.82, 213.152.6.75
Connexion vers www.brother.com (www.brother.com)|213.152.6.82|:80... connecté.
requête HTTP transmise, en attente de la réponse... 200 OK
Taille : 1490 (1,5K) [text/plain]
Enregistre : «./Packages/brother-udev-rule-type1-1.0.0-1.all.deb»

100%[======================================>] 1 490       --.-K/s   ds 0,002s  

2014-07-30 16:38:38 (770 KB/s) - «./Packages/brother-udev-rule-type1-1.0.0-1.all.deb» enregistré [1490/1490]

Installation du fichier : brother-udev-rule-type1-1.0.0-1.all.deb
Sélection du paquet brother-udev-rule-type1 précédemment désélectionné.
(Lecture de la base de données... 173583 fichiers et répertoires déjà installés.)
Préparation du décompactage de .../brother-udev-rule-type1-1.0.0-1.all.deb ...
Décompactage de brother-udev-rule-type1 (1.0.0-1) ...
Paramétrage de brother-udev-rule-type1 (1.0.0-1) ...
sudo gedit /etc/apt/sources.list.d/official-package-repositories.list

Merci.

#4 Re : -1 »  Script d'installation pour imprimantes Brother » Le 30/07/2014, à 17:17

galexis
Réponses : 2 756

Ci-joint le script modifié, comme on ne peut pas déposer de pièce jointe, je mets le contenu:

#!/bin/bash
# Script d'installation pour imprimantes Brother
# par demonipuch <demonipuch@gmail.com>

#########################################################################
# This program is free software: you can redistribute it and/or modify	#
# it under the terms of the GNU General Public License as published by	#
# the Free Software Foundation, either version 2 of the License, or     #
# (at your option) any later version.                                   #
#                                                                       #
# This program is distributed in the hope that it will be useful,       #
# but WITHOUT ANY WARRANTY; without even the implied warranty of        #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         #
# GNU General Public License for more details.                          #
#                                                                       #
# You should have received a copy of the GNU General Public License     #
# along with this program.  If not, see <http://www.gnu.org/licenses/>. #
#########################################################################

#################
### VARIABLES ###
#################

os=$(lsb_release -is)
codename=$(lsb_release -cs)
pwd=$(dirname $0)
arch=$(uname -m)
who=$(who -m|awk '{print $1}')
blue="\\033[1;34m"
green="\\033[1;32m"
red="\\033[1;31m"
resetcolor="\\033[0;0m"

#################
### FONCTIONS ###
#################

Log() {
# Créer un fichier de log du script
exec 9> ${pwd}/install.log
BASH_XTRACEFD=9
set -x
}

CheckZenity() {
# Vérifier la présence de zenity
dpkg -l | awk '{print $2}' | grep ^zenity$ 1>&2>/dev/null
if [[ $? == 0 ]] && [[ ! -z $DISPLAY ]]
	then
	InstallWizard="zenity"
else
	InstallWizard="whiptail"
fi
}

GetUID() {
# Afficher un message d'erreur si le script n'est pas lancé avec les droits nécessaires
if [[ $UID != "0" ]]; then
	echo -e ${red}"Veuillez lancer le script en tant que super-utilisateur :${resetcolor} sudo bash $0"
	exit 1
fi
}

#############################
### ASSISTANT EN MODE CLI ###
#############################

Help() {
# Afficher un message sur la navigation avec whiptail
whiptail --msgbox --backtitle="Script d'installation pour imprimantes Brother" --title="Aide" "Pour vous déplacer, utilisez les touches fléchées ou la touche Tab. Pour valider un choix, utilisez la touche Entrée." 9 70
}

CheckSourceList() {
case ${os} in
	Debian)
		repo="main"
		os="debian"
		rules="/lib/udev/rules.d/60-libsane.rules"
	;;
	Ubuntu)
		repo="universe"
		os="ubuntu"
		rules="/lib/udev/rules.d/40-libsane.rules"
	;;
	LinuxMint)
		case ${codename} in
			debian)
				os=""
				repo="main"
				rules="/lib/udev/rules.d/60-libsane.rules"
				sources="/etc/apt/sources.list"
			;;
			qiana)
				codename="trusty"
				os="ubuntu"
				repo="main"
				rules="/lib/udev/rules.d/60-libsane.rules"
				sources="/etc/apt/sources.list.d/official-package-repositories.list"
			;;
			petra)
				codename="saucy"
				os="ubuntu"
				repo="universe"
				rules="/lib/udev/rules.d/40-libsane.rules"
				sources="/etc/apt/sources.list.d/official-package-repositories.list"
			;;
			olivia)
				codename="raring"
				os="ubuntu"
				repo="universe"
				rules="/lib/udev/rules.d/40-libsane.rules"
				sources="/etc/apt/sources.list.d/official-package-repositories.list"
			;;
			nadia)
				codename="quantal"
				os="ubuntu"
				repo="universe"
				rules="/lib/udev/rules.d/40-libsane.rules"
				sources="/etc/apt/sources.list"
			;;
			maya)
				codename="precise"
				os="ubuntu"
				repo="universe"
				rules="/lib/udev/rules.d/40-libsane.rules"
				sources="/etc/apt/sources.list"
			;;
			lisa)
				codename="oneiric"
				os="ubuntu"
				repo="universe"
				rules="/lib/udev/rules.d/40-libsane.rules"
				sources="/etc/apt/sources.list"
			;;
			katya)
				codename="natty"
				os="ubuntu"
				repo="universe"
				rules="/lib/udev/rules.d/40-libsane.rules"
				sources="/etc/apt/sources.list"
			;;
			julia)
				codename="maverick"
				os="ubuntu"
				repo="universe"
				rules="/lib/udev/rules.d/40-libsane.rules"
				sources="/etc/apt/sources.list"
			;;
			isadora)
				codename="lucid"
				os="ubuntu"
				repo="universe"
				rules="/lib/udev/rules.d/40-libsane.rules"
				sources="/etc/apt/sources.list"
			;;
		esac
	;;
	elementary\ OS)
		repo="universe"
		os="ubuntu"
		if [[ ${codename} == "luna" ]]; then
			codename="precise"
		fi
		rules="/lib/dev/rules.d/40-libsane.rules"
	;;
esac
# Vérifier que le dépot qui contient le paquet ia32-libs est activé
if [[ ${arch} == "x86_64" || ${arch} == "amd64" ]]; then
	if [[ ! $(grep ${repo} ${sources} | grep -E "^deb http://(ftp.[a-z]{2}.|[a-z]{2}.|packages.)?(archive.ubuntu.com|debian.org|linuxmint.com)/(${os})?(/)? ${codename} ") ]]; then
		whiptail --msgbox --backtitle="Script d'installation pour imprimantes Brother" --title="Assistant" "Veuillez activer le dépôt ${repo} puis relancez le script." 9 70 3>&1 1>&2 2>&3
		exit 1
	fi
fi
}

GetModel() {
# Afficher une liste de familles d'imprimantes
model=$(whiptail --menu --backtitle="Script d'installation pour imprimantes Brother" --title="Assistant" "\nChoisissez la famille de votre imprimante :" 13 70 4 "DCP" "" "HL" "" "FAX" "" "MFC" "" 3>&1 1>&2 2>&3)
# Quitter si aucune sélection
if [[ -z ${model} ]]; then
	exit 1
fi
}

GetPrinter() {
# Afficher une liste de modèles d'imprimantes
printer=$(whiptail --menu --backtitle="Script d'installation pour imprimantes Brother" --title="Assistant" "\nChoisissez le modèle de votre imprimante :" 15 70 6 $(grep "${model}-" ${pwd}/url_printer_drivers|sed 's/$/ \r/g;s/#//g') 3>&1 1>&2 2>&3)
# Quitter si aucune sélection
if [[ -z ${printer} ]]; then
	exit 1
fi
}

GetConnectionType() {
# Demander le type de connexion (USB ou réseau)
connection=$(whiptail --menu --backtitle="Script d'installation pour imprimantes Brother" --title="Assistant" "\nChoisissez la connexion de votre imprimante :" 11 70 2 "USB" "" "Réseau" "" 3>&1 1>&2 2>&3)
# Quitter si aucune sélection
if [[ -z ${connection} ]]; then
	exit 1
# Aller demander l'IP si connexion réseau
elif [[ ${connection} == "Réseau" ]]; then
	GetIpAddress
fi
}

GetIpAddress() {
# Demander l'adresse IP de l'imprimante
ip=$(whiptail --inputbox --backtitle="Script d'installation pour imprimantes Brother" --title="Assistant" "\nEntrez l'adresse IP de votre imprimante :" 10 70 3>&1 1>&2 2>&3)
if [[ -z ${ip} ]]; then
	exit 1
fi
# Faire un test ping
tmp="/tmp/.brother"
for i in 0 25 50 75 100; do
	echo $i
	# Si le test est ok, créer un fichier temporaire
	if ping -w1 ${ip} > /dev/null; then
		touch /tmp/.brother
	fi

done | whiptail --gauge --backtitle="Script d'installation pour imprimantes Brother" --title="Assistant" "\nVérification de la connection vers ${ip}" 9 70 0 3>&1 1>&2 2>&3
# Afficher un message selon le resultat du test
if [[ -e ${tmp} ]]; then
	whiptail --msgbox --backtitle="Script d'installation pour imprimantes Brother" --title="Assistant" "Le test de connectivité a réussi." 9 70 0 3>&1 1>&2 2>&3
	rm ${tmp}
else
	whiptail --msgbox --backtitle="Script d'installation pour imprimantes Brother" --title="Assistant" "Le test de connectivité a échoué. L'assistant va se terminer." 9 70 0 3>&1 1>&2 2>&3
	exit 1
fi
}

ScanKeyToolsInstall() {
# Demander si on souhaite installer le paquet brscan-skey
whiptail --yesno --backtitle="Script d'installation pour imprimantes Brother" --title="Assistant" "Voulez-vous installer les outils Scan-Key?" 9 70 3>&1 1>&2 2>&3
if [[ $? == "0" ]]; then
	keytools="4"
else
	keytools="2"
fi
}

ConfirmInstall() {
# Demander une confirmation avant de lancer l'installation
case ${connection} in
	# Message pour installation USB
	USB)
	confirm=$(whiptail --yesno --backtitle="Script d'installation pour imprimantes Brother" --title="Assistant" "Confirmez l'installation de votre imprimante ${printer} connectée via USB?" 9 70 3>&1 1>&2 2>&3)
	;;
	# Message pour installation réseau
	Réseau)
	confirm=$(whiptail --yesno --backtitle="Script d'installation pour imprimantes Brother" --title="Assistant" "Confirmez l'installation de votre imprimante ${printer} connectée au réseau avec l'adresse IP ${ip}?" 9 70 3>&1 1>&2 2>&3)
	;;
esac
# Quitter le script si le choix est non
if [[ $? == 1 ]]; then
	exit 1
fi
}

#############################
### ASSISTANT EN MODE GUI ###
#############################

CheckSourceList_GUI() {
case ${os} in
	Debian)
		repo="main"
		os="debian"
		rules="/lib/udev/rules.d/60-libsane.rules"
	;;
	Ubuntu)
		repo="universe"
		os="ubuntu"
		rules="/lib/udev/rules.d/40-libsane.rules"
	;;
	LinuxMint)
		case ${codename} in
			debian)
				os=""
				repo="main"
				rules="/lib/udev/rules.d/60-libsane.rules"
				sources="/etc/apt/sources.list"
			;;
			qiana)
				codename="trusty"
				os="ubuntu"
				repo="universe"
				rules="/lib/udev/rules.d/40-libsane.rules"
				sources="/etc/apt/sources.list.d/official-package-repositories.list"
			;;
			petra)
				codename="saucy"
				os="ubuntu"
				repo="universe"
				rules="/lib/udev/rules.d/40-libsane.rules"
				sources="/etc/apt/sources.list.d/official-package-repositories.list"
			;;
			olivia)
				codename="raring"
				os="ubuntu"
				repo="universe"
				rules="/lib/udev/rules.d/40-libsane.rules"
				sources="/etc/apt/sources.list.d/official-package-repositories.list"
			;;
			nadia)
				codename="quantal"
				os="ubuntu"
				repo="universe"
				rules="/lib/udev/rules.d/40-libsane.rules"
				sources="/etc/apt/sources.list"
			;;
			maya)
				codename="precise"
				os="ubuntu"
				repo="universe"
				rules="/lib/udev/rules.d/40-libsane.rules"
				sources="/etc/apt/sources.list"
			;;
			lisa)
				codename="oneiric"
				os="ubuntu"
				repo="universe"
				rules="/lib/udev/rules.d/40-libsane.rules"
				sources="/etc/apt/sources.list"
			;;
			katya)
				codename="natty"
				os="ubuntu"
				repo="universe"
				rules="/lib/udev/rules.d/40-libsane.rules"
				sources="/etc/apt/sources.list"
			;;
			julia)
				codename="maverick"
				os="ubuntu"
				repo="universe"
				rules="/lib/udev/rules.d/40-libsane.rules"
				sources="/etc/apt/sources.list"
			;;
			isadora)
				codename="lucid"
				os="ubuntu"
				repo="universe"
				rules="/lib/udev/rules.d/40-libsane.rules"
				sources="/etc/apt/sources.list"
			;;
		esac
	;;
	"elementary OS")
		repo="universe"
		os="ubuntu"
		if [[ ${codename} == "luna" ]]; then
			codename="precise"
		fi
		rules="/lib/dev/rules.d/40-libsane.rules"
	;;
esac
# Afficher un message d'erreur si le dépôt Universe n'est pas activé
# Seulement pour Ubuntu 64 bits (ia32-libs)
if [[ ${arch} == "x86_64" || ${arch} == "amd64" ]]; then
	if [[ ! $(grep ${repo} ${sources} | grep -E "^deb http://(ftp.[a-z]{2}.|[a-z]{2}.|packages.)?(archive.ubuntu.com|debian.org|linuxmint.com)/(${os})?(/)? ${codename} ") ]]; then
		zenity --error --width=400 --title="Script d'installation pour imprimantes Brother" --text="Veuillez activer le dépôt ${repo} puis relancez le script."
		exit 1
	fi
fi
}

GetModel_GUI() {
# Afficher une liste de familles d'imprimantes
model=$(zenity --list --radiolist --width=400 --height=220 --title="Script d'installation pour imprimantes Brother" --text="Choisissez la famille de votre imprimante :\n" --column="" --column="" \
FALSE "DCP" \
FALSE "FAX" \
FALSE "HL" \
FALSE "MFC")
# Quitter si aucune sélection
if [[ -z ${model} ]]; then
	exit 1
fi
}

GetPrinter_GUI() {
# Afficher une liste de modèles d'imprimantes DCP
if [[ ${model} == "DCP" ]]; then
printer=$(zenity --list --radiolist --width=400 --height=400 --title="Script d'installation pour imprimantes Brother" --text="Choisissez le modèle de votre imprimante :\n" --column="" --column="" \
FALSE "DCP-1000" \
FALSE "DCP-110C" \
FALSE "DCP-115C" \
FALSE "DCP-117C" \
FALSE "DCP-120C" \
FALSE "DCP-130C" \
FALSE "DCP-135C" \
FALSE "DCP-1400" \
FALSE "DCP-145C" \
FALSE "DCP-150C" \
FALSE "DCP-1518" \
FALSE "DCP-153C" \
FALSE "DCP-155C" \
FALSE "DCP-163C" \
FALSE "DCP-165C" \
FALSE "DCP-167C" \
FALSE "DCP-185C" \
FALSE "DCP-195C" \
FALSE "DCP-197C" \
FALSE "DCP-310CN" \
FALSE "DCP-315CN" \
FALSE "DCP-330C" \
FALSE "DCP-340CW" \
FALSE "DCP-350C" \
FALSE "DCP-353C" \
FALSE "DCP-357C" \
FALSE "DCP-365CN" \
FALSE "DCP-373CW" \
FALSE "DCP-375CW" \
FALSE "DCP-377CW" \
FALSE "DCP-383C" \
FALSE "DCP-385C" \
FALSE "DCP-387C" \
FALSE "DCP-395CN" \
FALSE "DCP-540CN" \
FALSE "DCP-560CN" \
FALSE "DCP-585CW" \
FALSE "DCP-6690CW" \
FALSE "DCP-7010" \
FALSE "DCP-7020" \
FALSE "DCP-7025" \
FALSE "DCP-7030" \
FALSE "DCP-7040" \
FALSE "DCP-7045N" \
FALSE "DCP-7055" \
FALSE "DCP-7055W" \
FALSE "DCP-7057" \
FALSE "DCP-7057WR" \
FALSE "DCP-7060D" \
FALSE "DCP-7065DN" \
FALSE "DCP-7070DW" \
FALSE "DCP-750CW" \
FALSE "DCP-770CW" \
FALSE "DCP-8020" \
FALSE "DCP-8025D" \
FALSE "DCP-8040" \
FALSE "DCP-8045D" \
FALSE "DCP-8060" \
FALSE "DCP-8065DN" \
FALSE "DCP-8070D" \
FALSE "DCP-8080DN" \
FALSE "DCP-8085DN" \
FALSE "DCP-8110D" \
FALSE "DCP-8110DN" \
FALSE "DCP-8112DN" \
FALSE "DCP-8150DN" \
FALSE "DCP-8152DN" \
FALSE "DCP-8155DN" \
FALSE "DCP-8157DN" \
FALSE "DCP-8250DN" \
FALSE "DCP-9010CN" \
FALSE "DCP-9040CN" \
FALSE "DCP-9042CDN" \
FALSE "DCP-9045CDN" \
FALSE "DCP-9055CDN" \
FALSE "DCP-9270CDN" \
FALSE "DCP-J125" \
FALSE "DCP-J132W" \
FALSE "DCP-J140W" \
FALSE "DCP-J152W" \
FALSE "DCP-J172W" \
FALSE "DCP-J315W" \
FALSE "DCP-J4110DW" \
FALSE "DCP-J515W" \
FALSE "DCP-J525W" \
FALSE "DCP-J552DW" \
FALSE "DCP-J715W" \
FALSE "DCP-J725DW" \
FALSE "DCP-J752DW" \
FALSE "DCP-J925DW")
# Afficher une liste de modèles d'imprimantes FAX
elif [[ ${model} == "FAX" ]]; then
printer=$(zenity --list --radiolist --width=400 --height=400 --title="Script d'installation pour imprimantes Brother" --text="Choisissez le modèle de votre imprimante :\n" --column="" --column="" \
FALSE "FAX-1815C" \
FALSE "FAX-1820C" \
FALSE "FAX-1835C" \
FALSE "FAX-1840C" \
FALSE "FAX-1860C" \
FALSE "FAX-1920CN" \
FALSE "FAX-1940CN" \
FALSE "FAX-1960C" \
FALSE "FAX-2440C" \
FALSE "FAX-2480C" \
FALSE "FAX-2580C" \
FALSE "FAX-2820" \
FALSE "FAX-2840" \
FALSE "FAX-2850" \
FALSE "FAX-2890" \
FALSE "FAX-2900" \
FALSE "FAX-2920" \
FALSE "FAX-2940" \
FALSE "FAX-2950" \
FALSE "FAX-2990" \
FALSE "FAX-3800" \
FALSE "FAX-4100" \
FALSE "FAX-4750e" \
FALSE "FAX-5750e")
# Afficher une liste de modèles d'imprimantes HL
elif [[ ${model} == "HL" ]]; then
printer=$(zenity --list --radiolist --width=400 --height=400 --title="Script d'installation pour imprimantes Brother" --text="Choisissez le modèle de votre imprimante :\n" --column="" --column="" \
FALSE "HL-1030" \
FALSE "HL-1118" \
FALSE "HL-1230" \
FALSE "HL-1240" \
FALSE "HL-1250" \
FALSE "HL-1270" \
FALSE "HL-1430" \
FALSE "HL-1440" \
FALSE "HL-1450" \
FALSE "HL-1470N" \
FALSE "HL-1650" \
FALSE "HL-1670N" \
FALSE "HL-1850" \
FALSE "HL-1870N" \
FALSE "HL-2030" \
FALSE "HL-2035" \
FALSE "HL-2040" \
FALSE "HL-2070N" \
FALSE "HL-2130" \
FALSE "HL-2132" \
FALSE "HL-2135W" \
FALSE "HL-2140" \
FALSE "HL-2150N" \
FALSE "HL-2170W" \
FALSE "HL-2220" \
FALSE "HL-2230" \
FALSE "HL-2240" \
FALSE "HL-2240D" \
FALSE "HL-2242D" \
FALSE "HL-2250DN" \
FALSE "HL-2270DW" \
FALSE "HL-2280DW" \
FALSE "HL-2600CN" \
FALSE "HL-2700CN" \
FALSE "HL-3040CN" \
FALSE "HL-3045CN" \
FALSE "HL-3070CW" \
FALSE "HL-3075CW" \
FALSE "HL-3140CW" \
FALSE "HL-3150CDN" \
FALSE "HL-3150CDW" \
FALSE "HL-3170CDW" \
FALSE "HL-3260N" \
FALSE "HL-3450CN" \
FALSE "HL-4040CDN" \
FALSE "HL-4040CN" \
FALSE "HL-4050CDN" \
FALSE "HL-4070CDW" \
FALSE "HL-4140CN" \
FALSE "HL-4150CDN" \
FALSE "HL-4570CDW" \
FALSE "HL-4570CDWT" \
FALSE "HL-5030" \
FALSE "HL-5040" \
FALSE "HL-5050" \
FALSE "HL-5070N" \
FALSE "HL-5130" \
FALSE "HL-5140" \
FALSE "HL-5150D" \
FALSE "HL-5170DN" \
FALSE "HL-5240" \
FALSE "HL-5250DN" \
FALSE "HL-5270DN" \
FALSE "HL-5280DW" \
FALSE "HL-5340D" \
FALSE "HL-5350DN" \
FALSE "HL-5350DNLT" \
FALSE "HL-5370DW" \
FALSE "HL-5370DWT" \
FALSE "HL-5380DN" \
FALSE "HL-5440D" \
FALSE "HL-5450DN" \
FALSE "HL-5470DW" \
FALSE "HL-6050" \
FALSE "HL-6050D" \
FALSE "HL-6050DN" \
FALSE "HL-6180DW" \
FALSE "HL-S7000DN" \
FALSE "HL-7050" \
FALSE "HL-7050N" \
FALSE "HL-8050N")
# Afficher une liste de modèles d'imprimantes MFC
elif [[ ${model} == "MFC" ]]; then
printer=$(zenity --list --radiolist \
--width=400 --height=400 \
--title="Script d'installation pour imprimantes Brother" \
--text="Choisissez le modèle de votre imprimante :\n" \
--column="" --column="" \
FALSE "MFC-1810" \
FALSE "MFC-1810R" \
FALSE "MFC-1811" \
FALSE "MFC-1813" \
FALSE "MFC-1815" \
FALSE "MFC-1815R" \
FALSE "MFC-1818" \
FALSE "MFC-210C" \
FALSE "MFC-215C" \
FALSE "MFC-230C" \
FALSE "MFC-235C" \
FALSE "MFC-240C" \
FALSE "MFC-250C" \
FALSE "MFC-253CW" \
FALSE "MFC-255CW" \
FALSE "MFC-257CW" \
FALSE "MFC-260C" \
FALSE "MFC-290C" \
FALSE "MFC-295CN" \
FALSE "MFC-297C" \
FALSE "MFC-3220C" \
FALSE "MFC-3240C" \
FALSE "MFC-3320CN" \
FALSE "MFC-3340CN" \
FALSE "MFC-3360C" \
FALSE "MFC-3420C" \
FALSE "MFC-3820CN" \
FALSE "MFC-410CN" \
FALSE "MFC-420CN" \
FALSE "MFC-425CN" \
FALSE "MFC-440CN" \
FALSE "MFC-465CN" \
FALSE "MFC-4800" \
FALSE "MFC-490CW" \
FALSE "MFC-495CW" \
FALSE "MFC-5440CN" \
FALSE "MFC-5460CN" \
FALSE "MFC-5490CN" \
FALSE "MFC-5840CN" \
FALSE "MFC-5860CN" \
FALSE "MFC-5890CN" \
FALSE "MFC-5895CW" \
FALSE "MFC-620CN" \
FALSE "MFC-640CW" \
FALSE "MFC-6490CW" \
FALSE "MFC-660CN" \
FALSE "MFC-665CW" \
FALSE "MFC-6800" \
FALSE "MFC-680CN" \
FALSE "MFC-685CW" \
FALSE "MFC-6890CDW" \
FALSE "MFC-7220" \
FALSE "MFC-7225N" \
FALSE "MFC-7240" \
FALSE "MFC-7290" \
FALSE "MFC-7320" \
FALSE "MFC-7340" \
FALSE "MFC-7345N" \
FALSE "MFC-7360" \
FALSE "MFC-7360N" \
FALSE "MFC-7362N" \
FALSE "MFC-7365DN" \
FALSE "MFC-7420" \
FALSE "MFC-7440N" \
FALSE "MFC-7450" \
FALSE "MFC-7460DN" \
FALSE "MFC-7470D" \
FALSE "MFC-7820N" \
FALSE "MFC-7840N" \
FALSE "MFC-7840W" \
FALSE "MFC-7860DN" \
FALSE "MFC-7860DW" \
FALSE "MFC-790CW" \
FALSE "MFC-795CW" \
FALSE "MFC-820CW" \
FALSE "MFC-8220" \
FALSE "MFC-8370DN" \
FALSE "MFC-8380DN" \
FALSE "MFC-8420" \
FALSE "MFC-8440" \
FALSE "MFC-845CW" \
FALSE "MFC-8460N" \
FALSE "MFC-8480DN" \
FALSE "MFC-8500" \
FALSE "MFC-8510DN" \
FALSE "MFC-8512DN" \
FALSE "MFC-8515DN" \
FALSE "MFC-8520DN" \
FALSE "MFC-8640D" \
FALSE "MFC-8660DN" \
FALSE "MFC-8670DN" \
FALSE "MFC-8680DN" \
FALSE "MFC-8690DW" \
FALSE "MFC-8710DW" \
FALSE "MFC-8712DW" \
FALSE "MFC-8810DW" \
FALSE "MFC-8820D" \
FALSE "MFC-8840D" \
FALSE "MFC-885CW" \
FALSE "MFC-8860DN" \
FALSE "MFC-8870DW" \
FALSE "MFC-8880DN" \
FALSE "MFC-8890DW" \
FALSE "MFC-8910DW" \
FALSE "MFC-8912DW" \
FALSE "MFC-8950DW" \
FALSE "MFC-8952DW" \
FALSE "MFC-8952DWT" \
FALSE "MFC-9010CN" \
FALSE "MFC-9030" \
FALSE "MFC-9070" \
FALSE "MFC-9120CN" \
FALSE "MFC-9125CN" \
FALSE "MFC-9130CW" \
FALSE "MFC-9160" \
FALSE "MFC-9180" \
FALSE "MFC-9320CW" \
FALSE "MFC-9325CW" \
FALSE "MFC-9330CDW" \
FALSE "MFC-9340CDW" \
FALSE "MFC-9420CN" \
FALSE "MFC-9440CN" \
FALSE "MFC-9450CDN" \
FALSE "MFC-9460CDN" \
FALSE "MFC-9465CDN" \
FALSE "MFC-9560CDW" \
FALSE "MFC-9660" \
FALSE "MFC-9700" \
FALSE "MFC-9760" \
FALSE "MFC-9800" \
FALSE "MFC-9840CDW" \
FALSE "MFC-9860" \
FALSE "MFC-9880" \
FALSE "MFC-990CW" \
FALSE "MFC-9970CDW" \
FALSE "MFC-J220" \
FALSE "MFC-J2310" \
FALSE "MFC-J245" \
FALSE "MFC-J2510" \
FALSE "MFC-J265W" \
FALSE "MFC-J270W" \
FALSE "MFC-J280W" \
FALSE "MFC-J285DW" \
FALSE "MFC-J410" \
FALSE "MFC-J410W" \
FALSE "MFC-J415W" \
FALSE "MFC-J425W" \
FALSE "MFC-J430W" \
FALSE "MFC-J4310DW" \
FALSE "MFC-J432W" \
FALSE "MFC-J435W" \
FALSE "MFC-J4410DW" \
FALSE "MFC-J450DW" \
FALSE "MFC-J4510DW" \
FALSE "MFC-J4610DW" \
FALSE "MFC-J470DW" \
FALSE "MFC-J475DW" \
FALSE "MFC-J4710DW" \
FALSE "MFC-J5910DW" \
FALSE "MFC-J615W" \
FALSE "MFC-J625DW" \
FALSE "MFC-J630W" \
FALSE "MFC-J650DW" \
FALSE "MFC-J6510DW" \
FALSE "MFC-J6710DW" \
FALSE "MFC-J6910DW" \
FALSE "MFC-J825DW" \
FALSE "MFC-J835DW" \
FALSE "MFC-J850DW" \
FALSE "MFC-J870DW" \
FALSE "MFC-J875DW")
fi
# Quitter si aucune sélection
if [[ -z ${printer} ]]; then
	exit 1
fi
}

GetConnectionType_GUI() {
# Demander le type de connexion (USB ou réseau)
connection=$(zenity --list --radiolist --width=400 --height=180 --title="Script d'installation pour imprimantes Brother" --text="Choisissez la connexion de votre imprimante :\n" --column="" --column="" \
FALSE "USB" \
FALSE "Réseau")
# Quitter si aucune sélection
if [[ -z ${connection} ]]; then
	exit 1
fi
# Aller demander l'IP si connexion réseau
if [[ ${connection} == "Réseau" ]]; then
	GetIpAddress_GUI
fi
}

GetIpAddress_GUI() {
# Demander l'adresse IP de l'imprimante
ip=$(zenity --entry --width=400 --title="Script d'installation pour imprimantes Brother" --text="Entrez l'adresse IP de votre imprimante :\n")
# Faire un test ping
tmp="/tmp/.brother"
for i in 0 25 50 75 100; do
	echo $i
	# Si le test est ok, créer un fichier temporaire
	if ping -w1 ${ip} > /dev/null; then
		touch /tmp/.brother
	fi

done | zenity --progress --width=400 --title="Script d'installation pour imprimantes Brother" --text="Vérification de la connection vers ${ip}" --percentage=0 --no-cancel --auto-close
# Afficher un message selon le resultat du test
if [[ -e ${tmp} ]]; then
	zenity --info --width=400 --title="Script d'installation pour imprimantes Brother" --text="Le test de connectivité a réussi."
	rm ${tmp}
else
	zenity --error --width=400 --title="Script d'installation pour imprimantes Brother" --text="Le test de connectivité a échoué. Veuillez vérifier l'adresse IP de votre imprimante.\n\nL'assistant va se terminer."
	exit 1
fi
}

ScanKeyToolsInstall_GUI() {
# Ask if we want to install brscan-skey
zenity --question --width=400 --title="Script d'installation pour imprimantes Brother" --text="Voulez-vous installer les outils Scan-Key?"
if [[ $? == "0" ]]; then
	keytools="4"
else
	keytools="2"
fi
}

ConfirmInstall_GUI() {
# Demander une confirmation avant de lancer l'installation
case ${connection} in
	# Message pour installation USB
	USB)
	confirm=$(zenity --question --width=400 --title="Script d'installation pour imprimante Brother" --text="Confirmez l'installation de votre imprimante ${printer} connectée en USB?")
	;;
	# Message pour installation réseau
	Réseau)
	confirm=$(zenity --question --width=400 --title="Script d'installation pour imprimantes Brother" --text="Confirmez l'installation de votre imprimante ${printer} connectée au réseau avec l'adresse ${ip}?")
	;;
esac
# Quitter le script si le choix est non
if [[ $? == 1 ]]; then
	exit 1
fi
}

################################
### INSTALLATION DES PILOTES ###
################################

PreRequisites() {
clear
echo -e ${blue}"Installation des pré-requis"${resetcolor}
# Mettre à jour la liste des paquets
echo -e ${green}"Mise à jour de la liste des paquets"${resetcolor}
apt-get update 2>&9
# Installer le paquet cups (s'il n'est pas installé)
dpkg -l | awk '{print $2}' | grep ^cups$ 1>&9
if [[ $? != 0 ]]; then
	echo -e ${green}"Installation du paquet : cups"${resetcolor}
	apt-get install -y cups 2>&9
fi
# Installer le paquet sane-utils (s'il n'est pas installé)
dpkg -l | awk '{print $2}' | grep ^sane-utils$ 1>&9
if [[ $? != 0 ]]; then
	echo -e ${green}"Installation du paquet : sane-utils"${resetcolor}
	apt-get install -y sane-utils 2>&9
fi
# Installer le paquet ia32-libs (s'il n'est pas installé)
# Seulement pour Ubuntu 64 bits
if [[ ${arch} == "x86_64" || ${arch} == "amd64" ]]; then
	dpkg -l | awk '{print $2}' | grep ^ia32-libs$ 1>&9
	if [[ $? != 0 ]]; then
		echo -e ${green}"Installation du paquet : ia32-libs"${resetcolor}
		apt-get install -y ia32-libs 2>&9
	fi
fi
# AppArmor
apparmor=$(which aa-complain)
if [[ -x ${apparmor} ]]; then
	echo -e ${green}"Profil AppArmor pour CUPS : mode complain"${resetcolor}
	${apparmor} cupsd 2>&9
fi
# Créer un lien symbolique /etc/init.d/lpd ~> /etc/init.d/cups (s'il n'existe pas)
# Seulement pour les imprimantes suivantes
for i in DCP-1000 DCP-1400 DCP-8020 DCP-8025D DCP-8040 DCP-8045D DCP-8060 DCP-8065DN FAX-2850 FAX-2900 FAX-3800 FAX-4100 FAX-4750e FAX-5750e HL-1030 HL-1230 HL-1240 HL-1250 HL-1270N HL-1430 HL-1440 HL-1450 HL-1470N HL-1650 HL-1670N HL-1850 HL-1870N HL-5030 HL-5040 HL-5050 HL-5070N HL-5130 HL-5140 HL-5150D HL-5170DN HL-5240 HL-5250DN HL-5270DN HL-5280DW HL-6050 HL-6050D MFC-4800 MFC-6800 MFC-8420 MFC-8440 MFC-8460N MFC-8500 MFC-8660DN MFC-8820D MFC-8840D MFC-8860DN MFC-8870DW MFC-9030 MFC-9070 MFC-9160 MFC-9180 MFC-9420CN MFC-9660 MFC-9700 MFC-9760 MFC-9800 MFC-9860 MFC-9880; do
	if [[ ${printer} == "$i" ]] && [[ ! -L /etc/init.d/lpd ]]; then
		echo -e ${green}"Création d'un lien symbolique : /etc/init.d/lpd ~> /etc/init.d/cups"${resetcolor}
		ln -s /etc/init.d/cups /etc/init.d/lpd 2>&9
	fi
done
# Installer le paquet csh (s'il n'est pas installé)
# Seulement pour les imprimantes suivantes
for i in DCP-110C DCP-115C DCP-117C DCP-120C DCP-310CN DCP-315CN DCP-340CW FAX-1815C FAX-1820C FAX-1835C FAX-1840C FAX-1920CN FAX-1940CN FAX-2440C MFC-210C MFC-215C MFC-3220C MFC-3240C MFC-3320CN MFC-3340CN MFC-3420C MFC-3820CN MFC-410CN MFC-420CN MFC-425CN MFC-5440CN MFC-5840CN MFC-620CN MFC-640CW MFC-820CW; do
	if [[ ${printer} == "$i" ]] && [[ ! -x /bin/csh ]]; then
		echo -e ${green}"Installation du paquet : csh"${resetcolor}
		apt-get install -y csh 2>&9
	fi
done
# Créer le dossier /var/spool/lpd (s'il n'existe pas)
if [[ ! -d /var/spool/lpd ]]; then
	echo -e ${green}"Création du dossier : /var/spool/lpd"${resetcolor}
	mkdir -p /var/spool/lpd 2>&9
fi
# Créer le dossier /usr/share/cups/model (s'il n'existe pas)
if [[ ! -d /usr/share/cups/model ]]; then
	echo -e ${green}"Création du dossier : /usr/share/cups/model"${resetcolor}
	mkdir -p /usr/share/cups/model  2>&9
fi
}

PrinterInstall() {
# Chercher les pilotes de l'imprimante
if grep -q "${printer}" ${pwd}/url_printer_drivers; then
	echo -e ${blue}"Installation des pilotes de l'imprimante"${resetcolor}
	case ${printer} in
		# Cas d'installation MFC-8220
		MFC-8220)
		echo -e ${green}"Téléchargement du fichier : BR8220_2_GPL.ppd.gz"${resetcolor}
		wget -cP ${pwd}/Packages http://www.brother.com/pub/bsc/linux/dlf/BR8220_2_GPL.ppd.gz
		echo -e ${green}"Installation du fichier : BR8220_2_GPL.ppd"${resetcolor}
		gzip -fd ${pwd}/Packages/BR8220_2_GPL.ppd.gz
		cp ${pwd}/Packages/BR8220_2_GPL.ppd /usr/share/cups/model
		chmod 644 /usr/share/cups/model/BR8220_2_GPL.ppd
		chown root:root /usr/share/cups/model/BR8220_2_GPL.ppd
		ln -sf /usr/share/cups/model/BR8220_2_GPL.ppd /usr/share/ppd/BR8220_2_GPL.ppd
		;;
		# Cas d'installation MFC-8640D
		MFC-8640D)
		echo -e ${green}"Téléchargement du fichier : BR8640_2_GPL.ppd.gz"${resetcolor}
		wget -cP ${pwd}/Packages http://www.brother.com/pub/bsc/linux/dlf/BR8640_2_GPL.ppd.gz
		echo -e ${green}"Installation du fichier : BR8640_2_GPL.ppd"${resetcolor}
		gzip -fd ${pwd}/Packages/BR8640_2_GPL.ppd.gz
		cp ${pwd}/Packages/BR8640_2_GPL.ppd /usr/share/cups/model
		chmod 644 /usr/share/cups/model/BR8640_2_GPL.ppd
		chown root:root /usr/share/cups/model/BR8640_2_GPL.ppd
		ln -sf /usr/share/cups/model/BR8640_2_GPL.ppd /usr/share/ppd/BR8640_2_GPL.ppd
		;;
		# Cas d'installation HL-2460 et HL 2460N
		HL-2460|HL-2460N)
		echo -e ${green}"Téléchargement du fichier : BRHL24_2_GPL.ppd.gz"${resetcolor}
		wget -cP ${pwd}/Packages http://www.brother.com/pub/bsc/linux/dlf/BRHL24_2_GPL.ppd.gz
		echo -e ${green}"Installation du fichier : BRHL24_2_GPL.ppd"${resetcolor}
		gzip -fd ${pwd}/Packages/BRHL24_2_GPL.ppd.gz
		cp ${pwd}/Packages/BRHL24_2_GPL.ppd /usr/share/cups/model
		chmod 644 /usr/share/cups/model/BRHL24_2_GPL.ppd
		chown root:root /usr/share/cups/model/BRHL24_2_GPL.ppd
		ln -sf /usr/share/cups/model/BRHL24_2_GPL.ppd /usr/share/ppd/BRHL24_2_GPL.ppd
		;;
		# Cas d'installation HL-2600CN
		HL-2600CN)
		echo -e ${green}"Téléchargement du fichier : BR2600CN_GPL.ppd.gz"${resetcolor}
		wget -cP ${pwd}/Packages http://www.brother.com/pub/bsc/linux/dlf/BR2600CN_GPL.ppd.gz
		echo -e ${green}"Installation du fichier : BR2600CN_GPL.ppd"${resetcolor}
		gzip -fd ${pwd}/Packages/BR2600CN_GPL.ppd.gz
		cp ${pwd}/Packages/BR2600CN_GPL.ppd /usr/share/cups/model
		chmod 644 /usr/share/cups/model/BR2600CN_GPL.ppd
		chown root:root /usr/share/cups/model/BR2600CN_GPL.ppd
		ln -sf /usr/share/cups/model/BR2600CN_GPL.ppd /usr/share/ppd/BR2600CN_GPL.ppd
		;;
		# Cas d'installation HL-2700CN
		HL-2700CN)
		echo -e ${green}"Téléchargement du fichier : BR2700CN_GPL.ppd.gz"${resetcolor}
		wget -cP ${pwd}/Packages http://www.brother.com/pub/bsc/linux/dlf/BR2700_2_GPL.ppd.gz
		echo -e ${green}"Installation du fichier : BR2700CN_GPL.ppd"${resetcolor}
		gzip -fd ${pwd}/Packages/BR2700_2_GPL.ppd.gz
		cp ${pwd}/Packages/BR2700_2_GPL.ppd /usr/share/cups/model
		chmod 644 /usr/share/cups/model/BR2700_2_GPL.ppd
		chown root:root /usr/share/cups/model/BR2700_2_GPL.ppd
		ln -sf /usr/share/cups/model/BR2700_2_GPL.ppd /usr/share/ppd/BR2700_2_GPL.ppd
		;;
		# Cas d'installation HL-3260N
		HL-3260N)
		echo -e ${green}"Téléchargement du fichier : BRHL32_3_GPL.ppd.gz"${resetcolor}
		wget -cP ${pwd}/Packages http://www.brother.com/pub/bsc/linux/dlf/BRHL32_3_GPL.ppd.gz
		echo -e ${green}"Installation du fichier : BRHL32_3_GPL.ppd"${resetcolor}
		gzip -fd ${pwd}/Packages/BRHL32_3_GPL.ppd.gz
		cp ${pwd}/Packages/BRHL32_3_GPL.ppd /usr/share/cups/model
		chmod 644 /usr/share/cups/model/BRHL32_3_GPL.ppd
		chown root:root /usr/share/cups/model/BRHL32_3_GPL.ppd
		ln -sf /usr/share/cups/model/BRHL32_3_GPL.ppd /usr/share/ppd/BRHL32_3_GPL.ppd
		;;
		# Cas d'installation HL-3450CN
		HL-3450CN)
		echo -e ${green}"Téléchargement du fichier : BR3450CN_GPL.ppd.gz"${resetcolor}
		wget -cP ${pwd}/Packages http://www.brother.com/pub/bsc/linux/dlf/BR3450CN_GPL.ppd.gz
		echo -e ${green}"Installation du fichier : BR3450CN_GPL.ppd"${resetcolor}
		gzip -fd ${pwd}/Packages/BR3450CN_GPL.ppd.gz
		cp ${pwd}/Packages/BR3450CN_GPL.ppd /usr/share/cups/model
		chmod 644 /usr/share/cups/model/BR3450CN_GPL.ppd
		chown root:root /usr/share/cups/model/BR3450CN_GPL.ppd
		ln -sf /usr/share/cups/model/BR3450CN_GPL.ppd /usr/share/ppd/BR3450CN_GPL.ppd
		;;
		# Cas d'installation HL-7050 et HL-7050N
		HL-7050|HL-7050N)
		echo -e ${green}"Téléchargement du fichier : BR7050_2_GPL.ppd.gz"${resetcolor}
		wget -cP ${pwd}/Packages http://www.brother.com/pub/bsc/linux/dlf/BR7050_2_GPL.ppd.gz
		echo -e ${green}"Installation du fichier : BR7050_2_GPL.ppd"${resetcolor}
		gzip -fd ${pwd}/Packages/BR7050_2_GPL.ppd.gz
		cp ${pwd}/Packages/BR7050_2_GPL.ppd /usr/share/cups/model
		chmod 644 /usr/share/cups/model/BR7050_2_GPL.ppd
		chown root:root /usr/share/cups/model/BR7050_2_GPL.ppd
		ln -sf /usr/share/cups/model/BR7050_2_GPL.ppd /usr/share/ppd/BR7050_2_GPL.ppd
		;;
		# Cas d'intallation HL-S7000DN
		HL-S7000DN)
		echo -e ${green}"Téléchargement du fichier : BRP7000E_GPL.PPD.gz"${resetcolor}
		wget -cP ${pwd}/Packages http://www.brother.com/pub/bsc/linux/dlf/BRP7000E_GPL.PPD.gz
		echo -e {green}"Installation du fichier : BRP7000E_GPL.PPD"${resetcolor}
		gzip -fd ${pwd}/Packages/BRP7000E_GPL.PPD.gz
		cp ${pwd}/Packages/BRP7000E_GPL.PPD /usr/share/cups/model/BRP7000E_GPL.ppd
		chmod 644 /usr/share/cups/model/BRP7000E_GPL.ppd
		chown root:root /usr/share/cups/model/BRP7000E_GPL.ppd
		ln -sf /usr/share/cups/model/BRP700E_GPL.ppd /usr/share/ppd/BRP7000E_GPL.ppd
		;;
		# Cas d'installation HL-8050N
		HL-8050N)
		echo -e ${green}"Téléchargement du fichier : BR8050_2_GPL.ppd.gz"${resetcolor}
		wget -cP ${pwd}/Packages http://www.brother.com/pub/bsc/linux/dlf/BR8050_2_GPL.ppd.gz
		echo -e ${green}"Installation du fichier : BR8050_2_GPL.ppd.gz"${resetcolor}
		gzip -fd ${pwd}/Packages/BR8050_2_GPL.ppd.gz
		cp ${pwd}/Packages/BR8050_2_GPL.ppd /usr/share/cups/model
		chmod 644 /usr/share/cups/model/BR8050_2_GPL.ppd
		chown root:root /usr/share/cups/model/BR8050_2_GPL.ppd
		ln -sf /usr/share/cups/model/BR8050_2_GPL.ppd /usr/share/ppd/BR8050_2_GPL.ppd
		;;
		# Cas d'installation des autres modèles
		*)
		n=0
		for url in $(grep -A 2 ${printer} ${pwd}/url_printer_drivers|grep -v ${printer}); do
			package[${n}]=$(basename ${url})
			echo -e ${green}"Téléchargement du fichier : $(basename ${url})"${resetcolor}
			wget -cP ${pwd}/Packages ${url}
			echo -e ${green}"Installation du fichier : $(basename ${url})"${resetcolor}
			dpkg -i --force-all "${pwd}/Packages/$(basename ${url})" 2>&9
			n=${n}+1
		done
		;;
	esac
	# Configurer l'imprimante
	PrinterConfig
fi
}

ScannerInstall() {
# Chercher les pilotes du scanner
if grep -q "${printer}" ${pwd}/url_scanner_drivers; then
	echo -e ${blue}"Installation des pilotes du scanner"${resetcolor}
	case ${arch} in
		# Cas d'installation 32 bits
		i386|i486|i686)
			for url in $(grep -A ${keytools} ${printer} ${pwd}/url_scanner_drivers|grep "i386"); do
				echo -e ${green}"Téléchargement du fichier : $(basename ${url})"${resetcolor}
				wget -cP ${pwd}/Packages ${url}
				echo -e ${green}"Installation du fichier : $(basename ${url})"${resetcolor}
				dpkg -i --force-all "${pwd}/Packages/$(basename ${url})" 2>&9
			done
		;;
		# Cas d'installation 64 bits
		x86_64|amd64)
			for url in $(grep -A ${keytools} ${printer} ${pwd}/url_scanner_drivers|grep "amd64"); do
				echo -e ${green}"Téléchargement du fichier : $(basename ${url})"${resetcolor}
				wget -cP ${pwd}/Packages ${url}
				echo -e ${green}"Installation du fichier : $(basename ${url})"${resetcolor}
				dpkg -i --force-all "${pwd}/Packages/$(basename ${url})" 2>&9
			done
		;;
	esac
	# Télécharge et installe le paquet brother-udev-rule-type1-1.0.0-1.all.deb
	url="http://www.brother.com/pub/bsc/linux/dlf/brother-udev-rule-type1-1.0.0-1.all.deb"
	echo -e ${green}"Téléchargement du fichier : $(basename ${url})"${resetcolor}
	wget -cP ${pwd}/Packages ${url}
	echo -e ${green}"Installation du fichier : $(basename ${url})"${resetcolor}
	dpkg -i "${pwd}/Packages/$(basename ${url})" 2>&9
	# Configurer le scanner
	ScannerConfig
fi
}

FaxInstall() {
# Chercher les pilotes du fax
if grep -q "${printer}" ${pwd}/url_fax_drivers; then
	echo -e ${blue}"Installation des pilotes du fax"${resetcolor}
	# Installation des pilotes
	for url in $(grep -A 2 ${printer} ${pwd}/url_fax_drivers|grep -v ${printer}); do
		echo -e ${green}"Téléchargement du fichier : $(basename ${url})"${resetcolor}
		wget -cP ${pwd}/Packages ${url}
		echo -e ${green}"Installation du fichier : $(basename ${url})"${resetcolor}
		dpkg -i --force-all "${pwd}/Packages/$(basename ${url})" 2>&9
	done
	# Configurer le fax
	FaxConfig
fi
}

PrinterConfig() {
# Obtenir le nom de l'imprimante
printername=$(echo ${printer}|sed 's/'-'//g'|tr [a-z] [A-Z])
# Chercher le fichier ppd à utiliser
case ${printer} in
	# MFC-8220
	MFC-8220)
	ppd="/usr/share/cups/model/BR8220_2_GPL.ppd"
	;;
	# HL-2406 et HL-2460N
	HL-2460|HL-2460N)
	ppd="/usr/share/cups/model/BRHL24_2_GPL.ppd"
	;;
	# HL-2600CN
	HL-2600CN)
	ppd="/usr/share/cups/model/BR2600CN_GPL.ppd"
	;;
	# HL-2700CN
	HL-2700CN)
	ppd="/usr/share/cups/model/BR2700_2_GPL.ppd"
	;;
	# HL-3260N
	HL-3260N)
	ppd="/usr/share/cups/model/BRHL32_3_GPL.ppd"
	;;
	# HL-3450CN
	HL-3450CN)
	ppd="/usr/share/cups/model/BR3450CN_GPL.ppd"
	;;
	# HL-S7000DN
	HL-S7000DN)
	ppd="/usr/share/cups/model/BRP7000E_GPL.ppd"
	;;
	# HL-7050 et HL-7050N
	HL-7050|HL-7050N)
	ppd="/usr/share/cups/model/BR7050_2_GPL.ppd"
	;;
	# HL-8050N
	HL-8050N)
	ppd="/usr/share/cups/model/BR8050_2_GPL.ppd"
	;;
	# DCP-115C, DCP-117C, DCP-120C, DCP-315CN, DCP-340CW, MFC-210C, MFC-215C, MFC-425CN, MFC-640CW et MFC-820CW
	DCP-115C|DCP-117C|DCP-120C|DCP-315CN|DCP-340CW|MFC-210C|MFC-215C|MFC-425CN|MFC-640CW|MFC-820CW)
	ppd="/usr/share/cups/model/brmfc210c_cups.ppd"
	;;
	# Tous les autres modèles
	*)
	ppd=$(find /usr/share/cups/model -iname *${printername}*) 2>&9
	if [[ -z ${ppd} ]]; then
		ppd=$(find /opt/brother/Printers -iname *${printername}*) 2>&9
	fi
	;;
esac
# Régler le problème des imprimantes utilisant le même pilote que la MFC-210C
# en supprimant l'imprimante nommée MFC210C
case ${printer} in
	DCP-115C|DCP-117C|DCP-120C|DCP-315CN|DCP-340CW|MFC-215C|MFC-425CN|MFC-640CW|MFC-820CW)
	lpadmin -x MFC210C 2>&9
	;;
# Régler le problème des imprimantes utilisant le même pilote que la MFC-1818
# en supprimant l'imprimante nommée MFC1818
	MFC-1810|MFC-1810R|MFC-1811|MFC-1815|MFC-1815R)
	lpadmin -x MFC-1818 2>&9
	;;
esac
# Ajouter l'imprimante
case ${connection} in
	# Imprimante USB
	USB)
	lpadmin -p ${printername} -E -v usb://Brother/${printer} -P ${ppd} 2>&9
	;;
	# Imprimante réseau
	Réseau)
	lpadmin -p ${printername} -E -v lpd://${ip}/binary_p1 -P ${ppd} 2>&9
	;;
esac
# Chercher l'executable pour configurer les options de l'imprimante
brprintconf=$(for num in 0 1; do dpkg --contents ${pwd}/Packages/${package[${num}]} | awk '{print $6}' | grep brprintconf | sed 's/^.\//\//'; done)
case ${brprintconf} in
        /usr/bin/brprintconf)
            ${brprintconf} -P ${printername} -pt A4 2>&9
        ;;
        /usr/bin/brprintconfij)
            ${brprintconf} -P ${printername} -pt A4 2>&9
        ;;
        /usr/bin/brprintconfij2)
			${brprintconf} -P ${printername} -pt A4 2>&9
        ;;
        /usr/bin/brprintconfcl1)
                ${brprintconf} -P ${printername} -pt A4 2>&9
        ;;
        /usr/bin/brprintconflsr2)
                ${brprintconf} -P ${printername} -pt A4 2>&9
        ;;
        *)
                ${brprintconf} -pt A4 2>&9 || ${brprintconf} -Paper A4 2>&9
        ;;
esac
}

ScannerConfig() {
# Dans le cas d'un scanner USB
if [[ ${connection} == "USB" ]]; then
	# Ajouter une règle udev (s'il elle n'existe pas déjà)
	if [[ ! $(grep -q "Brother" ${rules}) ]]; then
		echo -e '\n# Brother\nATTRS{idVendor}=="04f9", ENV{libsane_matched}="yes"'|tee -a ${rules}  1>&9
	fi
# Dans le cas d'un scanner réseau
elif [[ ${connection} == "Réseau" ]]; then
	# Ajouter une entrée pour le scanner réseau
	# brsaneconfig
	if [[ -x /usr/bin/brsaneconfig ]]; then
		brsaneconfig -a name="SCANNER" model="${printer}" ip=${ip} 2>&9
	# brsaneconfig2
	elif [[ -x /usr/bin/brsaneconfig2 ]]; then
		brsaneconfig2 -a name="SCANNER" model="${printer}" ip=${ip} 2>&9
	# brsaneconfig3
	elif [[ -x /usr/bin/brsaneconfig3 ]]; then
		brsaneconfig3 -a name="SCANNER" model="${printer}" ip=${ip} 2>&9
	# brsaneconfig4
	elif [[ -x /usr/bin/brsaneconfig4 ]]; then
		sed -i '/Support Model/a\
0x029a, 117, 1, "MFC-8690DW", 133, 4\
0x0279, 14, 2, "DCP-J525W"\
0x027b, 13, 2, "DCP-J725DW"\
0x027d, 13, 2, "DCP-J925DW"\
0x027f, 14, 1, "MFC-J280W"\
0x028f, 13, 1, "MFC-J425W"\
0x0281, 13, 1, "MFC-J430W"\
0x0280, 13, 1, "MFC-J435W"\
0x0282, 13, 1, "MFC-J625DW"\
0x0283, 13, 1, "MFC-J825DW"\
0x028d, 13, 1, "MFC-J835DW"' /usr/local/Brother/sane/Brsane4.ini 2>&9
		brsaneconfig4 -a name="SCANNER" model="${printer}" ip=${ip} 2>&9
	fi
fi
FixScannerConfig
}

FaxConfig() {
# Modifier les permissions du fichier brfaxfilter
if [[ -e /usr/lib/cups/filter/brfaxfilter ]]; then
	chmod 755 /usr/lib/cups/filter/brfaxfilter 2>&9
	service cups restart 2>&9
fi
# Définir l'URI du fax
case ${connection} in
	# Fax USB
	USB)
		lpadmin -p BRFAX -v usb://Brother/${printer} 2>&9
	;;
	# Fax réseau
	Réseau)
		lpadmin -p BRFAX -v lpd://${ip}/binary_p1 2>&9
	;;
esac
}

FixScannerConfig() {
# Régler le problème de scanner pour Ubuntu 64 bits >= 11.10
if [[ "${codename}" == "oneiric" || "${codename}" == "precise" || "${codename}" == "quantal"  || "${codename}" == "raring" ]] && [[ ${arch} == "x86_64" ]]; then
	# brscan
	if [[ -e /usr/bin/brsaneconfig ]]; then
		cp /usr/lib64/libbrcolm.so.1.0.1 /usr/lib/
		cp /usr/lib64/libbrscandec.so.1.0.0 /usr/lib/
		cp /usr/lib64/sane/libsane-brother.so.1.0.7 /usr/lib/sane/
		cp /usr/lib64/sane/libsane-brother.so /usr/lib/sane/
		cp /usr/lib64/sane/libsane-brother.so.1 /usr/lib/sane/
		cp /usr/lib64/libbrscandec.so.1 /usr/lib/
		cp /usr/lib64/libbrcolm.so /usr/lib/
		cp /usr/lib64/libbrcolm.so.1 /usr/lib/
		cp /usr/lib64/libbrscandec.so /usr/lib/
	# brscan2
	elif [[ -e /usr/bin/brsaneconfig2 ]]; then
		cp /usr/lib64/libbrscandec2.so.1.0.0  /usr/lib/
		cp /usr/lib64/sane/libsane-brother2.so.1.0.7 /usr/lib/sane/
		cp /usr/lib64/sane/libsane-brother2.so.1 /usr/lib/sane/
		cp /usr/lib64/sane/libsane-brother2.so /usr/lib/sane/
		cp /usr/lib64/libbrcolm2.so.1.0.1 /usr/lib/
		cp /usr/lib64/libbrcolm2.so /usr/lib/
		cp /usr/lib64/libbrscandec2.so.1 /usr/lib/
		cp /usr/lib64/libbrscandec2.so /usr/lib/
		cp /usr/lib64/libbrcolm2.so.1 /usr/lib/
	# Brother a mis à jour les paquets brscan3 et brscan4
	# il n'y a plus besoin de copier les librairies
	# 
	# brscan3
	#	elif [[ -e /usr/bin/brsaneconfig3 ]]; then
	#		cp /usr/lib64/libbrscandec3.so.1.0.0 /usr/lib/
	#		cp /usr/lib64/sane/libsane-brother3.so.1.0.7 /usr/lib/sane/
	#		cp /usr/lib64/sane/libsane-brother3.so.1 /usr/lib/sane/
	#		cp /usr/lib64/sane/libsane-brother3.so /usr/lib/sane/
	#		cp /usr/lib64/libbrscandec3.so /usr/lib/
	#		cp /usr/lib64/libbrscandec3.so.1 /usr/lib/
	# brscan4
	#elif [[ -x /usr/bin/brsaneconfig4 ]]; then
	#	cp /usr/lib64/sane/libsane-brother4.so.1.0.7 /usr/lib/sane/
	#	cp /usr/lib64/sane/libsane-brother4.so /usr/lib/sane/
	#	cp /usr/lib64/sane/libsane-brother4.so.1 /usr/lib/sane/
	fi
fi
}


# Installation en mode Console
Cli() {
Help
CheckSourceList
GetModel
GetPrinter
GetConnectionType
if grep -q "${printer}" ${pwd}/url_scanner_drivers; then
	ScanKeyToolsInstall
fi
ConfirmInstall
}

# Installation en mode GUI
Gui() {
CheckSourceList_GUI
GetModel_GUI
GetPrinter_GUI
GetConnectionType_GUI
if grep -q "${printer}" ${pwd}/url_scanner_drivers; then
	ScanKeyToolsInstall_GUI
fi
ConfirmInstall_GUI
}

##############
### SCRIPT ###
##############

GetUID
Log
CheckZenity
case ${InstallWizard} in
	# Utiliser l'assistant d'installation en mode "console"
	whiptail)
		Cli
	;;
	# Utiliser l'assistant d'installation en mode "GUI"
	zenity)
		Gui
	;;
esac
PreRequisites
PrinterInstall
ScannerInstall
FaxInstall
# Ré-attribution du propriétaire des fichiers du dossier brother
chown -R ${who}:${who} ${pwd}
# Vider le cache "sudo"
sudo -k

exit 0

Ce script modifié est allé jusqu'au bout pour ma DCP-115C sous LM17-64bits.

L'imprimante fonctionne mais le scanner toujours pas !!!

#5 Re : -1 »  Script d'installation pour imprimantes Brother » Le 30/07/2014, à 18:23

galexis
Réponses : 2 756

Je note un problème xsane me dit que le scanner est branché en "brother2:bus2;dev1" alors que quand je fait

lsusb
.....
Bus 003 Device 004: ID 04f9:018c Brother Industries, Ltd DCP-115C
....

N'est pas là le problème ? comment peut-on corriger les adresse que prennent les périphériques USB ?

#6 Re : -1 »  Script d'installation pour imprimantes Brother » Le 30/07/2014, à 19:33

galexis
Réponses : 2 756

J'ai pourtant toujours réussit à le faire fonctionner jusqu'à présent .... dernière installation réussit : LM13.

#8 -1 »  Pas de son Intel 9D70 et pas de sortie HDMi » Le 19/03/2016, à 22:50

galexis
Réponses : 17

Bonjour,
je suis sous linuxmint 17.3 basée sur Ubuntu 14.04.
Kernel 4.2.0-34.
Je n'ai plus de son dans les hauts-parleurs depuis que j'ai essayé le driver libre Nvidia.
Le son fonctionne dans le casque.

lspci | grep Audio
00:1f.3 Audio device: Intel Corporation Device 9d70 (rev 21)
cat /proc/asound/pcm00-00: ALC233 Analog : ALC233 Analog : playback 1 : capture 1

Je ne comprends pas vraiment si la carte son est une Intel ou une Realytek
J'ai tenté plusieurs choses, mais rien ne semble fonctionner. DAns Alsamixer tout semble OK.
Merci pour votre aide.

#9 Re : -1 »  Pas de son Intel 9D70 et pas de sortie HDMi » Le 20/03/2016, à 10:24

galexis
Réponses : 17

Bonjour,
après un redémarrage le son est revenu.
En revanche, quand je connecte la sortie HDMi à la télé, je n'ai pas de sortie audio HDMi qui s'ajoute dans le choix des cartes son, et je ne peut donc pas envoyer le son sur la télé.
Merci.

#10 Re : -1 »  Pas de son Intel 9D70 et pas de sortie HDMi » Le 20/03/2016, à 16:12

galexis
Réponses : 17

Je connais la façon de procéder pour l'HDMi, mais la carte son HDMi n'est pas dans la liste.
Merci.

#11 Re : -1 »  Pas de son Intel 9D70 et pas de sortie HDMi » Le 20/03/2016, à 16:59

galexis
Réponses : 17

Le résultat pour la partie audio:

id:	
multimedia
description: 	Audio device
produit: 	Intel Corporation
fabriquant: 	Intel Corporation
identifiant matériel: 	
1f.3
information bus: 	
pci@0000:00:1f.3
version: 	21
bits: 	64 bits
horloge: 	33MHz
fonctionnalités: 	pm msi bus_master cap_list
configuration:	
driver	=	snd_hda_intel
latency	=	32
ressources:	
irq	:	133
mémoire	:	94420000-94423fff
mémoire	:	94410000-9441ffff

#12 Re : -1 »  Pas de son Intel 9D70 et pas de sortie HDMi » Le 20/03/2016, à 20:42

galexis
Réponses : 17

Pas plus de réglage HDMi avec pavucontrol.

Le contenu du fichier /proc/asound/devices

  1:        : sequencer
  2: [ 0]   : control
  3: [ 0- 0]: digital audio playback
  4: [ 0- 0]: digital audio capture
  5: [ 0- 0]: hardware dependent
 33:        : timer

et la commande

aplay -D plughw:2,9 /usr/share/sounds/alsa/Front_Center.wav
ALSA lib pcm_hw.c:1667:(_snd_pcm_hw_open) Invalid value for card
aplay: main:722: erreur à l'ouverture audio: Aucun fichier ou dossier de ce type

#13 Re : -1 »  Pas de son Intel 9D70 et pas de sortie HDMi » Le 20/03/2016, à 21:40

galexis
Réponses : 17
galexis a écrit :

Pas plus de réglage HDMi avec pavucontrol.

Le contenu du fichier /proc/asound/devices

  1:        : sequencer
  2: [ 0]   : control
  3: [ 0- 0]: digital audio playback
  4: [ 0- 0]: digital audio capture
  5: [ 0- 0]: hardware dependent
 33:        : timer

et la commande

aplay -D plughw:2,9 /usr/share/sounds/alsa/Front_Center.wav
ALSA lib pcm_hw.c:1667:(_snd_pcm_hw_open) Invalid value for card
aplay: main:722: erreur à l'ouverture audio: Aucun fichier ou dossier de ce type

Rien ne correspond à l'HDMi dans le fichier devices...

#14 Re : -1 »  Pas de son Intel 9D70 et pas de sortie HDMi » Le 20/03/2016, à 22:23

galexis
Réponses : 17

pareil:

~ $ aplay -D plughw:3,4 /usr/share/sounds/alsa/Front_Center.wav
ALSA lib pcm_hw.c:1667:(_snd_pcm_hw_open) Invalid value for card
aplay: main:722: erreur à l'ouverture audio: Aucun fichier ou dossier de ce type

#15 Re : -1 »  Pas de son Intel 9D70 et pas de sortie HDMi » Le 21/03/2016, à 08:09

galexis
Réponses : 17

Alsa-utils : oui, mais asoundconf-gtk n'est pas dans les dépots linuxmint et gnome-alsamixer n'est pas installé.
Merci.

#16 Re : -1 »  Pas de son Intel 9D70 et pas de sortie HDMi » Le 21/03/2016, à 19:33

galexis
Réponses : 17

Oui, mais pour le moment c'est sans succès ni pistes.

#17 Re : -1 »  Pas de son Intel 9D70 et pas de sortie HDMi » Le 21/03/2016, à 21:09

galexis
Réponses : 17

C'est déjà fait, et le problème est le même. sad

#18 -1 »  [Resolu]Bash: aide pour trie d'un tableau » Le 07/03/2016, à 19:55

galexis
Réponses : 3

Bonjour,
j'ai fait un script qui récupérère des données dans un fichier xml et les mets dans un tableau.
Chaque ligne est composée de:
- un nom (des lettres et chiffres, 2 points, et des chiffres). exemple XC1:2
- différente s informations toutes séparées de ";"
Ce qui donne:

XA:10;4;B17;310;513 
XA:11;4;F12;;510 
XA:12;4;F14;514;517 
XA:13;4;F15;515;518 
XA:14;4;F17;516;519 
XA:1;4;B5;310;501;501;501 
XA:15;6;B14;310;702 
XA:16;6;F14;705;706 
XA:17;9;D3;1001;1002 
XA:18;9;D7;1009;1010 
XA:19;9;D9;1011;1012 
XA:20;9;D11;1014;1015 
XA:21;9;D14;1017;1018 
XA:22;9;B17;;1021 
XA:23;9;G17;;1022 
XA:24;7;F4;801;806 
XA:2;4;B8;310;505;505 
XA:25;7;F5;802;805 

Je souhaite trier toutes ces données par le nom:
- d'abord par les XA1 dans l'ordre alphabétique
- ensuite par les nombres après les 2 points dans l'ordre croissant.
J'utilise la commande:

bornier_trie=( $(printf "%s\n" ${bornier[*]} | sort -d -f -t:) )

Le problème qu'on voit ci-dessus, c'est que XA:10 11 12 sont avant XA:1.

Comment améliorer cela ?
Merci.
Cordialement.

#19 Re : -1 »  [Resolu]Bash: aide pour trie d'un tableau » Le 07/03/2016, à 21:14

galexis
Réponses : 3
XA:1;4;B5;310;501;501;501
XA:2;4;B8;310;505;505
XA:3;4;F5;_;503
XA:4;4;F3;503;504
XA:5;4;F6;_;503
XA:6;4;F8;506;508
XA:8;4;B14;310;511
XA:9;4;B15;310;512
XA:10;4;B17;310;513
XA:11;4;F12;;510
XA:12;4;F14;514;517
XA:13;4;F15;515;518
XA:14;4;F17;516;519
XA:15;6;B14;310;702
XA:16;6;F14;705;706
XA:17;9;D3;1001;1002
XA:18;9;D7;1009;1010
XA:19;9;D9;1011;1012

Merci ! Nickel !

#20 -1 »  Aide pour script sur fichier XML et CSV » Le 16/07/2015, à 19:14

galexis
Réponses : 1

Bonjour,
j'ai besoin d'extraire les données d'un fichier XML et de sauvegarder ces données dans un fichier CSV.
J'ai besoin d'extraire du fichier suivant (extrait de fichier):

<project title="" version="0.5" folioSheetQuantity="0">
             <element x="80" y="330" type="embed://import/bornes-cables/borne_simple.elmt" orientation="0" uuid="{697707f9-8748-4261-be66-76a5960819bb}">
                <terminals>
                    <terminal number="_" x="0" y="-6" orientation="0" id="1" nameHidden="0" name="_"/>
                    <terminal number="_" x="0" y="6" orientation="2" id="2" nameHidden="0" name="_"/>
                </terminals>
                <inputs>
                    <input x="-1" text="X3.6" y="3"/>
                </inputs>
                <elementInformations>
                    <elementInformation show="1" name="label">X3.6</elementInformation>
                </elementInformations>
            </element>
            <element x="730" y="330" type="embed://import/bornes-cables/borne_simple.elmt" orientation="0" uuid="{45da3bc2-fd5d-4b15-a5f9-a78483286769}">
                <terminals>
                    <terminal number="_" x="0" y="-6" orientation="0" id="3" nameHidden="0" name="_"/>
                    <terminal number="_" x="0" y="6" orientation="2" id="4" nameHidden="0" name="_"/>
                </terminals>
                <inputs>
                    <input x="-1" text="X4.2" y="3"/>
                </inputs>
                <elementInformations>
                    <elementInformation show="1" name="label">X4.2</elementInformation>
                </elementInformations>
            </element>

        <conductors>
            <conductor terminal1="0" displaytext="1" terminal2="24" onetextperfolio="0" x="0" num="_" y="0" horizrotatetext="0" type="multi" numsize="6" vertirotatetext="270"/>
            <conductor terminal1="26" displaytext="1" terminal2="19" onetextperfolio="0" x="0" num="123456789" y="0" horizrotatetext="0" type="multi" numsize="6" vertirotatetext="270"/>
            <conductor terminal1="30" displaytext="1" terminal2="15" onetextperfolio="0" x="0" num="02468" y="0" horizrotatetext="0" type="multi" numsize="6" vertirotatetext="270"/>
        </conductors>

données:
1: dans la section /project/diagram/elements/element: type (exemple: type="embed://import/bornes-cables/borne_simple.elmt")
2: dans la section /project/diagram/elements/element/elementInformations/elementInformations: name="label" (exemple: name="label">X4.2)
3: dans la section /project/diagram/elements/element/terminals/terminal: les idx2 (exemple: id="3")

je souhaite mettre les résultats en forme: donnée1;donnée2;donnée3.

Je bloque sur la récupération des données 2 id. Je fait:

xmlstarlet sel -T -t -m /project/diagram/elements/element -s D:N:- "elementInformations" -v "concat(elementInformations,'|',@type,'|',@id)" -n /le_fichier_xml.xml

exemple de résultat:

  X4.2
                |embed://import/bornes-cables/borne_simple.elmt|

je n'arrive pas à récupérer les numéro d'id.

Ensuite, je souhaite enregistrer tous les résultats dans un fichier csv, et là, j'ai beau chercher du côté de awk entre autre : pas de résultat.

Merci pour votre aide.
Cordialement.

#21 Re : -1 »  Aide pour script sur fichier XML et CSV » Le 17/07/2015, à 12:50

galexis
Réponses : 1

J'ai un peu avancé sur la commande xmlstarlet :

xmlstarlet sel -T -t -m /project/diagram/elements/element -s A:T:- "elementInformations" -v \
"concat(elementInformations/*[@name='label'],';',@type,';', terminal/@id)" -n le_fichier_xml.xml > fichier_csv.csv

le retour est;:

X4.2;embed://import/bornes-cables/borne_simple.elmt;

il manque encore les numéro de id. J'arrive à les récupérer séparément:

xmlstarlet sel -T -t -m /project/diagram/elements/element/terminals -s A:N:- "@id" -v "(terminal/@id)" -n le_fichier_xml.xml )

mais pas à le faire en même temps ...

#22 -1 »  Logitech Wireless speaker adapter bluetooth » Le 15/12/2013, à 18:03

galexis
Réponses : 4

Bonjour,
je suis sous LM16 et je souhaite configurer un boitier Logitech bluetooth pour envoyer de la musique sur des haut-parleurs. Voir ici.
J'ai réussit à appairer mon dongle bluetooth Asus avec le boitier Logitech, en modifiant le fichier /etc/bluetooth/audio.conf comme suit:

# Configuration file for the audio service

# This section contains options which are not specific to any
# particular interface
[General]
Enable=Source
Enable=Socket

# Switch to master role for incoming connections (defaults to true)
#Master=true

# If we want to disable support for specific services
# Defaults to supporting all implemented services
#Disable=Gateway,Source,Socket

# SCO routing. Either PCM or HCI (in which case audio is routed to/from ALSA)
# Defaults to HCI
SCORouting=PCM

# Automatically connect both A2DP and HFP/HSP profiles for incoming
# connections. Some headsets that support both profiles will only connect the
# other one automatically so the default setting of true is usually a good
# idea.
AutoConnect=true

# Headset interface specific options (i.e. options which affect how the audio
# service interacts with remote headset devices)
[Headset]

# Set to true to support HFP, false means only HSP is supported
# Defaults to true
HFP=true

# Maximum number of connected HSP/HFP devices per adapter. Defaults to 1
MaxConnected=1

# Set to true to enable use of fast connectable mode (faster page scanning)
# for HFP when incoming call starts. Default settings are restored after
# call is answered or rejected. Page scan interval is much shorter and page
# scan type changed to interlaced. Such allows faster connection initiated
# by a headset.
FastConnectable=false

# Just an example of potential config options for the other interfaces
#[A2DP]
SBCSources=1
MPEG12Sources=0

Maintenant, il faut faire en sorte que "l'ensemble apparaissent" comme une carte son dans pulseaudio.
J'ai créé le fichier ./.asoundrc

pcm.bluetooth {
        type bluetooth
        device C8:84:47:15:85:A3
        profile "auto"
}

mais cela ne fonctionne pas.
Comment paramétrer touot ça ?
Merci pour votre aide.
Cordialement.
Alexis

#23 Re : -1 »  Logitech Wireless speaker adapter bluetooth » Le 27/12/2013, à 20:13

galexis
Réponses : 4

Quand je fais:

hciconfig
hci0:	Type: BR/EDR  Bus: USB
	BD Address: 5C:F3:70:02:D6:A9  ACL MTU: 1022:8  SCO MTU: 121:3
	UP RUNNING PSCAN ISCAN 
	RX bytes:514 acl:0 sco:0 events:25 errors:0
	TX bytes:832 acl:0 sco:0 commands:25 errors:0

En revanche quand je fais:

hcitool scan

Il ne me retourne rien, il ne vois pas le boitier.
Merci pour votre aide.
Alexis

#24 Re : -1 »  Logitech Wireless speaker adapter bluetooth » Le 03/03/2014, à 19:43

galexis
Réponses : 4

Bonsoir,
problème toujours pas résolu.
Petite avancée cependant : je suis passé de LM16 à LM13 pour des raisons de cartes graphiques et là j'arrive à réaliser la connexion bluetooth, à sélectionner le boitier comme carte graphique.
Les tests intégrés à l'interface de sélection de carte son (qui dit :"one two one two) fonctionne. Mais quand j'envoie du son venat d'un mp3, le son est tout saccadé et la connexion finit pas planter.