Last active
August 29, 2015 14:13
-
-
Save demofly/e58150c2fec6fb81e005 to your computer and use it in GitHub Desktop.
Как настроить автоустановку Windows 7 драйверов по клику на сетевой принтер для HP LJ CP1215 на Qnap TS559 (samba+cups)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Для нормальной работы на моем Qnap нужно временно поставить сторонний софт | |
| ipkg install samba34 | |
| ipkg install cups | |
| После достижения конечной цели - следует снести! | |
| 1. Берем ноут с виндой и воткнутым настроенным расшаренным принтером. | |
| Заходим в свойства и в разделе "Доступ" -> "Дополнительные драйверы", проставляем галочки на x86 и x64. Кормим диск с дровами. | |
| Опрашиваем: | |
| # rpcclient -Uuser%pass -c 'getdriver ИмяПошаренногоПринтера 3' IPмашиныСВиндойИПринтером | |
| rpcclient -Uuser%pass -c 'getdriver CP1215 3' 192.168.0.198 | |
| Получаем (сохраняем в файл - дальше будем списывать под кальку!): | |
| [Windows NT x86] | |
| Printer Driver Info 3: | |
| Version: [3] | |
| Driver Name: [HP Color LaserJet CP1215] | |
| Architecture: [Windows NT x86] | |
| Driver Path: [\\192.168.0.198\print$\W32X86\3\SDcp1215.DLL] | |
| Datafile: [\\192.168.0.198\print$\W32X86\3\SDcp1215.SDD] | |
| Configfile: [\\192.168.0.198\print$\W32X86\3\SUcp1215.DLL] | |
| Helpfile: [\\192.168.0.198\print$\W32X86\3\SDcp1215.CHM] | |
| Dependentfiles: [\\192.168.0.198\print$\W32X86\3\PPcp1215.DLL] | |
| Dependentfiles: [\\192.168.0.198\print$\W32X86\3\GCcp1215.DLL] | |
| Dependentfiles: [\\192.168.0.198\print$\W32X86\3\SUcp1215.VER] | |
| Dependentfiles: [\\192.168.0.198\print$\W32X86\3\SUcp1215.ent] | |
| Dependentfiles: [\\192.168.0.198\print$\W32X86\3\cp1215PQ.dll] | |
| Dependentfiles: [\\192.168.0.198\print$\W32X86\3\HPAppUsg.dll] | |
| Monitorname: [(null)] | |
| Defaultdatatype: [RAW] | |
| [Windows x64] | |
| Printer Driver Info 3: | |
| Version: [3] | |
| Driver Name: [HP Color LaserJet CP1215] | |
| Architecture: [Windows x64] | |
| Driver Path: [\\192.168.0.198\print$\x64\3\SDcp1215.DLL] | |
| Datafile: [\\192.168.0.198\print$\x64\3\SDcp1215.SDD] | |
| Configfile: [\\192.168.0.198\print$\x64\3\SUcp1215.DLL] | |
| Helpfile: [\\192.168.0.198\print$\x64\3\SDcp1215.CHM] | |
| Dependentfiles: [\\192.168.0.198\print$\x64\3\PPcp1215.DLL] | |
| Dependentfiles: [\\192.168.0.198\print$\x64\3\GCcp1215.DLL] | |
| Dependentfiles: [\\192.168.0.198\print$\x64\3\SUcp1215.VER] | |
| Dependentfiles: [\\192.168.0.198\print$\x64\3\SUcp1215.ent] | |
| Dependentfiles: [\\192.168.0.198\print$\x64\3\cp1215PQ.dll] | |
| Dependentfiles: [\\192.168.0.198\print$\x64\3\HPAppUsg.dll] | |
| Monitorname: [CP1215LM] | |
| Defaultdatatype: [RAW] | |
| 2. Разрешаем запись в шары печати rpc юзеру и разрешаем ему не иметь своих дров: | |
| https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/classicalprinting.html#id2623935 | |
| [printers] | |
| printable = yes | |
| printing = CUPS | |
| guest ok = yes | |
| path = /var/spool/smb | |
| #use client driver = yes | |
| # | |
| use client driver = no | |
| writable = no | |
| browsable = no | |
| [print$] | |
| comment = Printer Drivers | |
| path = /share/MD0_DATA/Metashare/print | |
| browseable = yes | |
| guest ok = no | |
| read only = no | |
| writeable = yes | |
| write list = root,admin,user | |
| Затем рестартуем samba. На моем Qnap это так: | |
| /etc/init.d/smb.sh restart | |
| 3. Перетыкаем принтер в cups. Настройку cups тут мы пропустим. Замечу только конфиг самбы: | |
| [global] | |
| map to guest = bad user | |
| printcap cache time = 0 | |
| printcap name = cups | |
| printing = cups | |
| show add printer wizard = no | |
| load printers = yes | |
| 4. Идем на винду в C:\Windows\System32\spool\drivers\x64\PCC и забираем содержимое файла hpcp1215.inf_amd64_neutral_18b6055066470f3f.cab в | |
| /share/MD0_DATA/Metashare/print/x64 | |
| В папку /share/MD0_DATA/Metashare/print/W32X86/3/ копируем содержимое C:\Windows\System32\spool\drivers\W32X86\3 | |
| 5. Выпекаем строку согласно стандарта (https://lists.samba.org/archive/samba/2004-January/079262.html) на основе конфиг-дампа шары винды. | |
| LongDriverName:DriverFileName:DataFileName:ConfigFileName:HelpFileName:LanguageMonitorName:DefaultDataType:Comma-Separated-list-of-Files | |
| #Зависимые файлы в хвосте собрал так | |
| cat cp1215-3.txt | grep x64 | grep Dependentfiles | cut -d\\ -f7 | cut -d] -f1 | tr -s '\n' ',' | |
| # Для NT/2000/XP/Vista/7 x86 получается так: | |
| rpcclient -Uuser%pass -c 'adddriver "Windows NT x86" "HPCP1215:SDcp1215.DLL:SDcp1215.SDD:SUcp1215.DLL:SDcp1215.CHM:CP1215LM:RAW:PPcp1215.DLL,GCcp1215.DLL,SUcp1215.VER,SUcp1215.ent,cp1215PQ.dll,HPAppUsg.dll"' localhost | |
| # Для NT/2000/XP/Vista/7 x64 то же самое получается, только имя архитектуры другое: | |
| rpcclient -Uuser%pass -c 'adddriver "Windows x64" "HPCP1215:SDcp1215.DLL:SDcp1215.SDD:SUcp1215.DLL:SDcp1215.CHM:CP1215LM:RAW:PPcp1215.DLL,GCcp1215.DLL,SUcp1215.VER,SUcp1215.ent,cp1215PQ.dll,HPAppUsg.dll"' localhost | |
| #Активируем драйвер | |
| rpcclient -Uuser%pass -c 'setdriver SipuCatPR2 HPCP1215' localhost | |
| #Смотрим на результат | |
| rpcclient -Uuser%pass -c 'enumprinters' localhost | |
| flags:[0x800000] | |
| name:[\\LOCALHOST\SipuCatPR2] | |
| description:[\\LOCALHOST\SipuCatPR2,HPCP1215,SipuCatPR2] | |
| comment:[SipuCatPR2] | |
| 6. Закрываем запись в шары печати rpc юзеру: | |
| https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/classicalprinting.html#id2623935 | |
| [printers] | |
| printable = yes | |
| printing = CUPS | |
| guest ok = yes | |
| path = /var/spool/smb | |
| use client driver = yes | |
| # | |
| #use client driver = no | |
| writable = no | |
| browsable = no | |
| [print$] | |
| comment = Printer Drivers | |
| path = /share/MD0_DATA/Metashare/print | |
| browseable = yes | |
| guest ok = no | |
| read only = no | |
| #writeable = yes | |
| write list = root | |
| Затем рестартуем samba. На моем Qnap это так: | |
| /etc/init.d/smb.sh restart | |
| * Пример возни http://www.linuxtopia.org/online_books/network_administration_guides/samba_reference_guide/29_CUPS-printing_105.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment