Advertisement
orcainbox

brotherPrinter

Jun 1st, 2020
413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 142.78 KB | None | 0 0
  1.  
  2. [CODE]#! /bin/bash
  3. #
  4. # Copyright(c) 2011-2018 Brother Industries, Ltd.
  5. # All Rights Reserved.
  6. #
  7. #Brother retains any and all copyrights to the Software.
  8. #In no case this Agreement shall be construed to assign
  9. #or otherwise transfer from Brother to User any copyrights
  10. #or other intellectual property rights to whole or any part
  11. #of the Software.
  12. #
  13. #Brother grants User a non-exclusive license: to reproduce
  14. #and/or distribute (via Internet or in any other manner) the
  15. #Software. Further, Brother grants User a non-exclusive
  16. #license to modify, alter, translate or otherwise prepare
  17. #derivative works of the Software and to reproduce and
  18. #distribute (via Internet or in any other manner) such
  19. #modification, alteration, translation or other derivative
  20. #works for any purpose.
  21. #
  22. #The license of the Software from Brother hereunder is
  23. #granted "AS IS." BROTHER HEREBY DISCLAIMS ANY WARRANTIES WITH
  24. # RESPECT TO THE SOFTWARE, EXPRESS OR IMPLIED, INCLUDING
  25. #BUT NOT LIMITED TO WARRANTY FOR THE QUALITY, MERCHANTABILITY,
  26. #FITNESS FOR PARTICULAR PURPOSE OR NON-INFRINGEMENT.
  27. #Brother shall have no liability in contract, tort (including
  28. #negligence or breach of statutory duty) or otherwise for any
  29. #interruption of use, loss of data, or for any indirect,
  30. #incidental, punitive or consequential loss or damage, or for
  31. #any loss of profit, revenue, data, goodwill or anticipated
  32. #savings that arises under, out of, or in contemplation of
  33. #this Agreement or otherwise arises due to any error, inaccuracy
  34. #or defect in the Software even if Brother has been advised of
  35. #the possibility of such loss or damage.
  36. #Further, Brother shall have no liability to disclose and/or
  37. #distribute the source cord of the Software to User under any
  38. #circumstances. In no case shall the above license by Brother
  39. #to modify, alter, translate or otherwise prepare derivative
  40. #works of the Software be construed as Brother's implied
  41. #agreement or undertakings to disclose and/or distribute the
  42. #source cord of the Software.
  43.  
  44.  
  45. DEBUG_MSG=0
  46. MSG=1
  47.  
  48.  
  49. COLOR='\033[1;31m'
  50. COLOR2='\033[1;35m'
  51. COLOR3='\033[1;32m'
  52. COLOR4='\033[1;34m'
  53. MONO='\033[1;0m'
  54.  
  55. if [ "$(echo $0 | grep linux-brjprinter-installer)" = '' ];then
  56. MESSAGE010="USAGE: "
  57. MESSAGE012=" : "
  58. MESSAGE020=" model"
  59. MESSAGE030=" -f model"
  60. MESSAGE040=" -l "
  61. MESSAGE050="Only root can perform this operation."
  62. MESSAGE060="CUPS is not installed."
  63. MESSAGE070="Do you want to specify a PROXY server? [y/N] ->"
  64. MESSAGE080="Enter the URL of the PROXY server."
  65. MESSAGE090=" ex http://(proxy-server-url):(port)"
  66. MESSAGE100=" ex http://(login-name):(password)@(proxy-server-url):(port)"
  67. MESSAGE110=" ->"
  68. MESSAGE120="Unable to get the server information."\
  69. " Please check the network settings."
  70. MESSAGE121="Input model name ->"
  71. MESSAGE122="Rpm or dpkg is required."
  72. MESSAGE130="Driver-packages cannot be found."
  73. MESSAGE140=" Confirm the model name."
  74. MESSAGE150="You are going to install following packages."
  75. MESSAGE160="OK? [y/N] ->"
  76. MESSAGE165="OK? [Y/n] ->"
  77. MESSAGE170="Do you agree? [Y/n] ->"
  78. MESSAGE180="Do you agree? [Y/n] ->"
  79. MESSAGE182="The security level of SELinux has been temporarily lowered "\
  80. "to enable the test print."\
  81. " To set it permanently, modify the SELinux configuration file."
  82. MESSAGE184="The security level of AppArmor has been lowered."\
  83. " (aa-complain cups)"
  84. MESSAGE190="Will you specify the Device URI? [Y/n] ->"
  85. MESSAGE200="Specify IP address."
  86. MESSAGE201="Auto."
  87. MESSAGE210="select the number of destination Device URI. ->"
  88. MESSAGE220=" enter IP address ->"
  89. MESSAGE230="Test Print? [y/N] ->"
  90. MESSAGE240="Hit Enter/Return key."
  91. MESSAGE250="csh/tcsh is required"
  92. MESSAGE260="The security level of SELinux has been lowered."\
  93. " (semanage permissive -a cupsd_t)"
  94. MESSAGE270="glibc.i686/libstdc++ is requored."\
  95. MESSAGE280="wget is required."
  96. else
  97. MESSAGE010="使用方法: "
  98. MESSAGE012="    : "
  99. MESSAGE020=" モデル名"
  100. MESSAGE030=" -f モデル名"
  101. MESSAGE040=" -l "
  102. MESSAGE050="権限がありません。suもしくはsudoコマンドでroot権限を取得してください。"
  103. MESSAGE060="CUPSがインストールされていません。"
  104. MESSAGE070="WEBより情報を取得できません。PROXYサーバーを指定しますか? [y/N] ->"
  105. MESSAGE080="PROXYサーバーのURLを入力してください。"
  106. MESSAGE090=" 例1 http://(proxy-server-url):(port)"
  107. MESSAGE100=" 例2 http://(login-name):(pass-word)@(proxy-server-url):(port)"
  108. MESSAGE110=" ->"
  109. MESSAGE120="インターネットに接続できません。ネットワーク設定を確認してください。"
  110. MESSAGE121="モデル名を入力してください。->"
  111. MESSAGE122="rpmもしくはdpkgが必要です。"
  112. MESSAGE130="該当するドライバパッケージが見つかりません。"
  113. MESSAGE140="  モデル名を確認してください。"
  114. MESSAGE150="以下のパッケージが見付かりました。"
  115. MESSAGE160="インストールしますか? [y/N] ->"
  116. MESSAGE165="インストールしますか? [Y/n] ->"
  117. MESSAGE170="上記使用許諾に同意しますか? [Y/n] ->"
  118. MESSAGE180="上記使用許諾に同意しますか? [Y/n] ->"
  119. MESSAGE182="一時的にSELinuxのセキュリティレベルを下げました。恒久対策としてCUPSのセキュリティレベルをpermissiveにしてください。"
  120. MESSAGE184="AppArmorのCUPSに対するセキュリティレベルを下げました (aa-complain cups)。"
  121. MESSAGE190="Device URIを指定しますか? [Y/n] ->"
  122. MESSAGE200="IPアドレスの指定"
  123. MESSAGE201="自動設定"
  124. MESSAGE210="使用するDevice URIの番号を選択してください。 ->"
  125. MESSAGE220=" ご使用のプリンタ/MFCのIPアドレスを指定してください。->"
  126. MESSAGE230="テスト印刷を実行しますか? [y/N] ->"
  127. MESSAGE240="Enterキーを押してください。"
  128. MESSAGE250="csh/tcsh が必要です。"
  129. MESSAGE260="SELinuxのCUPSに対するセキュリティレベルを下げました。"\
  130. " (semanage permissive -a cupsd_t)"
  131. MESSAGE270="32bitライブラリ(glibc.i686/libstdc++)が必要です 。"\
  132. MESSAGE280="'wget'が必要です。"
  133. fi
  134.  
  135. if [ -e "$0".rc ];then
  136. source "$0".rc
  137. fi
  138.  
  139.  
  140. brother_license(){
  141. echo -e $COLOR2
  142. if [ $REGION != JPN ];then
  143. cat <<BROTHERLICENSE
  144. =========================================
  145. Brother License Agreement
  146.  
  147. Brother retains any and all copyrights to the Software. In no case this Agreement shall be construed to assign or otherwise transfer from Brother to User any copyrights or other intellectual property rights to whole or any part of the Software.
  148.  
  149. Brother grants User a non-exclusive license: to reproduce and/or distribute (via Internet or in any other manner) the Software. Further, Brother grants User a non-exclusive license to modify, alter, translate or otherwise prepare derivative works of the Software and to reproduce and distribute (via Internet or in any other manner) such modification, alteration, translation or other derivative works for any purpose.
  150.  
  151. The license of the Software from Brother hereunder is granted "AS IS." BROTHER HEREBY DISCLAIMS ANY WARRANTIES WITH RESPECT TO THE SOFTWARE, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTY FOR THE QUALITY, MERCHANTABILITY, FITNESS FOR PARTICULAR PURPOSE OR NON-INFRINGEMENT.
  152. Brother shall have no liability in contract, tort (including negligence or breach of statutory duty) or otherwise for any interruption of use, loss of data, or for any indirect, incidental, punitive or consequential loss or damage, or for any loss of profit, revenue, data, goodwill or anticipated savings that arises under, out of, or in contemplation of this Agreement or otherwise arises due to any error, inaccuracy or defect in the Software even if Brother has been advised of the possibility of such loss or damage.
  153. Further, Brother shall have no liability to disclose and/or distribute the source cord of the Software to User under any circumstances. In no case shall the above license by Brother to modify, alter, translate or otherwise prepare derivative works of the Software be construed as Brother's implied agreement or undertakings to disclose and/or distribute the source cord of the Software.
  154. =========================================
  155. BROTHERLICENSE
  156. else
  157. cat <<BROTHERLICENSEJ
  158. =========================================
  159. ブラザーソフトウェア用 公衆使用許諾契約書
  160.  
  161. 本契約は、本契約とともに配布・提供されるソフトウェア (以下単に本ソフトウェアといいます) に関し、本ソフトウェアの著作権者であるブラザー工業株式会社 (以下、ブラザーといいます) から本ソフトウェア受領者 (以下単に利用者といいます) に対し与えられる使用許諾について定めるものです。 利用者は、下記条項に従い本ソフトウェアを利用するものとします。 また、利用者は本ソフトウェアを利用することにより、下記条項に同意したものと見なされます。
  162.  
  163. (1)本ソフトウェアに関する著作権は、ブラザーに帰属します。 本契約は、本ソフトウェアについてブラザーから利用者に対し著作権の全部若しくは一部を譲渡するものとは解され得ません。
  164. (2)ブラザーは利用者に対し、本ソフトウェアについて複製、譲渡 (著作権の譲渡ではなくソフトウェアが格納された媒体の譲渡を指します) および公衆送信を行う権利を無償にて非独占的に許諾します。
  165. (3)さらにブラザーは利用者に対し、いかなる目的のためにでも本ソフトウェアを変更、改変、翻訳あるいは本ソフトウェアの派生物を作成し、かつそれらについて複製、譲渡及び公衆送信を行う権利を無償にて非独占的に許諾します。
  166. (4)ブラザーによる本ソフトウェアの配布・提供は、現状有姿にて行われるものであり、ブラザーは利用者に対し、本ソフトウェアに関し、明示・黙示問わず、何らの保証 (品質保証・有用性に関する保証・特定目的への合致に関する保証その他一切含め) も行いません。
  167. (5)ブラザーは本ソフトウェアに関し、利用者に生じたいかなる損害 (直接損害・間接損害・特別損害・派生損害・懲罰的損害その他一切含め) についても、かかる損害が予測可能か否か、また、その可能性についてブラザーが知っていたか否かを問わず、賠償義務を負いません。
  168. (6)さらにブラザーは利用者に対し、いかなる場合も本ソフトウェアのソースコードを開示する義務を負いません。 上記ブラザーによる変更、改変、翻訳あるいは本ソフトウェアの派生物作成に関するライセンスは、いかなる場合にも、本ソフトウェアのソースコード開示に関するブラザーの黙示的な同意とは解釈されません。
  169.  
  170. =========================================
  171. BROTHERLICENSEJ
  172. echo -e $MONO
  173. fi
  174. }
  175.  
  176.  
  177. gpl_license(){
  178. echo -e $COLOR2
  179. cat <<GPLLICENSE
  180. =========================================
  181. GPL License Agreement
  182.  
  183. This Software may be used in accordance with GNU General Public License (GPL). Please read carefully the following GPL and click on "I Accept" button. If you cannot agree with the following terms, please click "I don't Accept" button. In case of your non-acceptance, you can not use this Software.
  184. Note:
  185. Please click on "I Accept" while holding down "Shift" or right click on "I Accept" and select "Save Target As,,," from the menu.
  186.  
  187. GNU GENERAL PUBLIC LICENSE
  188. Version 2, June 1991
  189.  
  190. Copyright (C) 1989, 1991 Free Software Foundation, Inc.51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  191. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
  192.  
  193. Preamble
  194.  
  195. The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by
  196. the GNU Library General Public License instead.) You can apply it to your programs, too.
  197.  
  198. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
  199.  
  200. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
  201.  
  202. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the
  203. source code. And you must show them these terms so they know their rights.
  204.  
  205. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
  206.  
  207. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
  208.  
  209. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
  210.  
  211. The precise terms and conditions for copying, distribution and modification follow.
  212.  
  213. GNU GENERAL PUBLIC LICENSE
  214. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  215.  
  216. 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
  217.  
  218. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program
  219. is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
  220.  
  221. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
  222.  
  223. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
  224. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
  225.  
  226. a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
  227.  
  228. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
  229.  
  230. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an
  231. announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
  232.  
  233. These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
  234.  
  235. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
  236.  
  237. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
  238. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
  239.  
  240. a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
  241.  
  242. b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
  243.  
  244. c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you
  245. received the program in object code or executable form with such an offer, in accord with Subsection b above.)
  246.  
  247. The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
  248.  
  249. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
  250. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
  251. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying
  252. the Program or works based on it.
  253. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
  254. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
  255.  
  256. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
  257.  
  258. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
  259.  
  260. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
  261. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
  262. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
  263.  
  264. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
  265. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
  266.  
  267. NO WARRANTY
  268.  
  269. 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
  270. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  271.  
  272. END OF TERMS AND CONDITIONS
  273.  
  274. How to Apply These Terms to Your New Programs
  275.  
  276. If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
  277.  
  278. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
  279.  
  280. <one line to give the program's name and a brief idea of what it does.>
  281. Copyright (C) <year> <name of author>
  282.  
  283. 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.
  284.  
  285. 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.
  286.  
  287. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  288.  
  289.  
  290. Also add information on how to contact you by electronic and paper mail.
  291.  
  292. If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
  293.  
  294. Gnomovision version 69, Copyright (C) year name of author Gnomovision
  295. comes with ABSOLUTELY NO WARRANTY; for details type \`show w'.
  296. This is free software, and you are welcome to redistribute it
  297. under certain conditions; type \`show c' for details.
  298.  
  299. The hypothetical commands \`show w' and \`show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than \`show w' and \`show c'; they could even be mouse-clicks or menu items--whatever suits your program.
  300.  
  301. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
  302.  
  303. Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  304. \`Gnomovision' (which makes passes at compilers) written by James Hacker.
  305.  
  306. <signature of Ty Coon>, 1 April 1989
  307. Ty Coon, President of Vice
  308.  
  309. This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.
  310. =========================================
  311. GPLLICENSE
  312. echo -e $MONO
  313. }
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320. gpl_and_br_license(){
  321. echo -e $COLOR2
  322. if [ $REGION = JPN ];then
  323. cat <<GPLBROTHERLICENSE_J
  324. 本契約は、本契約とともに配布・提供されるソフトウェア(以下単に本ソフトウェアといいます)に関し、ブラザー工業株式会社(以下、ブラザーといいます)から本ソフトウェア受領者(以下、お客様といいます)に対し与えられる使用許諾について定めるものです。
  325.  
  326. 1.本ソフトウェアは、以下のモジュールから構成されています。
  327. (1) GNU GENERAL PUBLIC LICENSE対象ソフトウェアモジュール(以下、GPL対象モジュールといいます)
  328. (2) 上記に該当しないソフトウェアモジュール(以下、非GPLモジュールといいます。
  329. 本ソフトウェアを構成する各モジュールが上記のいずれに該当するかについては、本ソフトウェアのソースファイルをダウンロード頂きご確認ください。
  330.  
  331.  
  332. 2.GPL対象モジュールについては、GNU GENERAL PUBLIC LICENSE Version 2, June 1991(以下GPLv2といいます)の条件が適用されます。その条件の詳細については、 http://www.brother.co.jp/jp/agreement/japanese_gpl/agree.html をご確認ください。GPL対象モジュールについては、お客様は、GPLv2に定める条件に従い利用するものとします。また、お客様はGPL対象モジュールを利用することにより、GPLv2に定める条件に同意したものと見なされます。
  333.  
  334.  
  335. 3.非GPLモジュールについては、下記の条件が適用されます。非GPLモジュールについては、お客様は、下記の条件に従い利用するものとします。また、お客様は非GPLモジュールを利用することにより、下記条件に同意したものと見なされます。
  336. (1) 非GPLモジュールに関する著作権は、ブラザーに帰属します。本契約は、非GPLモジュールについてブラザーからお客様に対し著作権の全部若しくは一部を譲渡するものとは解され得ません。
  337. (2) ブラザーはお客様に対し、非GPLモジュールについて複製、譲渡(著作権の譲渡ではなくソフトウェアが格納された媒体の譲渡を指します)、公衆送信、および、改変並びに翻案(改変若しくは翻案された非GPLモジュールの複製、譲渡及び公衆送信を含みます)を行う権利を、無償にて非独占的に許諾します。
  338. (3) お客様は、前号に基づく譲渡及び公衆送信に際し、本契約に定めると同一内容の再使用許諾を受領者に明示的に与えなければなりません。
  339. (4) ブラザーによる非GPLモジュールの配布・提供は、現状有姿にて行われるものであり、ブラザーはお客様に対し、非GPLモジュールに関し、明示・黙示問わず、何らの保証(品質保証・有用性に関する保証・特定目的への合致に関する保証その他一切含め)も行いません。
  340. (5) ブラザーは非GPLモジュールに関し、適用法で認められる限り、お客様に生じたいかなる損害(直接損害・間接損害・特別損害・派生損害・懲罰的損害その他一切含め)についても、かかる損害が予測可能か否か、また、その可能性についてブラザーが知っていたか否かを問わず、賠償義務を負いません。
  341. (6) さらにブラザーはお客様に対し、いかなる場合も非GPLモジュールのソースコードを開示する義務を負いません。上記ブラザーによる改変、翻案に関するライセンスは、いかなる場合にも、非GPLモジュールのソースコード開示に関するブラザーの黙示的な同意とは解釈されません。
  342.  
  343. GPLBROTHERLICENSE_J
  344. else
  345. cat <<GPLBROTHERLICENSE_U
  346. This Agreement provides terms and conditions for license grant for use of the software that is distributed with this Agreement ("Software") from Brother Industries, Ltd. ("Brother") to recipients thereof ("You").
  347.  
  348. Note:
  349. Please click on "I Accept" while holding down "Shift" or right click on "I Accept" and select "Save Target As,,," from the menu.
  350.  
  351. 1.The Software is comprised of the following software modules:
  352.  
  353. (1) Certain software modules that is the subject of GNU GENERAL PUBLIC LICENSE ("GPL Modules"), and
  354. (2) Other software modules ("Non-GPL Modules")
  355.  
  356. You may distinguish each of GPL Modules by downloading source files of the Software as Brother separately makes available and reading such files.
  357.  
  358. 2.Your use of all GPL Modules shall be subject to the terms and conditions of GNU GENERAL PUBLIC LICENSE Version 2, June 1991 ("GPLv2"). Please see http://www.brother.com/agreement/English_gpl/agree.html. You shall use GPL Modules in accordance with the terms and conditions of GPLv2. Your use of GPL Modules shall be deemed as your agreement to the terms and conditions of GPLv2.
  359.  
  360. 3.You have the right to use all Non-GPL Modules only in accordance with the following terms and conditions. Your use of Non-GPL Modules shall be deemed as your agreement to the following terms and conditions:
  361. (1) Brother retains any and all copyrights to Non-GPL Modules. In no case this Agreement shall be construed to assign or otherwise transfer from Brother to you any copyrights or other intellectual property rights to whole or any part of Non-GPL Modules.
  362.  
  363. (2) Brother grants you a non-exclusive license to reproduce and/or distribute (via Internet or in any other manner) Non-GPL Modules. Brother further grants you a non-exclusive license to modify, alter, translate or otherwise prepare derivative works of Non-GPL Modules and to reproduce and/or distribute (via Internet or in any other manner) such modification, alteration, translation or other derivative works of Non-GPL Modules.
  364.  
  365. (3) When you distribute (via Internet or in any other manner) Non-GPL Modules or any modification, alteration, translation or other derivative works thereof under the license granted in accordance with subparagraph 3(2) above, you must expressly grant any and all recipient thereof the license equivalent to this Agreement which applies to Non-GPL Modules.
  366.  
  367. (4) The license of Non-GPL Modules from Brother hereunder is granted "AS IS. BROTHER HEREBY DISCLAIMS ANY WARRANTIES WITH RESPECT TO NON-GPL MODULES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTY FOR THE QUALITY, MERCHANTABILITY, FITNESS FOR PARTICULAR PURPOSE OR NON-INFRINGEMENT.
  368.  
  369. (5) To the extent allowed by applicable laws, Brother shall have no liability in contract, tort (including negligence or breach of statutory duty) or otherwise for any interruption of use, loss of data, or for any indirect, incidental, punitive or consequential loss or damage, or for any loss of profit, revenue, data, goodwill or anticipated savings that arises under, out of, or in contemplation of this Agreement or otherwise arises due to any error, inaccuracy or defect in Non-GPL Modules even if Brother has been advised of the possibility of such loss or damage.
  370.  
  371. (6) The form in which Non-GPL Modules is distributed is subject to Brothers sole discretion. Brother does not have any obligation to distribute or disclose Non-GPL Modules in source code form. In no case shall this Agreement be deemed as Brothers express or implied agreement to disclose source code of Non-GPL Modules.
  372. GPLBROTHERLICENSE_U
  373. fi
  374. }
  375.  
  376.  
  377. pdrv_complex_license(){
  378. echo -e $COLOR2
  379. if [ $REGION = JPN ];then
  380. cat <<PDVRLICENSE_J
  381. 本契約は、本契約とともに配布・提供されるソフトウェア (以下単に本ソフトウェアといいます) に関し、本ソフトウェアの著作権者であるブラザー工業株式会社 (以下、ブラザーといいます) から本ソフトウェア受領者 (以下単に利用者といいます) に対し与えられる使用許諾について定めるものです。 利用者は、下記条項に従い本ソフトウェアを利用するものとします。 また、利用者は本ソフトウェアを利用することにより、下記条項に同意したものと見なされます。
  382. 1. 本ソフトウェアに関する著作権は、ブラザーに帰属します。 本契約は、本ソフトウェアについてブラザーから利用者に対し著作権の全部若しくは一部を譲渡するものとは解され得ません。
  383. 2. ブラザーは利用者に対し、本ソフトウェアについて複製、譲渡 (著作権の譲渡ではなくソフトウェアが格納された媒体の譲渡を指します) および公衆送信を行う権利を無償にて非独占的に許諾します。
  384. 3. さらにブラザーは利用者に対し、いかなる目的のためにでも本ソフトウェアを変更、改変、翻訳あるいは本ソフトウェアの派生物を作成し、かつそれらについて複製、譲渡及び公衆送信を行う権利を無償にて非独占的に許諾します。
  385. 4. ブラザーによる本ソフトウェアの配布・提供は、現状有姿にて行われるものであり、ブラザーは利用者に対し、本ソフトウェアに関し、明示・黙示問わず、何らの保証 (品質保証・有用性に関する保証・特定目的への合致に関する保証その他一切含め) も行いません。
  386. 5. ブラザーは本ソフトウェアに関し、利用者に生じたいかなる損害 (直接損害・間接損害・特別損害・派生損害・懲罰的損害その他一切含め) についても、かかる損害が予測可能か否か、また、その可能性についてブラザーが知っていたか否かを問わず、賠償義務を負いません。
  387. 6. さらにブラザーは利用者に対し、いかなる場合も本ソフトウェアのソースコードを開示する義務を負いません。 上記ブラザーによる変更、改変、翻訳あるいは本ソフトウェアの派生物作成に関するライセンスは、いかなる場合にも、本ソフトウェアのソースコード開示に関するブラザーの黙示的な同意とは解釈されません。
  388. 7. 本ソフトウェアには、GNU GENERAL PUBLIC LICENSE Version 2の条件の適用を受けるプログラムが含まれております。第1条から第6項の規定に関わらず、これらのプログラムにはGNU GENERAL PUBLIC LICENSE Version 2の条件が適用されます。これらのプログラムは以下のディレクトリ及びそのサブディレクトリに保存されています。
  389. <cupswrapper>
  390.  
  391. GNU GENERAL PUBLIC LICENSE
  392. Version 2, June 1991
  393. Copyright (C) 1989, 1991 Free Software Foundation, Inc.
  394. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  395.  
  396. Everyone is permitted to copy and distribute verbatim copies
  397. of this license document, but changing it is not allowed.
  398. Preamble
  399. The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.
  400. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
  401. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
  402. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
  403. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
  404. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
  405. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
  406. The precise terms and conditions for copying, distribution and modification follow.
  407. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  408.  
  409. 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
  410. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
  411.  
  412. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
  413. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
  414.  
  415. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
  416.  
  417. a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
  418.  
  419. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
  420.  
  421. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
  422. These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
  423. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
  424. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
  425.  
  426. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
  427.  
  428. a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
  429.  
  430. b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
  431.  
  432. c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
  433. The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
  434. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
  435.  
  436. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
  437.  
  438. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
  439.  
  440. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
  441.  
  442. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
  443. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
  444. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
  445. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
  446.  
  447. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
  448.  
  449. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
  450. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
  451.  
  452. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
  453.  
  454. NO WARRANTY
  455. 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
  456.  
  457. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  458. END OF TERMS AND CONDITIONS
  459. How to Apply These Terms to Your New Programs
  460. If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
  461. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
  462. one line to give the program's name and an idea of what it does.
  463. Copyright (C) yyyy name of author
  464.  
  465. 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.
  466.  
  467. 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.
  468.  
  469. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  470. Also add information on how to contact you by electronic and paper mail.
  471. If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
  472. Gnomovision version 69, Copyright (C) year name of author
  473. Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
  474. type \`show w'. This is free software, and you are welcome
  475. to redistribute it under certain conditions; type \`show c'
  476. for details.
  477. The hypothetical commands \`show w' and \`show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than \`show w' and \`show c'; they could even be mouse-clicks or menu items--whatever suits your program.
  478. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
  479. Yoyodyne, Inc., hereby disclaims all copyright interest in the program \`Gnomovision' (which makes passes at compilers) written by James Hacker.
  480.  
  481. signature of Ty Coon, 1 April 1989
  482. Ty Coon, President of Vice
  483. This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.
  484.  
  485. PDVRLICENSE_J
  486. else
  487. cat <<PDVRLICENSE_U
  488. License Agreement
  489.  
  490. This Agreement provides terms and conditions for license grant from Brother Industries, Ltd ("Brother"). Brother, who owns all copyrights to the software that is distributed with this Agreement ("Software") to recipients thereof ("User"), for use of the Software. User shall have the right to use the Software only in accordance with the terms and conditions of this Agreement. Any use by User of the Software shall be deemed as its agreement hereto.
  491. Note:
  492. Please click on "I Accept" while holding down "Shift" or right click on "I Accept" and select "Save Target As,,," from the menu.
  493.  
  494.  
  495. Brother retains any and all copyrights to the Software. In no case this Agreement shall be construed to assign or otherwise transfer from Brother to User any copyrights or other intellectual property rights to whole or any part of the Software.
  496. Brother grants User a non-exclusive license: to reproduce and/or distribute (via Internet or in any other manner) the Software. Further, Brother grants User a non-exclusive license to modify, alter, translate or otherwise prepare derivative works of the Software and to reproduce and distribute (via Internet or in any other manner) such modification, alteration, translation or other derivative works for any purpose.
  497. The license of the Software from Brother hereunder is granted "AS IS." BROTHER HEREBY DISCLAIMS ANY WARRANTIES WITH RESPECT TO THE SOFTWARE, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTY FOR THE QUALITY, MERCHANTABILITY, FITNESS FOR PARTICULAR PURPOSE OR NON-INFRINGEMENT. Brother shall have no liability in contract, tort (including negligence or breach of statutory duty) or otherwise for any interruption of use, loss of data, or for any indirect, incidental, punitive or consequential loss or damage, or for any loss of profit, revenue, data, goodwill or anticipated savings that arises under, out of, or in contemplation of this Agreement or otherwise arises due to any error, inaccuracy or defect in the Software even if Brother has been advised of the possibility of such loss or damage. Further, Brother shall have no liability to disclose and/or distribute the source code of the Software to User under any circumstances. In no case shall the above license by Brother to modify, alter, translate or otherwise prepare derivative works of the Software be construed as Brother's implied agreement or undertakings to disclose and/or distribute the source code of the Software.
  498. The Software contains the programs licensed under the terms and conditions of GNU GENERAL PUBLIC LICENSE Version 2. Notwithstanding the foregoing, the terms and conditions of GNU GENERAL PUBLIC LICENSE Version 2 is applied to such programs. Such programs are stored on the following directory and its sub-directories.
  499. <cupswrapper>
  500. GNU GENERAL PUBLIC LICENSE
  501. Version 2, June 1991
  502. Copyright (C) 1989, 1991 Free Software Foundation, Inc.
  503. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  504.  
  505. Everyone is permitted to copy and distribute verbatim copies
  506. of this license document, but changing it is not allowed.
  507. Preamble
  508. The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.
  509. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
  510. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
  511. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
  512. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
  513. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
  514. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
  515. The precise terms and conditions for copying, distribution and modification follow.
  516. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  517.  
  518. 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
  519. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
  520.  
  521. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
  522. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
  523.  
  524. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
  525.  
  526. a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
  527.  
  528. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
  529.  
  530. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
  531. These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
  532. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
  533. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
  534.  
  535. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
  536.  
  537. a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
  538.  
  539. b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
  540.  
  541. c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
  542. The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
  543. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
  544.  
  545. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
  546.  
  547. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
  548.  
  549. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
  550.  
  551. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
  552. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
  553. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
  554. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
  555.  
  556. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
  557.  
  558. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
  559. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
  560.  
  561. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
  562.  
  563. NO WARRANTY
  564. 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
  565.  
  566. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  567. END OF TERMS AND CONDITIONS
  568. How to Apply These Terms to Your New Programs
  569. If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
  570. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
  571. one line to give the program's name and an idea of what it does.
  572. Copyright (C) yyyy name of author
  573.  
  574. 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.
  575.  
  576. 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.
  577.  
  578. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  579. Also add information on how to contact you by electronic and paper mail.
  580. If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
  581. Gnomovision version 69, Copyright (C) year name of author
  582. Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
  583. type \`show w'. This is free software, and you are welcome
  584. to redistribute it under certain conditions; type \`show c'
  585. for details.
  586. The hypothetical commands \`show w' and \`show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than \`show w' and \`show c'; they could even be mouse-clicks or menu items--whatever suits your program.
  587. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
  588. Yoyodyne, Inc., hereby disclaims all copyright interest in the program \`Gnomovision' (which makes passes at compilers) written by James Hacker.
  589.  
  590. signature of Ty Coon, 1 April 1989
  591. Ty Coon, President of Vice
  592. This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.
  593.  
  594.  
  595. PDVRLICENSE_U
  596. fi
  597.  
  598. }
  599.  
  600.  
  601.  
  602. TIMEOUT=30
  603.  
  604.  
  605. WGET_OP="-T 10 -nd"
  606. WGET_OP2="-nd -T 10 -t 1"
  607.  
  608. DBG_MSG(){
  609. if [ "$DEBUG_MSG" = 1 ];then
  610. echo -e ${COLOR3}"DEBUGMSG : $1"${MONO}
  611. fi
  612. }
  613.  
  614. MESSAGE(){
  615. if [ "$MSG" = 1 ];then
  616. echo -e ${COLOR3}"$1"${MONO}
  617. fi
  618. }
  619.  
  620. install_done=no
  621. preproc_done=''
  622. postproc_done=''
  623. PREPROC=''
  624. POSTPROC=''
  625.  
  626. pre_install_sweep(){
  627. DBG_MSG pre_install_sweep
  628. ORGC="/etc/init.d/cups"
  629. ORGL="/etc/init.d/lpd"
  630. ORGLN="/etc/init.d/lprng"
  631. SYMLNC="cups -> /etc/init.d/cupsys"
  632. SYMLNL="lpd -> /etc/init.d/cupsys"
  633. SYMLNLN="lprng -> /etc/init.d/cupsys"
  634.  
  635. if [ "$(ls -al $ORGC 2> /dev/null | grep ^l | grep "$SYMLNC" )" != '' ]
  636. then
  637. rm -f $ORGC 2> /dev/null
  638. fi
  639. if [ "$(ls -al $ORGL 2> /dev/null | grep ^l | grep "$SYMLNL" )" != '' ]
  640. then
  641. rm -f $ORGL 2> /dev/null
  642. fi
  643. if [ "$(ls -al $ORGLN 2> /dev/null | grep ^l | grep "$SYMLNLN")" != '' ]
  644. then
  645. rm -f $ORGLN 2> /dev/null
  646. fi
  647. }
  648.  
  649. post_install_sweep(){
  650. DBG_MSG post_install_sweep
  651. if [ ! -d ${wkdir}/${modelnhuc} ];then
  652. if [ -f ${wkdir}/${modelnhuc} ];then
  653. rm -f ${wkdir}/${modelnhuc} 2> /dev/null
  654. fi
  655. fi
  656. }
  657.  
  658.  
  659. #
  660. # get inf file
  661. # chaged values :
  662. # ${modelnhuc}
  663. # ${fulpath}
  664. #
  665. get_inf_file(){
  666. SUFFIX1="N C D DN DW DWN DWT CN CW CDN CD CDW CDWT DNLT JN J CLN CLWN WR"
  667. DBG_MSG get_inf_file
  668.  
  669. if [ $NODOWNLOAD = 1 ];then
  670. cp $INFPATH ${wkdir}
  671. modelnhuc=$MODEL
  672. elif [ $NODOWNLOAD = 2 ];then
  673. modelnhuc=$MODEL
  674. else
  675.  
  676. inputmodel=$1
  677. modelnhuc=$(echo $inputmodel | tr "[a-z]" "[A-Z]" | tr -d '-')
  678.  
  679. if [ "${modelnhuc}" = '' ];then
  680. echo ERROR :$inputmodel , $1 , ${modelnhuc}
  681. #DBG_MSG "exit 1"
  682. exit 0
  683. fi
  684.  
  685. fulpath=$URL_INF/${modelnhuc}
  686.  
  687. dlresult=IDENTIC
  688. if [ $infcheck = 0 ] && [ $HIDE_INF = NO ];then
  689. MESSAGE "wget $WGET_OP $CACHEFLG -P ${wkdir} $fulpath"
  690. fi
  691. fi
  692. wget $WGET_OP $CACHEFLG -P ${wkdir} $fulpath > /dev/null 2> /dev/null
  693.  
  694. #--------------------------------------
  695.  
  696. if [ ! -f ${wkdir}/${modelnhuc} ];then
  697. # DCP315C -> DCP315CN
  698. dlresult=APPROX1
  699. modelnhuc2=$(echo $inputmodel | tr "[a-z]" "[A-Z]" | tr -d '-' |\
  700. sed -e s/"[A-Z][A-Z][A-Z][A-Z]$"/""/g \
  701. -e s/"[A-Z][A-Z][A-Z]$"/""/g \
  702. -e s/"[A-Z][A-Z]$"/""/g \
  703. -e s/"[A-Z]$"/""/g )
  704.  
  705. for suffix in $SUFFIX1
  706. do
  707. modelnhuc=${modelnhuc2}${suffix}
  708.  
  709. if [ "${modelnhuc}" != '' ];then
  710. fulpath=$URL_INF/${modelnhuc}
  711. if [ $infcheck = 0 ] && [ $HIDE_INF = NO ];then
  712. MESSAGE "wget $WGET_OP $CACHEFLG -P ${wkdir} $fulpath"
  713. fi
  714. wget $WGET_OP $CACHEFLG -P ${wkdir} $fulpath > /dev/null 2> /dev/null
  715. if [ $? = '0' ];then
  716. break
  717. fi
  718. fi
  719. modelnhuc='___not_found___'
  720. done
  721. fi
  722.  
  723. #--------------------------------------
  724. if [ ! -f ${wkdir}/${modelnhuc} ];then
  725. # DCP315C -> DCP315
  726. dlresult=APPROX2
  727. modelnhuc=$(echo $inputmodel | tr "[a-z]" "[A-Z]" | tr -d '-' |\
  728. sed -e s/"[A-Z][A-Z][A-Z][A-Z]$"/""/g \
  729. -e s/"[A-Z][A-Z][A-Z]$"/""/g \
  730. -e s/"[A-Z][A-Z]$"/""/g \
  731. -e s/"[A-Z]$"/""/g )
  732.  
  733.  
  734. if [ "${modelnhuc}" != '' ];then
  735. fulpath=$URL_INF/${modelnhuc}
  736. if [ $infcheck = 0 ] && [ $HIDE_INF = NO ];then
  737. MESSAGE "wget $WGET_OP $CACHEFLG -P ${wkdir} $fulpath"
  738. fi
  739. wget $WGET_OP $CACHEFLG -P ${wkdir} $fulpath > /dev/null 2> /dev/null
  740. fi
  741. fi
  742.  
  743. #--------------------------------------
  744. if [ ! -f "${wkdir}/${modelnhuc}" ];then
  745. # DCP315C -> DCP310C
  746. dlresult=APPROX3
  747. modelnhuc=$(echo $inputmodel | \
  748. sed -e s/"[0-9]$"/"0"/g \
  749. -e s/"[0-9]C"/"0C"/g \
  750. -e s/"[0-9]D"/"0D"/g \
  751. -e s/"[0-9]W"/"0W"/g \
  752. -e s/"[0-9]N"/"0N"/g )
  753. if [ "${modelnhuc}" != '' ];then
  754. fulpath=$URL_INF/${modelnhuc}
  755. #echo wget $WGET_OP $CACHEFLG -P ${wkdir} $fulpath
  756. if [ $infcheck = 0 ] && [ $HIDE_INF = NO ];then
  757. MESSAGE "wget $WGET_OP $CACHEFLG -P ${wkdir} $fulpath"
  758. fi
  759. wget $WGET_OP $CACHEFLG -P ${wkdir} $fulpath > /dev/null 2> /dev/null
  760. fi
  761. fi
  762. #--------------------------------------
  763.  
  764. if [ ! -f ${wkdir}/${modelnhuc} ];then
  765. # DCP315C -> DCP310CN
  766. dlresult=APPROX4
  767. modelnhuc2=$(echo $inputmodel | tr "[a-z]" "[A-Z]" | tr -d '-' |\
  768. sed -e s/"[A-Z][A-Z][A-Z][A-Z]$"/""/g \
  769. -e s/"[A-Z][A-Z][A-Z]$"/""/g \
  770. -e s/"[A-Z][A-Z]$"/""/g \
  771. -e s/"[A-Z]$"/""/g |\
  772. sed s/"[0-9]$"/"0"/g )
  773.  
  774. for suffix in $SUFFIX1
  775. do
  776. modelnhuc=${modelnhuc2}${suffix}
  777. if [ "${modelnhuc}" != '' ];then
  778. fulpath=$URL_INF/${modelnhuc}
  779. if [ $infcheck = 0 ] && [ $HIDE_INF = NO ];then
  780. MESSAGE "wget $WGET_OP $CACHEFLG -P ${wkdir} $fulpath"
  781. fi
  782. wget $WGET_OP $CACHEFLG -P ${wkdir} $fulpath > /dev/null 2> /dev/null
  783. if [ $? = '0' ];then
  784. break
  785. fi
  786. fi
  787. modelnhuc='___not_found___'
  788. done
  789. fi
  790.  
  791. #--------------------------------------
  792.  
  793. if [ ! -f ${wkdir}/${modelnhuc} ];then
  794. # DCP315C -> DCP310
  795. dlresult=APPROX5
  796. modelnhuc=$(echo $inputmodel | tr "[a-z]" "[A-Z]" | tr -d '-' |\
  797. sed -e s/"[A-Z][A-Z][A-Z][A-Z]$"/""/g \
  798. -e s/"[A-Z][A-Z][A-Z]$"/""/g \
  799. -e s/"[A-Z][A-Z]$"/""/g \
  800. -e s/"[A-Z]$"/""/g |\
  801. sed s/"[0-9]$"/"0"/g )
  802.  
  803. if [ "${modelnhuc}" != '' ];then
  804. fulpath=$URL_INF/${modelnhuc}
  805. if [ $infcheck = 0 ] && [ $HIDE_INF = NO ];then
  806. MESSAGE "wget $WGET_OP $CACHEFLG -P ${wkdir} $fulpath"
  807. fi
  808. wget $WGET_OP $CACHEFLG -P ${wkdir} $fulpath > /dev/null 2> /dev/null
  809. fi
  810. if [ ! -f ${wkdir}/${modelnhuc} ];then
  811. modelnhuc='___not_found___'
  812.  
  813. fi
  814. fi
  815.  
  816. #--------------------------------------
  817.  
  818.  
  819.  
  820.  
  821. if [ -f ${wkdir}/${modelnhuc} ];then
  822.  
  823. lnk=$(grep "LNK=" ${wkdir}/${modelnhuc} 2>/dev/null | sed s/'LNK='//g)
  824. if [ "$lnk" != '' ];then
  825. PRODUCT_NAME=$(grep "^\[" ${wkdir}/${modelnhuc} 2>/dev/null | sed -e s/"\["//g -e s/"\]"//g)
  826.  
  827. PREPROC=$(grep "PREPROC=" ${wkdir}/${modelnhuc} 2>/dev/null | \
  828. sed s/"PREPROC="//g | \
  829. sed -e s/^\"//g -e s/\"$//g )
  830. POSTPROC=$(grep "POSTPROC=" ${wkdir}/${modelnhuc} 2>/dev/null | \
  831. sed s/"POSTPROC="//g | \
  832. sed -e s/^\"//g -e s/\"$//g )
  833. lnk_flag="LINK"
  834. LNK_PRINTERNAME=$(grep "PRINTERNAME" ${wkdir}/${modelnhuc} \
  835. 2>/dev/null | sed s/"PRINTERNAME="//g )
  836. if [ -f ${wkdir}/${modelnhuc} ];then
  837. rm -f ${wkdir}/${modelnhuc} 2> /dev/null
  838. fi
  839.  
  840. modelnhuc=${lnk}
  841. fulpath=$URL_INF/${modelnhuc}
  842. if [ $infcheck = 0 ] && [ $HIDE_INF = NO ];then
  843. MESSAGE "wget $WGET_OP $CACHEFLG -P ${wkdir} $fulpath"
  844. fi
  845. wget $WGET_OP $CACHEFLG -P ${wkdir} $fulpath > /dev/null 2> /dev/null
  846. fi
  847. fi
  848.  
  849. if [ "$modelnhuc" = '___not_found___' ];then
  850. modelnhuc=''
  851. fi
  852.  
  853. }
  854.  
  855.  
  856.  
  857. get_packages_name(){
  858. DBG_MSG get_packages_name
  859. inf=${wkdir}/$1
  860. if [ "$PRODUCT_NAME" = '' ];then
  861. PRODUCT_NAME=$(grep "\[" $inf 2>/dev/null | sed -e s/"\["//g -e s/"\]"//g)
  862. fi
  863. SCANNER_DRV=$(grep "SCANNER_DRV" $inf 2>/dev/null | sed s/"SCANNER_DRV="//g )
  864. SCANKEY_DRV=$(grep "SCANKEY_DRV" $inf 2>/dev/null | sed s/"SCANKEY_DRV="//g )
  865. PRINTERNAME=$(grep "PRINTERNAME" $inf 2>/dev/null | sed s/"PRINTERNAME="//g )
  866. if [ "$SCANNER_DRV" != '' ];then
  867. SCANNER_LNK="$SCANNER_DRV".lnk
  868. fulpath=$URL_INF/$SCANNER_LNK
  869.  
  870.  
  871. if [ $infcheck = 0 ] && [ $HIDE_INF = NO ];then
  872. echo wget $WGET_OP $CACHEFLG -P ${wkdir} $fulpath
  873. fi
  874. wget $WGET_OP $CACHEFLG -P ${wkdir} $fulpath 2> /dev/null
  875. fi
  876. if [ "$SCANKEY_DRV" != '' ];then
  877. SCANKEY_LNK="$SCANKEY_DRV".lnk
  878. fulpath=$URL_INF/$SCANKEY_LNK
  879. if [ $infcheck = 0 ] && [ $HIDE_INF = NO ];then
  880. echo wget $WGET_OP $CACHEFLG -P ${wkdir} $fulpath
  881. fi
  882. wget $WGET_OP $CACHEFLG -P ${wkdir} $fulpath 2> /dev/null
  883. fi
  884.  
  885. if [ "$PKG" = rpm ];then
  886. CUPSFILE=$(grep "PRN_CUP_RPM" $inf 2>/dev/null | sed s/"PRN_CUP_RPM="//g )
  887. LPRFILE=$(grep "PRN_LPD_RPM" $inf 2>/dev/null | sed s/"PRN_LPD_RPM="//g )
  888. PDRVFILE=$(grep "PRN_DRV_RPM" $inf 2>/dev/null | sed s/"PRN_DRV_RPM="//g )
  889. REQ32LIB=$(grep "REQUIRE32LIB" $inf 2>/dev/null| sed s/"REQUIRE32LIB="//g )
  890. if [ "$SCANNER_LNK" != '' ];then
  891. if [ "$arch" = 'i386' ];then
  892. SCANFILE=$(grep "RPM32=" ${wkdir}/"$SCANNER_LNK" | sed s/"RPM32="//g )
  893. else
  894. SCANFILE=$(grep "RPM64=" ${wkdir}/"$SCANNER_LNK" | sed s/"RPM64="//g )
  895. fi
  896. fi
  897. if [ "$SCANKEY_LNK" != '' ];then
  898. if [ "$arch" = 'i386' ];then
  899. SKEYFILE=$(grep "RPM32=" ${wkdir}/"$SCANKEY_LNK" | sed s/"RPM32="//g )
  900. else
  901. SKEYFILE=$(grep "RPM64=" ${wkdir}/"$SCANKEY_LNK" | sed s/"RPM64="//g )
  902. fi
  903. fi
  904.  
  905.  
  906. else
  907. CUPSFILE=$(grep "PRN_CUP_DEB" $inf 2>/dev/null | sed s/"PRN_CUP_DEB="//g )
  908. LPRFILE=$(grep "PRN_LPD_DEB" $inf 2>/dev/null | sed s/"PRN_LPD_DEB="//g )
  909. PDRVFILE=$(grep "PRN_DRV_DEB" $inf 2>/dev/null | sed s/"PRN_DRV_DEB="//g )
  910. REQ32LIB=$(grep "REQUIRE32LIB" $inf 2>/dev/null| sed s/"REQUIRE32LIB="//g )
  911. if [ "$SCANNER_LNK" != '' ];then
  912. if [ "$arch" = 'i386' ];then
  913. SCANFILE=$(grep "DEB32=" ${wkdir}/"$SCANNER_LNK" | sed s/"DEB32="//g )
  914. else
  915. SCANFILE=$(grep "DEB64=" ${wkdir}/"$SCANNER_LNK" | sed s/"DEB64="//g )
  916. fi
  917. fi
  918. if [ "$SCANKEY_LNK" != '' ];then
  919. if [ "$arch" = 'i386' ];then
  920. SKEYFILE=$(grep "DEB32=" ${wkdir}/"$SCANKEY_LNK" | sed s/"DEB32="//g )
  921. else
  922. SKEYFILE=$(grep "DEB64=" ${wkdir}/"$SCANKEY_LNK" | sed s/"DEB64="//g )
  923. fi
  924. fi
  925.  
  926. fi
  927.  
  928. if [ "$PREPROC" = '' ];then
  929. PREPROC=$(grep "PREPROC=" $inf 2>/dev/null | \
  930. sed s/"PREPROC="//g | \
  931. sed -e s/^\"//g -e s/\"$//g )
  932. fi
  933. if [ "$POSTPROC" = '' ];then
  934. POSTPROC=$(grep "POSTPROC=" $inf 2>/dev/null | \
  935. sed s/"POSTPROC="//g | \
  936. sed -e s/^\"//g -e s/\"$//g )
  937.  
  938. fi
  939.  
  940. if [ -f "$inf" ];then
  941. rm -f "$inf" 2> /dev/null
  942. fi
  943. if [ -f ${wkdir}/"$SCANNER_LNK" ] && [ "$SCANNER_LNK" != '' ];then
  944. rm -f ${wkdir}/"$SCANNER_LNK" 2> /dev/null
  945. fi
  946. if [ -f ${wkdir}/"$SCANKEY_LNK" ] && [ "$SCANKEY_LNK" != '' ];then
  947. rm -f ${wkdir}/"$SCANKEY_LNK" 2> /dev/null
  948. fi
  949. }
  950.  
  951. HOSTDEFAULT="www.brother.com"
  952. HOSTINFJP=$HOSTDEFAULT
  953. HOSTINFUS=$HOSTDEFAULT
  954. HOSTPKGJP=$HOSTDEFAULT
  955. HOSTPKGUS=$HOSTDEFAULT
  956.  
  957. DBG_MSG BROTHERSOLUTIONSCENTOR_HOSTINFJP=$BROTHERSOLUTIONSCENTOR_HOSTINFJP
  958. DBG_MSG BROTHERSOLUTIONSCENTOR_HOSTINFUS=$BROTHERSOLUTIONSCENTOR_HOSTINFUS
  959. DBG_MSG BROTHERSOLUTIONSCENTOR_HOSTPKGJP=$BROTHERSOLUTIONSCENTOR_HOSTPKGJP
  960. DBG_MSG BROTHERSOLUTIONSCENTOR_HOSTPKGUS=$BROTHERSOLUTIONSCENTOR_HOSTPKGUS
  961.  
  962. if [ "$BROTHERSOLUTIONSCENTOR_HOSTINFJP" != '' ];then
  963. HOSTINFJP=$BROTHERSOLUTIONSCENTOR_HOSTINFJP
  964. fi
  965.  
  966. if [ "$BROTHERSOLUTIONSCENTOR_HOSTINFUS" != '' ];then
  967. HOSTINFUS=$BROTHERSOLUTIONSCENTOR_HOSTINFUS
  968. fi
  969.  
  970. if [ "$BROTHERSOLUTIONSCENTOR_HOSTPKGJP" != '' ];then
  971. HOSTPKGJP=$BROTHERSOLUTIONSCENTOR_HOSTPKGJP
  972. fi
  973.  
  974. if [ "$BROTHERSOLUTIONSCENTOR_HOSTPKGUS" != '' ];then
  975. HOSTPKGUS=$BROTHERSOLUTIONSCENTOR_HOSTPKGUS
  976. fi
  977.  
  978.  
  979. BASEPATHJP="/pub/bsc/linuxj/"
  980. BASEPATHUS="/pub/bsc/linux/"
  981.  
  982.  
  983.  
  984.  
  985. set_host_info(){
  986. DBG_MSG set_host_info
  987. if [ "$1" = "JPN" ];then
  988. URL_INF="http://"${HOSTINFJP}${BASEPATHJP}infs
  989. URL_PKG="http://"${HOSTPKGJP}${BASEPATHJP}packages
  990. else
  991. URL_INF="http://"${HOSTINFUS}${BASEPATHUS}infs
  992. URL_PKG="http://"${HOSTPKGUS}${BASEPATHUS}packages
  993. fi
  994. DBG_MSG " URL_INF="$URL_INF
  995. DBG_MSG " URL_PKG="$URL_PKG
  996. }
  997.  
  998.  
  999. network_check(){
  1000. netchkpage=$1
  1001. if [ "${wkdir}" != '' ] && [ "$netchkpage" != '' ];then
  1002. if [ -f ${wkdir}/$netchkpage ];then
  1003. rm ${wkdir}/$netchkpage 2> /dev/null
  1004. fi
  1005. fi
  1006.  
  1007. fulpath2="http://"${HOSTINFUS}${BASEPATHUS}infs/$netchkpage
  1008. wget $WGET_OP2 $CACHEFLG -P ${wkdir} $fulpath2 > /dev/null 2> /dev/null
  1009. rcwget=$?
  1010.  
  1011. netaccess=FALSE
  1012. if [ -f ${wkdir}/$netchkpage ];then
  1013. netaccess=SUCCESS
  1014. rm ${wkdir}/$netchkpage 2> /dev/null
  1015. fi
  1016. }
  1017.  
  1018. drv_get_and_install(){
  1019. DBG_MSG drv_get_and_install
  1020. package=$1
  1021. license=$2
  1022. default=$3
  1023. iinstall_result=No
  1024.  
  1025. if [ "$package" != '' ];then
  1026. echo -e $COLOR4$MESSAGE150$MONO #"You are going to install ...."
  1027. echo -e $COLOR4" "$package$MONO
  1028. if [ "$default" = No ];then
  1029. echo -e -n $COLOR$MESSAGE160 #"OK\? [y/N] ->"
  1030. answer=""
  1031. read answer
  1032. echo -e $MONO
  1033. if [ "$answer" = Y ] || [ "$answer" = y ]; then
  1034. if ! [ -f "$package" ];then
  1035. $license
  1036. echo -e -n $COLOR$MESSAGE170 #"Are you agree\? [Y/n] ->"
  1037. answer=""
  1038. read answer
  1039. echo -e $MONO
  1040. if [ "$answer" != N ] && [ "$answer" != n ]; then
  1041. echo wget $WGET_OP $CACHEFLG $URL_PKG/$package
  1042. wget $WGET_OP $CACHEFLG $URL_PKG/$package
  1043. fi
  1044. if [ -f "$package" ];then
  1045. echo -n -e $COLOR4
  1046. echo $PKGCMD $package
  1047. echo -n -e $MONO
  1048. if [ "$DEBUG_NOINSTALL" != 'yes' ];then
  1049. pre_proc
  1050. $PKGCMD $package
  1051. else
  1052. sleep 1
  1053. fi
  1054. iinstall_result=Yes
  1055. fi
  1056.  
  1057. fi
  1058. fi #answer
  1059. elif [ "$default" = Yes ];then
  1060. echo -e -n $COLOR$MESSAGE165 #"OK\? [Y/n] ->"
  1061. answer=""
  1062. read answer
  1063. echo -e $MONO
  1064. if [ "$answer" != N ] && [ "$answer" != n ]; then
  1065. if ! [ -f "$package" ];then
  1066. $license
  1067. echo -e -n $COLOR$MESSAGE170 #"Are you agree\? [Y/n] ->"
  1068. answer=""
  1069. read answer
  1070. echo -e $MONO
  1071. if [ "$answer" != N ] && [ "$answer" != n ]; then
  1072. echo wget $WGET_OP $CACHEFLG $URL_PKG/$package
  1073. wget $WGET_OP $CACHEFLG $URL_PKG/$package
  1074. fi
  1075.  
  1076. if [ -f "$package" ];then
  1077. echo -n -e $COLOR4
  1078. echo $PKGCMD $package
  1079. echo -n -e $MONO
  1080. if [ "$DEBUG_NOINSTALL" != 'yes' ];then
  1081. pre_proc
  1082. $PKGCMD $package
  1083. else
  1084. sleep 1
  1085. fi
  1086. iinstall_result=Yes
  1087. fi
  1088. fi
  1089. fi #answer
  1090. else # deault = Force
  1091. if ! [ -f "$package" ];then
  1092. $license
  1093. echo -e -n $COLOR$MESSAGE170 #"Are you agree\? [Y/n] ->"
  1094. answer=""
  1095. read answer
  1096. echo -e $MONO
  1097. if [ "$answer" != N ] && [ "$answer" != n ]; then
  1098. echo wget $WGET_OP $CACHEFLG $URL_PKG/$package
  1099. wget $WGET_OP $CACHEFLG $URL_PKG/$package
  1100. fi
  1101. fi
  1102. if [ -f "$package" ];then
  1103. echo -n -e $COLOR4
  1104. echo $PKGCMD $package
  1105. echo -n -e $MONO
  1106. if [ "$DEBUG_NOINSTALL" != 'yes' ];then
  1107. pre_proc
  1108. $PKGCMD $package
  1109. iinstall_result=Yes
  1110. else
  1111. sleep 1
  1112. fi
  1113. fi
  1114. fi #default
  1115. fi #package
  1116. }
  1117.  
  1118.  
  1119. make_generic_uninstaller(){
  1120. DBG_MSG make_generic_uninstaller
  1121. if [ -f $1 ];then
  1122. generic_uninstaller=uninstaller_$2
  1123. cat <<GENERICUNINST > $generic_uninstaller
  1124. #! /bin/bash
  1125. $RMPKGCMD $2
  1126.  
  1127. $(rmscanlibmodules $3)
  1128.  
  1129. GENERICUNINST
  1130. chmod 744 $generic_uninstaller
  1131. fi
  1132. }
  1133.  
  1134. make_brscan_uninstaller(){
  1135. DBG_MSG make_brscan_uninstaller
  1136. if [ -f $1 ];then
  1137. brscan_uninstaller=uninstaller_$2
  1138. cat <<BRSCANUNINST > $brscan_uninstaller
  1139. #! /bin/bash
  1140.  
  1141. touch /usr/local/Brother/sane/dummy
  1142. $RMPKGCMD $2
  1143. rm -f /usr/local/Brother/sane/dummy
  1144. rmdir --ignore-fail-on-non-empty /usr/local/Brother/sane 2>/dev/null
  1145.  
  1146. $(rmscanlibmodules $3)
  1147. BRSCANUNINST
  1148. chmod 744 $brscan_uninstaller
  1149. fi
  1150. }
  1151.  
  1152. make_brscan2_uninstaller(){
  1153. DBG_MSG make_brscan2_uninstaller
  1154. if [ -f $1 ];then
  1155. brscan2_uninstaller=uninstaller_$2
  1156. cat <<BRSCAN2UNINST > $brscan2_uninstaller
  1157. #! /bin/bash
  1158.  
  1159. touch /usr/local/Brother/sane/dummy
  1160. $RMPKGCMD $2
  1161. rm -f /usr/local/Brother/sane/dummy
  1162. rmdir --ignore-fail-on-non-empty /usr/local/Brother/sane 2>/dev/null
  1163.  
  1164. $(rmscanlibmodules $3)
  1165. BRSCAN2UNINST
  1166. chmod 744 $brscan2_uninstaller
  1167. fi
  1168. }
  1169.  
  1170.  
  1171.  
  1172. scanlibmodules1="\
  1173. libbrcolm.so.1.0.1 \
  1174. libbrscandec.so.1.0.0 \
  1175. sane/libsane-brother.so.1.0.7 \
  1176. sane/libsane-brother.so \
  1177. sane/libsane-brother.so.1 \
  1178. libbrscandec.so.1 \
  1179. libbrcolm.so \
  1180. libbrcolm.so.1 \
  1181. libbrscandec.so"
  1182.  
  1183. scanlibmodules2="\
  1184. libbrscandec2.so.1.0.0 \
  1185. sane/libsane-brother2.so.1.0.7 \
  1186. sane/libsane-brother2.so.1 \
  1187. sane/libsane-brother2.so \
  1188. libbrcolm2.so.1.0.1 \
  1189. libbrcolm2.so \
  1190. libbrscandec2.so.1 \
  1191. libbrscandec2.so \
  1192. libbrcolm2.so.1"
  1193.  
  1194. scanlibmodules3="\
  1195. libbrscandec3.so.1.0.0 \
  1196. sane/libsane-brother3.so.1.0.7 \
  1197. sane/libsane-brother3.so.1 \
  1198. sane/libsane-brother3.so \
  1199. libbrscandec3.so \
  1200. libbrscandec3.so.1"
  1201.  
  1202.  
  1203. scanlibmodules4=""
  1204.  
  1205.  
  1206. dellist=''
  1207. cpscanlibmodules(){
  1208. for file in $1
  1209. do
  1210. lib64mod=/usr/lib64/$file
  1211. libmod=/usr/lib/$file
  1212.  
  1213. if [ -f $lib64mod ];then
  1214. if [ -d /usr/lib ];then
  1215. if [ ! -f $libmod ];then
  1216. cp $lib64mod $libmod 2> /dev/null
  1217. if [ -f $libmod ];then
  1218. dellist2=$(echo $dellist $libmod)
  1219. dellist=$dellist2
  1220. fi
  1221. fi
  1222. fi
  1223. fi
  1224. done
  1225. }
  1226.  
  1227.  
  1228. rmscanlibmodules(){
  1229. for file in $dellist
  1230. do
  1231. for check in $*
  1232. do
  1233. chkresult=$(echo $file | grep $check\$ )
  1234. if [ "$chkresult" != '' ];then
  1235. echo rm -f $file
  1236. fi
  1237. done
  1238.  
  1239. done
  1240. }
  1241.  
  1242. udevrulefile=""
  1243. udev_installed=no
  1244. udev_install(){
  1245. libsanerule=$(ls /lib/udev/rules.d/*.rules /etc/udev/rules.d/*.rules | \
  1246. grep libsane | head --line=1)
  1247. number=$(echo $libsanerule | \
  1248. sed s/"\/lib\/udev\/rules.d\/"//g |\
  1249. sed s/"\/etc\/udev\/rules.d\/"//g |\
  1250. head --bytes=2)
  1251. chk=$(echo $number | grep "[0-9][0-9]")
  1252. if [ "$chk" = '' ];then
  1253. libsanerule=$(ls /lib/udev/rules.d/*.rules /etc/udev/rules.d/*.rules | \
  1254. grep sane-backends | head --line=1)
  1255. number=$(echo $libsanerule | \
  1256. sed s/"\/lib\/udev\/rules.d\/"//g |\
  1257. sed s/"\/etc\/udev\/rules.d\/"//g |\
  1258. head --bytes=2)
  1259. fi
  1260. chk=$(echo $number | grep "[0-9][0-9]")
  1261. if [ "$chk" != '' ];then
  1262. chk=$(grep "ENV{libsane_matched}=\"yes\"" $libsanerule | tail -1)
  1263. if [ "$chk" != '' ];then
  1264.  
  1265. ####
  1266. udevrulefile="/etc/udev/rules.d/${number}-brother-libsane-type1-inst.rules"
  1267. cat << %%_UDEV_RULE_%% > $udevrulefile
  1268. #
  1269. # udev rules sample for Brother MFP
  1270. # version 1.0.2-0
  1271. #
  1272. # Copyright (C) 2012-2017 Brother. Industries, Ltd.
  1273. #
  1274. # copy to /etc/udev/rules.d or /lib/udev/rules.d
  1275. #
  1276.  
  1277. ACTION!="add", GOTO="brother_mfp_end"
  1278. SUBSYSTEM=="usb", GOTO="brother_mfp_udev_1"
  1279. SUBSYSTEM!="usb_device", GOTO="brother_mfp_end"
  1280. LABEL="brother_mfp_udev_1"
  1281. SYSFS{idVendor}=="04f9", GOTO="brother_mfp_udev_2"
  1282. ATTRS{idVendor}=="04f9", GOTO="brother_mfp_udev_2"
  1283. GOTO="brother_mfp_end"
  1284. LABEL="brother_mfp_udev_2"
  1285. ATTRS{bInterfaceClass}!="0ff", GOTO="brother_mfp_end"
  1286. ATTRS{bInterfaceSubClass}!="0ff", GOTO="brother_mfp_end"
  1287. ATTRS{bInterfaceProtocol}!="0ff", GOTO="brother_mfp_end"
  1288. #MODE="0666"
  1289. #GROUP="scanner"
  1290. ENV{libsane_matched}="yes"
  1291. #SYMLINK+="scanner-%k"
  1292. LABEL="brother_mfp_end"
  1293. %%_UDEV_RULE_%%
  1294. ####
  1295. chmod 644 $udevrulefile
  1296. udev_installed=yes
  1297. fi
  1298. fi
  1299. }
  1300.  
  1301.  
  1302.  
  1303. scanner_install(){
  1304. DBG_MSG scanner_install
  1305.  
  1306. case "$SCANNER_DRV" in
  1307. "brscan")
  1308. drv_get_and_install $SCANFILE gpl_and_br_license Force
  1309. if [ $iinstall_result = Yes ];then
  1310. cpscanlibmodules "$scanlibmodules1"
  1311. make_brscan_uninstaller $SCANFILE "$SCANNER_DRV" "$scanlibmodules1"
  1312. install_done=yes
  1313. fi
  1314. scanconfig=brsaneconfig
  1315. drv_get_and_install $SKEYFILE brother_license Force
  1316. if [ $iinstall_result = Yes ];then
  1317. dellist=''
  1318. make_generic_uninstaller $SKEYFILE brscan-skey
  1319. install_done=yes
  1320. fi
  1321. ;;
  1322. "brscan2")
  1323. drv_get_and_install $SCANFILE gpl_and_br_license Force
  1324. if [ $iinstall_result = Yes ];then
  1325. cpscanlibmodules "$scanlibmodules2"
  1326. make_brscan2_uninstaller $SCANFILE "$SCANNER_DRV" "$scanlibmodules2"
  1327. install_done=yes
  1328. fi
  1329. scanconfig=brsaneconfig2
  1330. drv_get_and_install $SKEYFILE brother_license Force
  1331. if [ $iinstall_result = Yes ];then
  1332. dellist=''
  1333. make_generic_uninstaller $SKEYFILE brscan-skey
  1334. install_done=yes
  1335. fi
  1336. ;;
  1337. "brscan3")
  1338. drv_get_and_install $SCANFILE gpl_and_br_license Force
  1339. if [ $iinstall_result = Yes ];then
  1340. cpscanlibmodules "$scanlibmodules3"
  1341. make_generic_uninstaller $SCANFILE "$SCANNER_DRV" "$scanlibmodules3"
  1342. install_done=yes
  1343. fi
  1344. scanconfig=brsaneconfig3
  1345. drv_get_and_install $SKEYFILE brother_license Force
  1346. if [ $iinstall_result = Yes ];then
  1347. dellist=''
  1348. make_generic_uninstaller $SKEYFILE brscan-skey
  1349. install_done=yes
  1350. fi
  1351. ;;
  1352. "brscan4")
  1353. drv_get_and_install $SCANFILE brother_license Force
  1354. if [ $iinstall_result = Yes ];then
  1355. cpscanlibmodules "$scanlibmodules4"
  1356. make_generic_uninstaller $SCANFILE "$SCANNER_DRV" "$scanlibmodules4"
  1357. install_done=yes
  1358. fi
  1359. scanconfig=brsaneconfig4
  1360. drv_get_and_install $SKEYFILE brother_license Force
  1361. if [ $iinstall_result = Yes ];then
  1362. dellist=''
  1363. make_generic_uninstaller $SKEYFILE brscan-skey
  1364. install_done=yes
  1365. fi
  1366. ;;
  1367. "brscan5")
  1368. drv_get_and_install $SCANFILE brother_license Force
  1369. if [ $iinstall_result = Yes ];then
  1370. cpscanlibmodules "$scanlibmodules5"
  1371. make_generic_uninstaller $SCANFILE "$SCANNER_DRV" "$scanlibmodules5"
  1372. install_done=yes
  1373. fi
  1374. scanconfig=brsaneconfig5
  1375. drv_get_and_install $SKEYFILE brother_license Force
  1376. if [ $iinstall_result = Yes ];then
  1377. dellist=''
  1378. make_generic_uninstaller $SKEYFILE brscan-skey
  1379. install_done=yes
  1380. fi
  1381. ;;
  1382.  
  1383. * )
  1384. ;;
  1385. esac
  1386.  
  1387. udev_install
  1388.  
  1389. if [ $udev_installed = yes ];then
  1390. echo rm $udevrulefile >> uninstaller_${SCANNER_DRV}
  1391. fi
  1392.  
  1393. # install libusb-0.1-4 if not available
  1394.  
  1395. libusbchk=$(ls -R /lib /usr/lib /usr/sbin | grep 'libusb-0.1.so.4')
  1396.  
  1397. if [ "$libusbchk" = '' ];then
  1398. if [ "$(which apt-get 2>/dev/null)" != '' ];then
  1399. echo apt-get install libusb-0.1-4
  1400. apt-get install libusb-0.1-4
  1401. fi
  1402. fi
  1403.  
  1404. # libusb-0.1-4
  1405.  
  1406. post_proc
  1407.  
  1408. if [ "$scanconfig" != '' ] && \
  1409. [ "$PRODUCT_NAME" != '' ] && \
  1410. [ -f "$(which $scanconfig)" ];then
  1411. if [ "$(echo $deviceuri | grep 'usb://')" = '' ];then
  1412. if [ "$(echo $deviceuri | grep 'file://')" = '' ];then
  1413. if [ "$ipadrs" = '' ];then
  1414. echo -e -n $COLOR$MESSAGE220 #" enter IP address ->"
  1415. read ipadrs
  1416. echo -e $MONO
  1417. fi
  1418. fi
  1419. echo -n -e $COLOR4
  1420. echo $scanconfig -a name=$PRODUCT_NAME model=$PRODUCT_NAME ip=$ipadrs
  1421. echo -n -e $MONO
  1422. $scanconfig -a name=$PRODUCT_NAME model=$PRODUCT_NAME ip=$ipadrs
  1423. fi
  1424. fi
  1425.  
  1426. }
  1427.  
  1428. pre_proc(){
  1429. if [ "$preproc_done" = '' ];then
  1430. if [ "$PREPROC" != '' ];then
  1431. echo "$PREPROC" | /bin/bash
  1432. fi
  1433. fi
  1434. preproc_done=done
  1435. }
  1436.  
  1437. post_proc(){
  1438. if [ "$install_done" = yes ];then
  1439. if [ "$postproc_done" = '' ];then
  1440. if [ "$POSTPROC" != '' ];then
  1441. echo "$POSTPROC" | /bin/bash
  1442. fi
  1443. fi
  1444. postproc_done=done
  1445. fi
  1446. }
  1447.  
  1448. cleanup_deb_cups_pkg(){
  1449. if [ "$PKG" = deb ];then
  1450. if [ "$(which awk 2> /dev/null)" != '' ];then
  1451. installedpkgs=$($LSPKGCMD | grep -i cups | grep -i brother | \
  1452. awk '{print $2}')
  1453. for pkg in $installedpkgs
  1454. do
  1455. pkg2=$(echo $pkg | sed s/":.*$"//g)
  1456. if [ "$(echo $CUPSFILE | grep $pkg2 )" != '' ];then
  1457. $RMPKGCMD $pkg
  1458. break
  1459. fi
  1460. done
  1461. fi
  1462. fi
  1463. }
  1464.  
  1465.  
  1466. ipadrs=''
  1467. deviceuri="usb://"
  1468. PRODUCT_NAME=''
  1469.  
  1470. #
  1471. # START (MAIN)
  1472. #
  1473.  
  1474. HIDE_INF=YES
  1475.  
  1476. if [ "$(echo $0 | grep linux-brjprinter-installer)" = '' ];then
  1477. REGION=US
  1478. else
  1479. REGION=JPN
  1480. fi
  1481.  
  1482.  
  1483. DBG_MSG MAIN
  1484. dlresult=IDENTIC
  1485. lnk_flag=' '
  1486.  
  1487. if [ "$1" = '-h' ] || [ "$1" = '--help' ];then
  1488. echo -e $COLOR"$MESSAGE010"$0"$MESSAGE020"$MONO #"USAGE: $0 model"
  1489. echo -e $COLOR"$MESSAGE012"$0"$MESSAGE030"$MONO #"USAGE: $0 -f model"
  1490. echo -e $COLOR"$MESSAGE012"$0"$MESSAGE040"$MONO #"USAGE: $0 -l "
  1491. #DBG_MSG "exit 2"
  1492. exit 0
  1493. fi
  1494.  
  1495. if [ $(whoami) != 'root' ];then
  1496. echo -e $COLOR$MESSAGE050$MONO #"Only root can do this operation."
  1497. #DBG_MSG "exit 5"
  1498. exit 0
  1499. fi
  1500.  
  1501. if [ ! -f /etc/init.d/cups ] && [ ! -f /etc/init.d/cupsys ];then
  1502. if [ "$(which lpadmin 2> /dev/null)" = '' ];then
  1503. echo -e $COLOR$MESSAGE060$MONO #"CUPS is not installed."
  1504. if [ "$1" = '' ];then
  1505. echo -e -n $COLOR$MESSAGE240$MONO #"Hit Return/Enter Key"
  1506. read answer
  1507. fi
  1508. #DBG_MSG "exit 6"
  1509. exit 0
  1510. fi
  1511. fi
  1512.  
  1513. LIB64FLT=/usr/lib64/cups/filter
  1514. LIB32FLT=/usr/lib32/cups/filter
  1515. LIBFLT=/usr/lib/cups/filter
  1516.  
  1517.  
  1518. TESTPRINT=/usr/share/cups/data/testprint.ps
  1519. TESTPRINT2=/usr/share/cups/data/testprint
  1520.  
  1521.  
  1522. ## sweep
  1523. pre_install_sweep
  1524.  
  1525.  
  1526.  
  1527. package_list=NO
  1528. CACHEFLG='--no-cache'
  1529.  
  1530.  
  1531. infcheck=0
  1532. if [ "$1" = '--inf-check=1' ];then
  1533. infcheck=1
  1534. package_list=TEXT
  1535. fi
  1536. if [ "$1" = '--inf-check=2' ];then
  1537. infcheck=2
  1538. package_list=CSV
  1539. fi
  1540. if [ "$1" = '--inf-check=3' ];then
  1541. infcheck=3
  1542. package_list=CSV
  1543. fi
  1544. if [ "$1" = '--inf-check=4' ];then
  1545. infcheck=4
  1546. package_list=CSV
  1547. fi
  1548. if [ "$1" = '--inf-check=5' ];then
  1549. infcheck=5
  1550. package_list=CSV
  1551. fi
  1552.  
  1553.  
  1554.  
  1555. if [ package_list = TEXT ];then
  1556. echo -e -n $MONO
  1557. fi
  1558.  
  1559.  
  1560. if [ "$(which wget 2> /dev/null)" = '' ];then
  1561. if [ "$(which yum 2>/dev/null)" != '' ];then
  1562. echo yum install wget
  1563. yum install wget
  1564. elif [ "$(which dnf 2>/dev/null)" != '' ];then
  1565. echo dnf install wget
  1566. dnf install wget
  1567. elif [ "$(which apt-get 2>/dev/null)" != '' ];then
  1568. echo apt-get install wget
  1569. apt-get install wget
  1570. fi
  1571. fi
  1572.  
  1573.  
  1574. if [ "$(which wget 2> /dev/null)" = '' ];then
  1575. echo -e -n $COLOR$MESSAGE280 #"wget is required."
  1576. echo -e $MONO
  1577. #DBG_MSG "exit 7"
  1578. exit 0
  1579. fi
  1580.  
  1581. post_install_sweep
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587. if [ "$(which dpkg 2> /dev/null)" != '' ];then
  1588. PKG=deb
  1589. elif [ "$(which rpm 2> /dev/null)" != '' ];then
  1590. PKG=rpm
  1591. else
  1592. echo -e $COLOR$MESSAGE122$MONO #"Rpm or dpkg is required."
  1593. post_install_sweep
  1594. if [ "$1" = '' ];then
  1595. echo -e -n $COLOR$MESSAGE240$MONO #"Hit Return/Enter Key"
  1596. read answer
  1597. fi
  1598. #DBG_MSG "exit 9"
  1599. exit 0
  1600. fi
  1601.  
  1602.  
  1603. if [ "$PKG" = deb ];then
  1604. if [ "$(which awk 2> /dev/null)" = '' ];then
  1605. if [ "$(which apt-get 2>/dev/null)" != '' ];then
  1606. echo apt-get install mawk
  1607. apt-get install mawk
  1608. fi
  1609. fi
  1610. fi
  1611.  
  1612.  
  1613.  
  1614. if [ "$BROTHER_INSRALLER_FAKE_PKG" != '' ];then
  1615. PKG=$BROTHER_INSRALLER_FAKE_PKG
  1616. fi
  1617.  
  1618. if [ "$PKG" = deb ];then
  1619. PKGCMD='dpkg -i --force-all'
  1620. RMPKGCMD='dpkg -P'
  1621. LSPKGCMD='dpkg --list'
  1622. EXT='\.deb'
  1623. PKG=deb
  1624. elif [ "$PKG" = rpm ];then
  1625. PKGCMD='rpm -ihv --nodeps --replacefiles --replacepkgs'
  1626. RMPKGCMD='rpm -e'
  1627. LSPKGCMD='rpm -qa'
  1628. EXT='\.rpm'
  1629. PKG=rpm
  1630. fi
  1631.  
  1632. if [ "$1" = '-f' ] || \
  1633. [ "$1" = '--find' ] || \
  1634. [ "$1" = '--inf-check=1' ] || \
  1635. [ "$1" = '--inf-check=2' ] || \
  1636. [ "$1" = '--inf-check=3' ] || \
  1637. [ "$1" = '--inf-check=4' ] || \
  1638. [ "$1" = '--inf-check=5' ] || \
  1639. [ "$1" = '--inf-check=6' ] || \
  1640. [ "$1" = '-p' ];then
  1641. MODEL_tmp=$(echo $2 | sed s/'-'//g)
  1642. elif [ "$1" = '' ];then
  1643. echo -e -n $COLOR$MESSAGE121 #"Input model name->"
  1644. read modelinput
  1645. echo -e $MONO
  1646. MODEL_tmp=$(echo $modelinput | sed s/'-'//g)
  1647. else
  1648. MODEL_tmp=$(echo $1 | sed s/'-'//g)
  1649. fi
  1650.  
  1651. if [ "$(echo $MODEL_tmp | grep '@')" = '' ];then
  1652. MODEL=$MODEL_tmp
  1653. DEBUG_NOINSTALL='no'
  1654. else
  1655. MODEL=$(echo $MODEL_tmp | tr -d '@')
  1656. DEBUG_NOINSTALL='yes'
  1657. fi
  1658.  
  1659. if [ "$(echo $MODEL_tmp | grep '\[')" = '' ];then
  1660. MODEL=$MODEL_tmp
  1661. NODOWNLOAD=0
  1662. else
  1663. INFPATH="$(echo $MODEL_tmp | tr -d '[' | tr -d ']' )"
  1664. if [ ! -f $INFPATH ];then
  1665. echo -e $COLOR$MESSAGE130$MONO
  1666. exit 0
  1667. fi
  1668. MODEL=$(echo $MODEL_tmp | tr -d '[' | tr -d ']' | sed -e s/"^.*\/"//g)
  1669.  
  1670. NODOWNLOAD=1
  1671. fi
  1672.  
  1673.  
  1674.  
  1675. LPRFILE=""
  1676. CUPSFILE=""
  1677. PDRVFILE=""
  1678. SCANFILE=""
  1679. SKEYFILE=""
  1680.  
  1681.  
  1682. wkdir=/tmp/brprinter-installer
  1683. packdir=brother_driver_packdir
  1684. basedir=$(pwd)
  1685.  
  1686. modelnhuc=""
  1687. mkdir -p $wkdir
  1688.  
  1689. REGION2=$REGION
  1690.  
  1691.  
  1692. if [ -s "$(echo $1 | grep -e .${PKG})" ] && \
  1693. [ -s "$(echo $2 | grep -e .${PKG})" ] && \
  1694. [ -s "$(echo $1 | grep -e 'lp' -e 'cups')" ] && \
  1695. [ -s "$(echo $2 | grep -e 'lp' -e 'cups')" ] && \
  1696. [ -f $1 ] && \
  1697. [ -f $2 ] ; then
  1698.  
  1699. #install local files
  1700.  
  1701. tmpcup=$(echo $1 | grep cups)
  1702. tmplpr=$(echo $2 | grep lp)
  1703. if [ "$tmpcup" = '' ] || [ "$tmplpr" = '' ];then
  1704. tmpcup=$(echo $2 | grep cups)
  1705. tmplpr=$(echo $1 | grep lp)
  1706. fi
  1707.  
  1708. if [ "$tmpcup" = '' ] || [ "$tmplpr" = '' ];then
  1709. echo -e $COLOR$MESSAGE130$MONO #"Install packages does not be found."
  1710. exit 0
  1711. fi
  1712.  
  1713. echo [UNKNOWN] > $wkdir/LOCAL
  1714. echo PRN_CUP_RPM=$tmpcup >> $wkdir/LOCAL
  1715. echo PRN_CUP_DEB=$tmpcup >> $wkdir/LOCAL
  1716. echo PRN_LPD_RPM=$tmplpr >> $wkdir/LOCAL
  1717. echo PRN_LPD_DEB=$tmplpr >> $wkdir/LOCAL
  1718. echo PRN_DRV_RPM=$tmplpr >> $wkdir/LOCAL
  1719. echo PRN_DRV_DEB=$tmplpr >> $wkdir/LOCAL
  1720. echo PRINTERNAME=UNKNOWN >> $wkdir/LOCAL
  1721. echo SCANNER_DRV= >> $wkdir/LOCAL
  1722. echo SCANKEY_DRV= >> $wkdir/LOCAL
  1723.  
  1724. MODEL=LOCAL
  1725. NODOWNLOAD=2
  1726.  
  1727. fi
  1728.  
  1729. # network check
  1730.  
  1731. netaccess=FALSE
  1732. network_check HL5470DW
  1733. if [ $netaccess != SUCCESS ];then
  1734. network_check MFCJ6710CDW
  1735. fi
  1736.  
  1737. if [ $netaccess != SUCCESS ];then
  1738.  
  1739. echo -e -n $COLOR$MESSAGE070 #"Will you specify the PROXY server\? [y/N] ->"
  1740. read answer
  1741. if [ "$answer" = Y ] || [ "$answer" = y ]; then
  1742.  
  1743. #"enter PROXY server URL "
  1744. #" ex http://\(proxy-server-url\):\(port\)"
  1745. #" ex http://\(login-name\):\(pass-word\)@\(proxy-server-url\):\(port\)"
  1746. #" ->"
  1747.  
  1748. echo -e $COLOR$MESSAGE080
  1749. echo -e $COLOR$MESSAGE090
  1750. echo -e $COLOR$MESSAGE100
  1751. echo -e -n $COLOR$MESSAGE110
  1752. read proxy
  1753. echo -e $MONO
  1754. export http_proxy=$proxy
  1755. network_check HL5470DW
  1756. if [ $netaccess != SUCCESS ];then
  1757. network_check MFCJ6710CDW
  1758. fi
  1759. if [ $netaccess != SUCCESS ];then
  1760. echo -e $COLOR$MESSAGE120$MONO
  1761. exit 0
  1762. fi
  1763. else
  1764. echo -e $COLOR$MESSAGE120$MONO
  1765. exit 0
  1766. fi
  1767. fi
  1768.  
  1769.  
  1770.  
  1771.  
  1772. set_host_info $REGION
  1773. get_inf_file $MODEL $wkdir
  1774.  
  1775. if [ $REGION = JPN ];then
  1776. if [ ! -f ${wkdir}/${modelnhuc} ] || [ "${modelnhuc}" = '' ];then
  1777. REGION=US
  1778. modelnhuc=''
  1779. set_host_info $REGION
  1780. get_inf_file $MODEL $wkdir
  1781. REGION=JPN
  1782. fi
  1783. fi
  1784.  
  1785. if [ $infcheck = 0 ];then
  1786. if [ ! -f ${wkdir}/${modelnhuc} ] || [ "${modelnhuc}" = '' ];then
  1787. netaccess=FALSE
  1788. network_check HL5470DW
  1789. if [ $netaccess != SUCCESS ];then
  1790. network_check MFCJ6710CDW
  1791. fi
  1792.  
  1793. if [ $netaccess = SUCCESS ];then
  1794. echo -e $COLOR$MESSAGE130$MONO #"Install packages does not be found."
  1795. echo -e $COLOR$MESSAGE140$MONO #" Confirm the model name."
  1796. echo -e $MONO
  1797. exit 0
  1798. fi
  1799. echo -e -n $COLOR$MESSAGE070 #"Will you specify the PROXY server\? [y/N] ->"
  1800. read answer
  1801. if [ "$answer" = Y ] || [ "$answer" = y ]; then
  1802.  
  1803. #"enter PROXY server URL "
  1804. #" ex http://\(proxy-server-url\):\(port\)"
  1805. #" ex http://\(login-name\):\(pass-word\)@\(proxy-server-url\):\(port\)"
  1806. #" ->"
  1807.  
  1808. echo -e $COLOR$MESSAGE080
  1809. echo -e $COLOR$MESSAGE090
  1810. echo -e $COLOR$MESSAGE100
  1811. echo -e -n $COLOR$MESSAGE110
  1812. read proxy
  1813. echo -e $MONO
  1814. export http_proxy=$proxy
  1815. else
  1816. echo -e $MONO
  1817. #DBG_MSG "exit 10"
  1818. exit 0
  1819. fi
  1820. echo -e $MONO
  1821. REGION=$REGION2
  1822.  
  1823. set_host_info $REGION
  1824. get_inf_file $MODEL $wkdir
  1825.  
  1826. if [ $REGION = JPN ];then
  1827. if [ ! -f ${wkdir}/${modelnhuc} ] || [ "${modelnhuc}" = '' ];then
  1828. REGION=US
  1829. modelnhuc=''
  1830. set_host_info $REGION
  1831. get_inf_file $MODEL $wkdir
  1832. fi
  1833. REGION=JPN
  1834. fi
  1835. fi
  1836. fi
  1837.  
  1838. if [ ! -f ${wkdir}/${modelnhuc} ] || [ "${modelnhuc}" = '' ];then
  1839. #"Cannot get server information. Confirm the network."
  1840. if [ $infcheck = 0 ];then
  1841. echo -e $COLOR$MESSAGE120$MONO
  1842. exit 0
  1843. fi
  1844. if [ $package_list = TEXT ];then
  1845. echo "PACKAGE:PRNL="$LPRFILE
  1846. echo "PACKAGE:PRNC="$CUPSFILE
  1847. echo "PACKAGE:PDRV="$PDRVFILE
  1848. echo "PACKAGE:SCAN="$SCANFILE
  1849. echo "PACKAGE:SKEY="$SKEYFILE
  1850. exit 0
  1851. fi
  1852. if [ $package_list = CSV ];then
  1853. echo "$2"":,"$PKG",${dlresult},${lnk_flag}"\
  1854. ,$LPRFILE,$CUPSFILE,$PDRVFILE,$SCANFILE,$SKEYFILE
  1855. exit 0
  1856. fi
  1857.  
  1858. touch brother-drivers/"$0".log
  1859. dlresult="FALSE "
  1860. lnk_flag=" "
  1861. rccups=" "
  1862. rclpr=" "
  1863. rcscan=" "
  1864. rcskey=" "
  1865.  
  1866. if [ "$infcheck" = 3 ];then
  1867. echo "$2"":,"$PKG",${dlresult},${lnk_flag}","$SCANNER_DRV"\
  1868. ,$rccups,$rclpr,$rcscan,$rcskey\
  1869. >> brother-drivers/"$0".log
  1870. rm -fR brother-drivers/$2 2> /dev/null
  1871. fi
  1872.  
  1873. if [ "$infcheck" = 4 ] || [ "$infcheck" = 5 ];then
  1874.  
  1875. echo "$2"":,"$PKG",${dlresult},${lnk_flag}","$SCANNER_DRV"\
  1876. ,$rccups,$rclpr,$rcscan,$rcskey\
  1877. ,$LPRFILE,$CUPSFILE,$PDRVFILE,$SCANFILE,$SKEYFILE \
  1878. >> brother-drivers/"$0".log
  1879. fi
  1880.  
  1881.  
  1882. exit 0
  1883. fi
  1884.  
  1885. arch=$(uname -m | grep "amd64")
  1886. if [ "$arch" = '' ];then
  1887. arch=$(uname -m | grep "x86_64")
  1888. fi
  1889. if [ "$arch" = '' ];then
  1890. arch=i386
  1891. fi
  1892.  
  1893. if [ "$BROTHER_INSRALLER_FAKE_ARC" != '' ];then
  1894. arch=$BROTHER_INSRALLER_FAKE_ARC
  1895. fi
  1896.  
  1897. get_packages_name ${modelnhuc}
  1898.  
  1899. if [ -f ${wkdir}/${modelnhuc} ];then
  1900. rm -f ${wkdir}/${modelnhuc} 2> /dev/null
  1901. fi
  1902.  
  1903. if [ $infcheck = 1 ];then
  1904. echo "PACKAGE:PRNL="$LPRFILE
  1905. echo "PACKAGE:PRNC="$CUPSFILE
  1906. echo "PACKAGE:PDRV="$PDRVFILE
  1907. echo "PACKAGE:SCAN="$SCANFILE
  1908. echo "PACKAGE:SKEY="$SKEYFILE
  1909. exit 0
  1910. fi
  1911. if [ $infcheck = 2 ];then
  1912. echo "$2"":,"$PKG",${dlresult},${lnk_flag}"\
  1913. ,$LPRFILE,$CUPSFILE,$PDRVFILE,$SCANFILE,$SKEYFILE
  1914. exit 0
  1915. fi
  1916.  
  1917.  
  1918.  
  1919. if [ "$infcheck" -ge 3 ];then
  1920. rccups='N/A '
  1921. rclpr='N/A '
  1922. rcscan='N/A '
  1923. rcskey='N/A '
  1924.  
  1925. dwkdir=brother-drivers/$2
  1926. mkdir -p $dwkdir
  1927. if [ "$CUPSFILE" != '' ];then
  1928. rccups="FALSE "
  1929. wget $WGET_OP '-nc' $URL_PKG/$CUPSFILE -P $dwkdir
  1930. fi
  1931. if [ "$LPRFILE" != '' ];then
  1932. rclpr="FALSE "
  1933. wget $WGET_OP '-nc' $URL_PKG/$LPRFILE -P $dwkdir
  1934. fi
  1935. if [ "$PDRVFILE" != '' ];then
  1936. rcpdrv="FALSE "
  1937. wget $WGET_OP '-nc' $URL_PKG/$PDRVFILE -P $dwkdir
  1938. fi
  1939. if [ "$SCANFILE" != '' ];then
  1940. rcscan="FALSE "
  1941. wget $WGET_OP '-nc' $URL_PKG/$SCANFILE -P $dwkdir
  1942. fi
  1943. if [ "$SKEYFILE" != '' ];then
  1944. rcskey="FALSE "
  1945. wget $WGET_OP '-nc' $URL_PKG/$SKEYFILE -P $dwkdir
  1946. fi
  1947.  
  1948. # -------------
  1949. if [ "$CUPSFILE" != '' ];then
  1950. if [ -f $dwkdir/$CUPSFILE ];then
  1951. rccups=SUCCESS
  1952. fi
  1953. fi
  1954. if [ "$LPRFILE" != '' ];then
  1955. if [ -f $dwkdir/$LPRFILE ];then
  1956. rclpr=SUCCESS
  1957. fi
  1958. fi
  1959. if [ "$PDRVFILE" != '' ];then
  1960. if [ -f $dwkdir/$PDRVFILE ];then
  1961. rcpdrv=SUCCESS
  1962. fi
  1963. fi
  1964. if [ "$SCANFILE" != '' ];then
  1965. if [ -f $dwkdir/$SCANFILE ];then
  1966. rcscan=SUCCESS
  1967. fi
  1968. fi
  1969. if [ "$SKEYFILE" != '' ];then
  1970. if [ -f $dwkdir/$SKEYFILE ];then
  1971. rcskey=SUCCESS
  1972. fi
  1973. fi
  1974.  
  1975. # -------------
  1976.  
  1977. touch brother-drivers/"$0".log
  1978.  
  1979. if [ "$infcheck" = 3 ];then
  1980. echo "$2"":,${modelnhuc},"$PKG",${dlresult},${lnk_flag}","$SCANNER_DRV"\
  1981. ,$rccups,$rclpr,$rcscan,$rcskey\
  1982. >> brother-drivers/"$0".log
  1983. fi
  1984.  
  1985. if [ "$infcheck" = 4 ] || [ "$infcheck" = 5 ];then
  1986.  
  1987. echo "$2"":,${modelnhuc},"$PKG",${dlresult},${lnk_flag}","$SCANNER_DRV"\
  1988. ,$rccups,$rclpr,$rcscan,$rcskey\
  1989. ,$LPRFILE,$CUPSFILE,$PDRVFILE,$SCANFILE,$SKEYFILE \
  1990. >> brother-drivers/"$0".log
  1991. fi
  1992.  
  1993. if [ "$infcheck" = 3 ] || [ "$infcheck" = 4 ];then
  1994. rm -fR brother-drivers/$2 2> /dev/null
  1995. fi
  1996. exit 0
  1997. fi
  1998.  
  1999.  
  2000. if [ "$CUPSFILE" = '' ] && [ "$LPRFILE" = '' ] && [ "$PDRVFILE" = '' ] && [ "$SCAN" = '' ];then
  2001. echo -e $COLOR$MESSAGE130$MONO #"Install packages does not be found."
  2002. echo -e $COLOR$MESSAGE140$MONO #" Confirm the model name."
  2003.  
  2004. post_install_sweep
  2005.  
  2006. if [ "$1" = '' ];then
  2007. echo -e -n $COLOR$MESSAGE240$MONO #"Hit Return/Enter Key"
  2008. read answer
  2009. fi
  2010. #DBG_MSG "exit 12"
  2011. exit 0
  2012. fi
  2013.  
  2014.  
  2015. if [ "$1" = '-f' ] || [ "$1" = '--find' ];then
  2016. echo $LPRFILE
  2017. echo $CUPSFILE
  2018. echo $PDRVFILE
  2019. echo $SCANFILE
  2020. echo $SKEYFILE
  2021.  
  2022. post_install_sweep
  2023. #DBG_MSG "exit 13"
  2024. exit 0
  2025. fi
  2026.  
  2027.  
  2028.  
  2029.  
  2030. PREPKGCMDC=''
  2031. PREPKGCMDL=''
  2032. PREPKGCMDP=''
  2033. if [ "$PKG" = deb ];then
  2034. if [ "$CUPSFILE" != '' ];then
  2035. PREPKGCMDC="dpkg -x $CUPSFILE /"
  2036. fi
  2037. if [ "$PDRVFILE" != '' ];then
  2038. PREPKGCMDP="dpkg -x $PDRVFILE /"
  2039. fi
  2040. if [ "$LPRFILE" != '' ];then
  2041. PREPKGCMDL="dpkg -x $LPRFILE /"
  2042. fi
  2043. fi
  2044.  
  2045. post_install_sweep
  2046.  
  2047.  
  2048. echo -e $COLOR4$MESSAGE150$MONO #"You are going to install following packages."
  2049.  
  2050. if [ "$LPRFILE" != '' ];then
  2051. echo -e $COLOR4" "$LPRFILE$MONO
  2052. fi
  2053. if [ "$CUPSFILE" != '' ];then
  2054. echo -e $COLOR4" "$CUPSFILE$MONO
  2055. fi
  2056. if [ "$PDRVFILE" != '' ];then
  2057. echo -e $COLOR4" "$PDRVFILE$MONO
  2058. fi
  2059.  
  2060. if [ "$SCANFILE" != '' ];then
  2061. echo -e $COLOR4" "$SCANFILE
  2062. fi
  2063. if [ "$SKEYFILE" != '' ];then
  2064. echo -e $COLOR4" "$SKEYFILE
  2065. fi
  2066.  
  2067.  
  2068.  
  2069. echo -e -n $COLOR$MESSAGE160 #"OK\? [y/N] ->"
  2070.  
  2071. read answer
  2072. echo -e $MONO
  2073.  
  2074. if [ "$answer" != Y ] && [ "$answer" != y ]; then
  2075. #scanner_install # scanner
  2076. #DBG_MSG "exit 14"
  2077. exit 0
  2078. fi
  2079.  
  2080. if [ "$LPRFILE" != '' ];then
  2081. if ! [ -f "$LPRFILE" ];then
  2082. brother_license
  2083.  
  2084. echo -e -n $COLOR$MESSAGE170 #"Are you agree\? [Y/n] ->"
  2085.  
  2086. read answer
  2087. echo -e $MONO
  2088.  
  2089. if [ "$answer" = N ] || [ "$answer" = n ]; then
  2090. scanner_install # scanner
  2091. post_proc
  2092. #DBG_MSG "exit 15"
  2093. exit 0
  2094. fi
  2095.  
  2096.  
  2097. if [ "$(which wget 2> /dev/null)" = '' ];then
  2098. echo -e -n $COLOR$MESSAGE280 #"wget is required."
  2099. echo -e $MONO
  2100. #DBG_MSG "exit 16"
  2101. exit 0
  2102. fi
  2103. if [ ! -f $LPRFILE ];then
  2104. rm -f $LPRFILE 2> /dev/null
  2105. echo wget $WGET_OP $CACHEFLG $URL_PKG/$LPRFILE
  2106. wget $WGET_OP $CACHEFLG $URL_PKG/$LPRFILE
  2107. fi
  2108. fi
  2109. fi
  2110.  
  2111. if [ "$CUPSFILE" != '' ];then
  2112. if ! [ -f "$CUPSFILE" ];then
  2113.  
  2114. gpl_license
  2115.  
  2116. echo -e -n $COLOR$MESSAGE180 #"Do you agree\? [Y/n] ->"
  2117. read answer
  2118. echo -e $MONO
  2119.  
  2120. if [ "$answer" = N ] || [ "$answer" = n ]; then
  2121. scanner_install # scanner
  2122. post_proc
  2123. #DBG_MSG "exit 17"
  2124. exit 0
  2125. fi
  2126. if [ "$(which wget 2> /dev/null)" = '' ];then
  2127. echo -e -n $COLOR$MESSAGE280 #"wget is required."
  2128. echo -e $MONO
  2129. #DBG_MSG "exit 18"
  2130. exit 0
  2131. fi
  2132.  
  2133. if [ ! -f $CUPSFILE ];then
  2134. rm -f $CUPSFILE 2> /dev/null
  2135. echo wget $WGET_OP $CACHEFLG $URL_PKG/$CUPSFILE
  2136. wget $WGET_OP $CACHEFLG $URL_PKG/$CUPSFILE
  2137. fi
  2138.  
  2139. fi
  2140. fi
  2141.  
  2142. #--
  2143. if [ "$PDRVFILE" != '' ];then
  2144. if ! [ -f "$PDRVFILE" ];then
  2145.  
  2146. pdrv_complex_license
  2147.  
  2148. echo -e -n $COLOR$MESSAGE180 #"Do you agree\? [Y/n] ->"
  2149. read answer
  2150. echo -e $MONO
  2151.  
  2152. if [ "$answer" = N ] || [ "$answer" = n ]; then
  2153. scanner_install # scanner
  2154. post_proc
  2155. #DBG_MSG "exit 17"
  2156. exit 0
  2157. fi
  2158. if [ "$(which wget 2> /dev/null)" = '' ];then
  2159. echo -e -n $COLOR$MESSAGE280 #"wget is required."
  2160. echo -e $MONO
  2161. #DBG_MSG "exit 18"
  2162. exit 0
  2163. fi
  2164.  
  2165. if [ ! -f $PDRVFILE ];then
  2166. rm -f $PDRVFILE 2> /dev/null
  2167. echo wget $WGET_OP $CACHEFLG $URL_PKG/$PDRVFILE
  2168. wget $WGET_OP $CACHEFLG $URL_PKG/$PDRVFILE
  2169. fi
  2170.  
  2171. fi
  2172. fi
  2173.  
  2174.  
  2175.  
  2176.  
  2177. pre_proc
  2178.  
  2179. require_386lib=no
  2180. if [ "$arch" != 'i386' ];then
  2181. require_386lib=yes
  2182. if [ "$REQ32LIB" = 'NO' ] || \
  2183. [ "$REQ32LIB" = 'No' ] || \
  2184. [ "$REQ32LIB" = 'no' ];then
  2185. require_386lib=no
  2186. fi
  2187. fi
  2188.  
  2189. if [ "$require_386lib" = yes ];then
  2190. if [ "$(which dpkg 2>/dev/null)" != '' ];then
  2191. ia32=$(dpkg -l | grep "ia32-libs")
  2192. lib32=$(dpkg -l | grep "lib32stdc++6")
  2193.  
  2194. if [ "$ia32" = '' ] || [ "$lib32" = '' ];then
  2195. apt-get update
  2196. fi
  2197.  
  2198. if [ "$ia32" = '' ];then
  2199. apt-get install ia32-libs
  2200. fi
  2201. lib32=$(dpkg -l | grep "lib32stdc++6")
  2202. if [ "$lib32" = '' ];then
  2203. apt-get install lib32stdc++6
  2204. fi
  2205. fi
  2206. #----------- check Fedor,CentOS,RedHat 64 --------------
  2207. if [ -e /etc/fedora-release ] || [ -e /etc/fedora ] || \
  2208. [ -e /etc/centos-release ] || [ -e /etc/centos ] || \
  2209. [ -e /etc/redhat-release ] || [ -e /etc/redhat ]; then
  2210. lib32=$(rpm -qa| grep glibc | grep i686)
  2211. if [ "$lib32" = "" ];then
  2212. if [ "$(which yum 2>/dev/null)" != '' ];then
  2213. echo yum install glibc.i686
  2214. yum install glibc.i686
  2215. echo yum install libstdc++.i686
  2216. yum install libstdc++.i686
  2217. else
  2218. echo dnf install glibc.i686
  2219. dnf install glibc.i686
  2220. echo dnf install libstdc++.i686
  2221. dnf install libstdc++.i686
  2222. fi
  2223. fi
  2224. fi
  2225. fi
  2226.  
  2227.  
  2228. DUMMYCUPSYS=0
  2229. DUMMYCUPS=0
  2230. DUMMYLPD=0
  2231. DUMMYLPRNG=0
  2232. if ! [ -f /etc/init.d/cupsys ];then
  2233. DUMMYCUPSYS=1
  2234. ln -s /bin/true /etc/init.d/cupsys
  2235. fi
  2236.  
  2237. if ! [ -f /etc/init.d/cups ];then
  2238. DUMMYCUPS=1
  2239. ln -s /bin/true /etc/init.d/cups
  2240. fi
  2241.  
  2242. if ! [ -f /etc/init.d/lpd ];then
  2243. DUMMYLPD=1
  2244. ln -s /bin/true /etc/init.d/lpd
  2245. fi
  2246.  
  2247. if ! [ -f /etc/init.d/lprng ];then
  2248. DUMMYLPRNG=1
  2249. ln -s /bin/true /etc/init.d/lprng
  2250. fi
  2251.  
  2252. LPADMIN=lpadmin
  2253. LPINFO=lpinfo
  2254.  
  2255. if ! [ "$(which $LPADMIN 2> /dev/null)" ];then
  2256. LPADMIN=/usr/sbin/lpadmin
  2257. fi
  2258.  
  2259. if ! [ "$(which $LPINFO 2> /dev/null)" ];then
  2260. LPINFO=/usr/sbin/lpinfo
  2261. fi
  2262.  
  2263.  
  2264. mkmodeldir=0
  2265. if [ ! -d /usr/share/cups/model ];then
  2266. mkdir -p /usr/share/cups/model
  2267. mkmodeldir=1
  2268. fi
  2269.  
  2270.  
  2271. if [ "$PREPKGCMDL" != '' ];then
  2272. echo $PREPKGCMDL
  2273. $PREPKGCMDL
  2274. fi
  2275. if [ "$PREPKGCMDC" != '' ];then
  2276. echo $PREPKGCMDC
  2277. $PREPKGCMDC
  2278. fi
  2279. if [ "$PREPKGCMDP" != '' ];then
  2280. echo $PREPKGCMDP
  2281. $PREPKGCMDP
  2282. fi
  2283.  
  2284.  
  2285. if [ "$PKG" = deb ];then
  2286. cleanup_deb_cups_pkg
  2287.  
  2288. # for Ubuntu 11.04
  2289. debfile=$(echo $LPRFILE | sed s/\.i386.deb/a\.i386.deb/g)
  2290. mkdir -p $wkdir/$packdir
  2291.  
  2292. if [ "$LPRFILE" != '' ];then
  2293.  
  2294. cp $basedir/$LPRFILE $wkdir/$packdir
  2295. cd $wkdir/$packdir
  2296.  
  2297. dpkg-deb -e $LPRFILE DEBIAN
  2298. dpkg -x $LPRFILE ./
  2299.  
  2300. cat DEBIAN/control \
  2301. | sed s/Depends.*$//g \
  2302. | tr -s '\n' \
  2303. > DEBIAN/control.tmp
  2304.  
  2305. mv -f DEBIAN/control.tmp DEBIAN/control
  2306.  
  2307. rm -f $LPRFILE 2> /dev/null
  2308. rm -fR usr/share/doc/* 2> /dev/null
  2309. LPRFILE=$debfile
  2310.  
  2311. cd $wkdir
  2312. dpkg -b ./$packdir $debfile
  2313. echo dpkg -b ./$packdir $debfile
  2314.  
  2315. rm -fR $wkdir/$packdir/* 2> /dev/null
  2316. fi
  2317.  
  2318. if [ "$CUPSFILE" != '' ];then
  2319. debfile=$(echo $CUPSFILE | sed s/\.i386.deb/a\.i386.deb/g)
  2320.  
  2321. cp $basedir/$CUPSFILE $wkdir/$packdir
  2322. cd $wkdir/$packdir
  2323.  
  2324. dpkg-deb -e $CUPSFILE DEBIAN
  2325. dpkg -x $CUPSFILE ./
  2326.  
  2327. cat DEBIAN/control \
  2328. | sed s/Depends.*$//g \
  2329. | tr -s '\n' \
  2330. > DEBIAN/control.tmp
  2331.  
  2332. mv -f DEBIAN/control.tmp DEBIAN/control
  2333.  
  2334. rm -f $CUPSFILE 2> /dev/null
  2335. rm -fR usr/share/doc/* 2> /dev/null
  2336. cd $wkdir
  2337.  
  2338. dpkg -b ./$packdir $debfile
  2339. echo dpkg -b ./$packdir $debfile
  2340. CUPSFILE=$debfile
  2341. rm -fR $wkdir/$packdir 2> /dev/null
  2342. fi
  2343.  
  2344. if [ "$PDRVFILE" != '' ];then
  2345. debfile=$(echo $PDRVFILE | sed s/\.i386.deb/a\.i386.deb/g)
  2346.  
  2347. cp $basedir/$PDRVFILE $wkdir/$packdir
  2348. cd $wkdir/$packdir
  2349.  
  2350. dpkg-deb -e $PDRVFILE DEBIAN
  2351. dpkg -x $PDRVFILE ./
  2352.  
  2353. cat DEBIAN/control \
  2354. | sed s/Depends.*$//g \
  2355. | tr -s '\n' \
  2356. > DEBIAN/control.tmp
  2357.  
  2358. mv -f DEBIAN/control.tmp DEBIAN/control
  2359.  
  2360. rm -f $PDRVFILE 2> /dev/null
  2361. rm -fR usr/share/doc/* 2> /dev/null
  2362. cd $wkdir
  2363.  
  2364. dpkg -b ./$packdir $debfile
  2365. echo dpkg -b ./$packdir $debfile
  2366. PDRVFILE=$debfile
  2367. rm -fR $wkdir/$packdir 2> /dev/null
  2368. fi
  2369.  
  2370.  
  2371. if [ "$CUPSFILE" != '' ];then
  2372. mv $wkdir/$CUPSFILE $basedir
  2373. fi
  2374. if [ "$LPRFILE" != '' ];then
  2375. mv $wkdir/$LPRFILE $basedir
  2376. fi
  2377. if [ "$PDRVFILE" != '' ];then
  2378. mv $wkdir/$PDRVFILE $basedir
  2379. fi
  2380. fi
  2381.  
  2382. cd $basedir
  2383.  
  2384. if [ "$DEBUG_NOINSTALL" != 'yes' ];then
  2385. if [ "$LPRFILE" != '' ];then
  2386. echo -n -e $COLOR4
  2387. echo $PKGCMD $LPRFILE
  2388. echo -n -e $MONO
  2389. $PKGCMD $LPRFILE
  2390. fi
  2391.  
  2392. if [ "$CUPSFILE" != '' ];then
  2393. echo -n -e $COLOR4
  2394. echo $PKGCMD $CUPSFILE
  2395. echo -n -e $MONO
  2396. $PKGCMD $CUPSFILE | tee /tmp/brother_linux_brprinter_installer.tmp
  2397. echo -n -e $MONO
  2398. fi
  2399.  
  2400. if [ "$PDRVFILE" != '' ];then
  2401. echo -n -e $COLOR4
  2402. echo $PKGCMD $PDRVFILE
  2403. echo -n -e $MONO
  2404. $PKGCMD $PDRVFILE | tee /tmp/brother_linux_brprinter_installer.tmp
  2405. echo -n -e $MONO
  2406. fi
  2407. else
  2408. echo -n -e $COLOR4
  2409. if [ "$LPRFILE" != '' ];then
  2410. echo $PKGCMD $LPRFILE
  2411. fi
  2412. sleep 1
  2413. if [ "$CUPSFILE" != '' ];then
  2414. echo $PKGCMD $CUPSFILE
  2415. fi
  2416. sleep 1
  2417. if [ "$PDRVFILE" != '' ];then
  2418. echo $PKGCMD $PDRVFILE
  2419. fi
  2420.  
  2421. echo -n -e $MONO
  2422. fi
  2423. install_done=yes
  2424.  
  2425. #if [ "$PKG" = deb ];then
  2426. # rm -f $LPRFILE 2> /dev/null
  2427. # rm -f $CUPSFILE 2> /dev/null
  2428. #fi
  2429.  
  2430.  
  2431. if [ -f /tmp/brother_linux_brprinter_installer.tmp ];then
  2432. csherr=$(cat /tmp/brother_linux_brprinter_installer.tmp | \
  2433. grep 'ERROR: csh is required')
  2434.  
  2435. if [ "$csherr" != "" ];then
  2436. echo -e -n $COLOR
  2437. echo $MESSAGE250
  2438. echo -e $MONO
  2439. #DBG_MSG "exit 19"
  2440. exit 0
  2441. fi
  2442. fi
  2443.  
  2444.  
  2445. #wait for installation end
  2446. RAWINSTALLED=yes
  2447. if [ "$PRINTERNAME" != UNKNOWN ];then
  2448. retry='0'
  2449. if [ "$DEBUG_NOINSTALL" != 'yes' ];then
  2450. while [ ! -f /etc/cups/ppd/"$PRINTERNAME".ppd ] && [ "$retry" -le $TIMEOUT ] ;do
  2451. sleep 1
  2452. retry=$(($retry+1))
  2453. echo -n \#
  2454. done
  2455. if [ -f /etc/cups/ppd/"$PRINTERNAME".ppd ];then
  2456. RAWINSTALLED=no
  2457. fi
  2458. else
  2459. sleep 1
  2460. fi
  2461. else
  2462. retry='0'
  2463. if [ "$DEBUG_NOINSTALL" != 'yes' ];then
  2464. while [ $retry -le $TIMEOUT ] ;do
  2465. sleep 1
  2466. for ppd in $(ls /etc/cups/ppd/*.ppd)
  2467. do
  2468. modelname=$(echo $ppd | sed s/\.ppd//g | sed s/"\/etc\/cups\/"//g)
  2469. modelname2=$(echo $modelname | tr -d '-' | tr "[A-Z]" "[a-z]")
  2470.  
  2471. file=$(echo $CUPSFILE | tr -d '-' | tr "[A-Z]" "[a-z]")
  2472. if [ "$(echo $file | grep $modelname2)" != '' ];then
  2473. retry=512
  2474. PRINTERNAME=$(echo $modelname | tr "[a-z]" "[A-Z]")
  2475. RAWINSTALLED=no
  2476. echo PRINTERNAME=$modelname
  2477. break
  2478. fi
  2479. done
  2480. retry=$(($retry+1))
  2481. echo -n \#
  2482. done
  2483.  
  2484. if [ "$PRINTERNAME" = UNKNOWN ];then
  2485.  
  2486. PRINTERNAME=$(echo $CUPSFILE | \
  2487. sed s/"^br"//g | \
  2488. sed s/"^cupswrapper"//g | \
  2489. sed s/"cupswrapper-.*$"//g | \
  2490. sed s/"cupswrapperinch-.*$"//g | \
  2491. sed s/"cups-.*$"//g | \
  2492. sed s/"-.*$"//g | \
  2493. sed s/"_.*$"//g | \
  2494. tr "[a-z]" "[A-Z]")
  2495. fi
  2496.  
  2497. else
  2498. sleep 1
  2499. fi
  2500. fi
  2501.  
  2502. PPDOPT=''
  2503. if [ "$RAWINSTALLED" = 'yes' ];then
  2504. for ppd in $(ls /usr/share/ppd/*.ppd /usr/share/cups/model/*.ppd)
  2505. do
  2506. ppd2=$(echo $ppd | tr -d '-')
  2507. prnname=$(echo $PRINTERNAME | tr -d '-')
  2508. if [ "$(echo $ppd2 | grep -i $prnname)" != '' ];then
  2509. PPDOPT="-P $ppd"
  2510. break
  2511. fi
  2512. done
  2513. fi
  2514.  
  2515.  
  2516. echo \#
  2517.  
  2518. #------------
  2519.  
  2520. if [ "$DUMMYCUPS" = 1 ];then
  2521. if [ "$(ls -al /etc/init.d/cups 2> /dev/null | grep ^l )" != '' ];then
  2522. rm -f /etc/init.d/cups 2> /dev/null
  2523. fi
  2524. fi
  2525.  
  2526. if [ "$DUMMYCUPSYS" = 1 ];then
  2527. if [ "$(ls -al /etc/init.d/cupsys 2> /dev/null | grep ^l )" != '' ];then
  2528. rm -f /etc/init.d/cupsys 2> /dev/null
  2529. fi
  2530. fi
  2531.  
  2532. if [ "$DUMMYLPD" = 1 ];then
  2533. if [ "$(ls -al /etc/init.d/lpd 2> /dev/null | grep ^l )" != '' ];then
  2534. rm -f /etc/init.d/lpd 2> /dev/null
  2535. fi
  2536. fi
  2537.  
  2538. if [ "$DUMMYLPRNG" = 1 ];then
  2539. if [ "$(ls -al /etc/init.d/lprng 2> /dev/null | grep ^l )" != '' ];then
  2540. rm -f /etc/init.d/lprng 2> /dev/null
  2541. fi
  2542. fi
  2543.  
  2544. #------------
  2545.  
  2546.  
  2547.  
  2548. # for SuSE 64
  2549. if [ "$arch" != "i386" ];then
  2550. if [ -d "$LIB64FLT" ] && [ -d "$LIBFLT" ] ;then
  2551. filter=$(ls $LIBFLT 2> /dev/null | grep -i $PRINTERNAME | head -n 1 )
  2552. filter64=$(ls $LIB64FLT 2> /dev/null | grep -i $PRINTERNAME | head -n 1 )
  2553. if [ "$filter" != '' ] && [ "$filter64" = '' ];then
  2554. echo cp "$LIBFLT"/$filter "$LIB64FLT"
  2555. cp "$LIBFLT"/$filter "$LIB64FLT"
  2556. echo -n -e $COLOR4
  2557. echo $LPADMIN -p $PRINTERNAME -E $PPDOPT
  2558. echo -n -e $MONO
  2559. $LPADMIN -p $PRINTERNAME -E $PPDOPT
  2560. rm64filter="rm -f $LIB64FLT/$filter"
  2561. fi
  2562. fi
  2563.  
  2564. if [ -d "$LIB32FLT" ]&& [ -d "$LIBFLT" ] ;then
  2565. filter=$(ls $LIBFLT 2> /dev/null | grep -i $PRINTERNAME | head -n 1 )
  2566. filter32=$(ls $LIB32FLT 2> /dev/null| grep -i $PRINTERNAME | head -n 1 )
  2567. if [ "$filter" != '' ] && [ "$filter64" = '' ];then
  2568. echo cp "$LIBFLT"/$filter "$LIB32FLT"
  2569. cp "$LIBFLT"/$filter "$LIB32FLT"
  2570. echo -n -e $COLOR4
  2571. echo $LPADMIN -p $PRINTERNAME -E $PPDOPT
  2572. echo -n -e $MONO
  2573. $LPADMIN -p $PRINTERNAME -E $PPDOPT
  2574. rm32filter="rm -f $LIB64FLT/$filter"
  2575. fi
  2576. fi
  2577.  
  2578. fi
  2579.  
  2580.  
  2581. ## /usr/lib32
  2582. LPRPKGNAME=$(echo $LPRFILE |\
  2583. sed s/"_.*$"//g |\
  2584. sed s/"-.*$"//g)
  2585.  
  2586. pkgpostfix=''
  2587.  
  2588. if [ "$PKG" = deb ];then
  2589. if [ "${LPRPKGNAME}" != '' ];then
  2590. if [ "$(dpkg -l | grep ${LPRPKGNAME}:i386)" != '' ];then
  2591. pkgpostfix=':i386'
  2592. fi
  2593. files=$(dpkg -L "$LPRPKGNAME""$pkgpostfix" | grep '/usr/lib/')
  2594. else
  2595. files=""
  2596. fi
  2597. fi
  2598.  
  2599.  
  2600. if [ "$PKG" = rpm ];then
  2601. if [ "${LPRPKGNAME}" != '' ];then
  2602. files=$(rpm -q --filesbypkg $LPRPKGNAME | \
  2603. grep '/usr/lib/' | \
  2604. sed s/"$LPRPKGNAME"//g | \
  2605. sed s/' '//g)
  2606. else
  2607. files=""
  2608. fi
  2609. fi
  2610.  
  2611.  
  2612.  
  2613. #--------------------------------
  2614. # make uninstall script
  2615.  
  2616. DBG_MSG "make uninstaller script for printer : uninstaller_${PRINTERNAME}"
  2617.  
  2618. uninstaller_prn=uninstaller_${PRINTERNAME}
  2619. rm -f $uninstaller_prn 2> /dev/null
  2620. echo "#! /bin/bash" > $uninstaller_prn
  2621. echo "#RM_SELINUX_RULE=enable" >>$uninstaller_prn
  2622.  
  2623.  
  2624. echo "#" >>$uninstaller_prn
  2625. echo "# PRNL=$LPRFILE" >>$uninstaller_prn
  2626. echo "# PRNC=$CUPSFILE" >>$uninstaller_prn
  2627. echo "# PRNP=$PDRVFILE" >>$uninstaller_prn
  2628. echo "# SCAN=$SCANFILE" >>$uninstaller_prn
  2629. echo "# SKEY=$SKEYFILE" >>$uninstaller_prn
  2630. echo "#" >>$uninstaller_prn
  2631.  
  2632. for pathlib in $files
  2633. do
  2634. pathlib32lib=$(echo $pathlib | \
  2635. sed s/'\/usr\/lib\/'/'\/usr\/lib32\/'/g)
  2636.  
  2637. if [ -d '/usr/lib32' ];then
  2638. if [ ! -f "$pathlib32lib" ]; then
  2639. if [ "$pathlib" != '' ] && [ "$pathlib32lib" != '' ];then
  2640. echo ln -s $pathlib $pathlib32lib
  2641. ln -s $pathlib $pathlib32lib
  2642. echo "rm -f $pathlib32lib" >> $uninstaller_prn
  2643. fi
  2644. fi
  2645. fi
  2646. done
  2647.  
  2648.  
  2649. ## /usr/lib32 symlink
  2650.  
  2651.  
  2652. if [ "$files" != '' ];then
  2653. for pathlib in $(ls $(echo "$files"|sed -e s/.so.*$/\*/g))
  2654. do
  2655. if [ -d '/usr/lib32' ];then
  2656. #echo pathlib32lib=$(echo $pathlib | sed -e s/"usr\/lib"/"usr\/lib32"/)
  2657. pathlib32lib=$(echo $pathlib | sed -e s/"usr\/lib"/"usr\/lib32"/)
  2658. if [ ! -f "$pathlib32lib" ]; then
  2659. if [ "$pathlib" != '' ] && [ "$pathlib32lib" != '' ];then
  2660. echo ln -s $pathlib $pathlib32lib
  2661. ln -s $pathlib $pathlib32lib
  2662. echo "rm -f $pathlib32lib" >> $uninstaller_prn
  2663. fi
  2664. fi
  2665. fi
  2666. done
  2667. fi
  2668.  
  2669. ## /lib/lib32 symlink
  2670.  
  2671. # AppArmor
  2672.  
  2673. if [ "$(which aa-complain 2> /dev/null)" != '' ];then
  2674. echo -e $COLOR$MESSAGE184$MONO #"AppArmor"
  2675. echo aa-complain cupsd
  2676. aa-complain cupsd
  2677. fi
  2678.  
  2679.  
  2680. # for SELinux
  2681.  
  2682. if [ "$(which semanage 2> /dev/null)" = '' ];then
  2683. if [ "$(which yum 2>/dev/null)" != '' ];then
  2684. echo yum install policycoreutils-python
  2685. yum install policycoreutils-python
  2686. echo yum install policycoreutils
  2687. yum install policycoreutils
  2688. elif [ "$(which dnf 2>/dev/null)" != '' ];then
  2689. echo dnf install policycoreutils-python
  2690. dnf install policycoreutils-python
  2691. echo dnf install policycoreutils
  2692. dnf install policycoreutils
  2693. fi
  2694. fi
  2695.  
  2696. if [ "$(which semanage 2> /dev/null)" = '' ];then
  2697. if [ "$(which yum 2>/dev/null)" != '' ];then
  2698. echo yum install policycoreutils-python-utils
  2699. yum install policycoreutils-python-utils
  2700. elif [ "$(which dnf 2>/dev/null)" != '' ];then
  2701. echo dnf install policycoreutils-python-utils
  2702. dnf install policycoreutils-python-utils
  2703. fi
  2704. fi
  2705.  
  2706.  
  2707. if [ "$(which semanage 2> /dev/null)" != '' ];then
  2708.  
  2709. echo \if [ \"\$RM_SELINUX_RULE\" = \"enable\" ]\;then >> $uninstaller_prn
  2710. while read rule
  2711. do
  2712. if [ "$rule" != '' ];then
  2713. sedir=$(echo $rule | \
  2714. sed s/"^.*'\/"/"\/"/g | \
  2715. sed s/"\/(.*$"//g |\
  2716. sed s/"(.*$"//g |\
  2717. sed s/"'"//g)
  2718. rule2=$(echo $rule | sed s/"'"/""/g)
  2719. rule3=$(echo $rule | sed s/"("/"\("/g | sed s/")"/"\)"/g)
  2720. if [ -d $sedir ]; then
  2721. echo semanage fcontext -a -t $rule2
  2722. semanage fcontext -a -t $rule2
  2723. echo " "echo semanage fcontext -d -t $rule3 >> $uninstaller_prn
  2724. echo " "semanage fcontext -d -t $rule3 >> $uninstaller_prn
  2725. echo restorecon -R $sedir
  2726. restorecon -R $sedir
  2727. echo " "echo restorecon -R $sedir >> $uninstaller_prn
  2728. echo " "restorecon -R $sedir >> $uninstaller_prn
  2729. fi
  2730. fi
  2731. done << %%selinux_rules%%
  2732.  
  2733. cupsd_rw_etc_t '/usr/local/Brother/Printer/(.*/)?inf(/.*)?'
  2734. bin_t '/usr/local/Brother/Printer/(.*/)?inf/brprintconf(.*)?'
  2735. bin_t '/usr/local/Brother/Printer/(.*/)?lpd(/.*)?'
  2736. bin_t '/usr/local/Brother/Printer/(.*/)?cupswrapper(/.*)?'
  2737.  
  2738. bin_t '/usr/local/Brother'
  2739. cupsd_rw_etc_t '/usr/local/Brother/inf(/.*)?'
  2740. bin_t '/usr/local/Brother/lpd(/.*)?'
  2741. bin_t '/usr/local/Brother/cupswrapper(/.*)?'
  2742.  
  2743. bin_t '/opt/brother'
  2744. cupsd_rw_etc_t '/etc/opt/brother'
  2745. cupsd_rw_etc_t '/opt/brother/Printers/(.*/)?inf(/.*)?'
  2746. cupsd_rw_etc_t '/etc/opt/brother/Printers/(.*/)?inf(/.*)?'
  2747. bin_t '/opt/brother/Printers/(.*/)?lpd(/.*)?'
  2748. bin_t '/opt/brother/Printers/(.*/)?cupswrapper(/.*)?'
  2749.  
  2750.  
  2751. %%selinux_rules%%
  2752.  
  2753. if [ -e $LIBFLT ] ;then
  2754. echo restorecon -RFv $LIBFLT
  2755. restorecon -RFv $LIBFLT
  2756. fi
  2757. if [ -e $LIB32FLT ] ;then
  2758. echo restorecon -RFv $LIB32FLT
  2759. restorecon -RFv $LIB32FLT
  2760. fi
  2761. if [ -e $LIB64FLT ] ;then
  2762. echo restorecon -RFv $LIB64FLT
  2763. restorecon -RFv $LIB64FLT
  2764. fi
  2765. echo setsebool -P cups_execmem 1
  2766. setsebool -P cups_execmem 1
  2767. echo " echo setsebool -P cups_execmem 0" >> $uninstaller_prn
  2768. echo " setsebool -P cups_execmem 0" >> $uninstaller_prn
  2769.  
  2770. echo fi >> $uninstaller_prn
  2771.  
  2772. fi
  2773.  
  2774.  
  2775. #if [ "$(which setenforce 2> /dev/null)" != '' ];then
  2776. # echo -e $COLOR$MESSAGE182$MONO #"SELinux"
  2777. # echo setenforce 0
  2778. # setenforce 0
  2779. #fi
  2780.  
  2781.  
  2782. ## Configure Device URI
  2783.  
  2784. if [ "$RAWINSTALLED" = no ];then
  2785. echo -e -n $COLOR$MESSAGE190 #"Will you specify the Device URI\? [y/N] ->"
  2786. read answer
  2787. echo -e $MONO
  2788. else
  2789. answer=Y
  2790. fi
  2791.  
  2792. if [ "$answer" != n ] && [ "$answer" != N ]; then
  2793. duri=$($LPINFO -v | sed s/'^.* '//g | \
  2794. grep -v 'brserial_' | grep -v 'brusb_')
  2795. i=0
  2796. echo -e $COLOR4
  2797.  
  2798. autodurin=""
  2799. for deviceuri in $duri
  2800. do
  2801. prnn2=$(echo $PRINTERNAME | tr -d '-' | tr "[A-Z]" "[a-z]")
  2802. duri2=$(echo $deviceuri | tr -d '-' | tr "[A-Z]" "[a-z]")
  2803. if [ "$(echo $duri2 | grep 'usb://brother' |grep $prnn2 2>/dev/null )" \
  2804. != '' ];then
  2805. autodurin=$i
  2806. autoduris=$deviceuri
  2807. break
  2808. else
  2809. i=$(($i+1))
  2810. fi
  2811. done
  2812.  
  2813. if [ "$autodurin" = '' ];then
  2814. i=0
  2815. for deviceuri in $duri
  2816. do
  2817. prnn2=$(echo $PRINTERNAME | tr -d '-' | tr "[A-Z]" "[a-z]")
  2818. duri2=$(echo $deviceuri | tr -d '-' | tr "[A-Z]" "[a-z]")
  2819. if [ "$(echo $duri2 | grep $prnn2 2>/dev/null)" != '' ];then
  2820. autodurin=$i
  2821. autoduris=$deviceuri
  2822. break
  2823. else
  2824. i=$(($i+1))
  2825. fi
  2826. done
  2827. fi
  2828.  
  2829. if [ "$autodurin" = '' ];then
  2830. i=0
  2831. for deviceuri in $duri
  2832. do
  2833. prnn2=$(echo $PRINTERNAME | tr -d '-' | tr "[A-Z]" "[a-z]")
  2834. duri2=$(echo $deviceuri | tr -d '-' | tr "[A-Z]" "[a-z]")
  2835. if [ "$(echo $duri2 | grep 'usb://brother' 2>/dev/null)" != '' ];then
  2836. autodurin=$i
  2837. autoduris=$deviceuri
  2838. else
  2839. i=$(($i+1))
  2840. fi
  2841. done
  2842. fi
  2843.  
  2844. if [ "$autoduris" = '' ];then
  2845. autoduris='usb://dev/usblp0'
  2846. fi
  2847.  
  2848. i=0
  2849. for deviceuri in $duri
  2850. do
  2851. echo $i: $deviceuri
  2852. i=$(($i+1))
  2853. done
  2854. echo -e $i "(I)": $MESSAGE200 #"Specify IP address."
  2855. i=$(($i+1))
  2856. echo -e $i "(A)": $MESSAGE201 "("$autoduris")" #"Auto."
  2857. echo -e $MONO
  2858.  
  2859. echo -e -n $COLOR$MESSAGE210 #"select the number of distination Device URI. ->"
  2860. read answer
  2861. echo -e $MONO
  2862.  
  2863. if [ "$answer" = "$((i-1))" ] || \
  2864. [ "$answer" = 'IP' ] || \
  2865. [ "$answer" = 'ip' ] || \
  2866. [ "$answer" = 'Ip' ] || \
  2867. [ "$answer" = 'i' ] || \
  2868. [ "$answer" = 'I' ];then
  2869. echo -e -n $COLOR$MESSAGE220 #" enter IP address ->"
  2870. read ipadrs
  2871. echo -n -e $COLOR4
  2872. echo $LPADMIN -p $PRINTERNAME -v socket://$ipadrs -E $PPDOPT
  2873. echo -e -n $MONO
  2874. $LPADMIN -p $PRINTERNAME -v socket://$ipadrs -E $PPDOPT
  2875. deviceuri=socket://$ipadrs
  2876. elif [ "$answer" = "$i" ] || \
  2877. [ "$answer" = 'A' ] || \
  2878. [ "$answer" = 'a' ] || \
  2879. [ "$answer" = 'Auto' ] || \
  2880. [ "$answer" = '' ] ;then
  2881. echo -n -e $COLOR4
  2882. echo $LPADMIN -p $PRINTERNAME -v $autoduris -E $PPDOPT
  2883. echo -n -e $MONO
  2884. $LPADMIN -p $PRINTERNAME -v $autoduris -E $PPDOPT
  2885. deviceuri=$autoduris
  2886. elif [ "$answer" = 'F' ] || [ "$answer" = 'f' ];then
  2887. echo -n -e $COLOR4
  2888. echo $LPADMIN -p $PRINTERNAME -v file:///tmp/printdata.prn -E $PPDOPT
  2889. echo -n -e $MONO
  2890. $LPADMIN -p $PRINTERNAME -v file:///tmp/printdata.prn -E $PPDOPT
  2891. deviceuri="file:///tmp/printdata.prn"
  2892. else
  2893. i=0
  2894. for deviceuri in $duri
  2895. do
  2896. if [ "$i" = "$answer" ];then
  2897. echo -e -n $COLOR4
  2898. echo $LPADMIN -p $PRINTERNAME -v $deviceuri -E $PPDOPT
  2899. echo -e -n $MONO
  2900. $LPADMIN -p $PRINTERNAME -v $deviceuri -E $PPDOPT
  2901. break
  2902. fi
  2903. i=$(($i+1))
  2904. done
  2905. fi
  2906. elif [ "$answer" = "file" ] || [ "$answer" = "File" ]; then
  2907. echo -e -n $COLOR4
  2908. echo $LPADMIN -p $PRINTERNAME -v file:///tmp/printdata.prn -E $PPDOPT
  2909. echo -e -n $MONO
  2910. $LPADMIN -p $PRINTERNAME -v file:///tmp/printdata.prn -E $PPDOPT
  2911. fi
  2912.  
  2913. if [ "${modelnhuc}" = 'FAX' ];then
  2914. if [ -e /usr/lib/cups/filter/brfaxfilter ];then
  2915. chmod 755 /usr/lib/cups/filter/brfaxfilter
  2916. fi
  2917.  
  2918. if [ -e /usr/lib32/cups/filter ];then
  2919. if [ ! -e /usr/lib32/cups/filter/brfaxfilter ];then
  2920. cp /usr/lib/cups/filter/brfaxfilter /usr/lib32/cups/filter/brfaxfilter
  2921. fi
  2922. chmod 755 /usr/lib32/cups/filter/brfaxfilter
  2923. fi
  2924. if [ -e /usr/lib64/cups/filter ];then
  2925. if [ ! -e /usr/lib64/cups/filter/brfaxfilter ];then
  2926. cp /usr/lib/cups/filter/brfaxfilter /usr/lib64/cups/filter/brfaxfilter
  2927. fi
  2928. chmod 755 /usr/lib64/cups/filter/brfaxfilter
  2929. fi
  2930.  
  2931. if [ -f /etc/init.d/cups ];then
  2932. /etc/init.d/cups restart
  2933. elif [ -f /etc/init.d/cupsys ];then
  2934. /etc/init.d/cupsys restart
  2935. else
  2936. service cups restart
  2937. fi
  2938.  
  2939. fi
  2940.  
  2941.  
  2942.  
  2943.  
  2944. socketdevice=$(echo "$deviceuri" | grep "socket:")
  2945.  
  2946. if [ -n "$socketdevice" ] && [ "$ipadrs" = '' ];then
  2947. ipadrs=$(echo $socketdevice | sed s/"socket:\/\/"//g | sed s/":.*$"//g)
  2948. fi
  2949.  
  2950. echo -e -n $COLOR$MESSAGE230 #"Test Print \? [y/N]. ->"
  2951. read answer
  2952. echo -e $MONO
  2953.  
  2954. if [ "$answer" = Y ] || [ "$answer" = y ]; then
  2955. echo wait 5s.
  2956. sleep 5
  2957.  
  2958. if [ -f $TESTPRINT ];then
  2959. echo lpr -P $PRINTERNAME $TESTPRINT
  2960. lpr -P "$PRINTERNAME" "$TESTPRINT"
  2961. elif [ -f $TESTPRINT2 ];then
  2962. echo lpr -P $PRINTERNAME $TESTPRINT2
  2963. lpr -P "$PRINTERNAME" "$TESTPRINT2"
  2964. else
  2965. echo "echo $PRINTERNAME \| lpr -P $PRINTERNAME"
  2966. echo "$PRINTERNAME" | lpr -P "$PRINTERNAME"
  2967. fi
  2968. fi
  2969.  
  2970. # Make uninstaller : daemon symlink
  2971.  
  2972. LPRPKGNAME=$(echo $LPRFILE |\
  2973. sed s/"_.*$"//g |\
  2974. sed s/"-.*$"//g)
  2975. CUPSPKGNAME=$(echo $CUPSFILE |\
  2976. sed s/"_.*$"//g |\
  2977. sed s/"-.*$"//g)
  2978. PDRVPKGNAME=$(echo $PDRVFILE |\
  2979. sed s/"_.*$"//g |\
  2980. sed s/"-.*$"//g)
  2981.  
  2982.  
  2983.  
  2984.  
  2985.  
  2986.  
  2987. echo "if ! [ -f /etc/init.d/cupsys ];then" >>$uninstaller_prn
  2988. echo " DUMMYCUPSYS=1" >>$uninstaller_prn
  2989. echo " ln -s /bin/true /etc/init.d/cupsys" >>$uninstaller_prn
  2990. echo "fi" >>$uninstaller_prn
  2991.  
  2992. echo "if ! [ -f /etc/init.d/cups ];then" >>$uninstaller_prn
  2993. echo " DUMMYCUPS=1" >>$uninstaller_prn
  2994. echo " ln -s /bin/true /etc/init.d/cups" >>$uninstaller_prn
  2995. echo "fi" >>$uninstaller_prn
  2996.  
  2997. echo "if ! [ -f /etc/init.d/lpd ];then" >>$uninstaller_prn
  2998. echo " DUMMYLPD=1" >>$uninstaller_prn
  2999. echo " ln -s /bin/true /etc/init.d/lpd" >>$uninstaller_prn
  3000. echo "fi" >>$uninstaller_prn
  3001.  
  3002. echo "if ! [ -f /etc/init.d/lprng ];then" >>$uninstaller_prn
  3003. echo " DUMMYLPRNG=1" >>$uninstaller_prn
  3004. echo " ln -s /bin/true /etc/init.d/lprng" >>$uninstaller_prn
  3005. echo "fi" >>$uninstaller_prn
  3006.  
  3007.  
  3008.  
  3009.  
  3010. #
  3011. #rm cupswrapper driver
  3012. if [ "$CUPSPKGNAME" != '' ];then
  3013. echo "$PREPKGCMDC" >>$uninstaller_prn
  3014. echo "$RMPKGCMD $CUPSPKGNAME""$pkgpostfix" >>$uninstaller_prn
  3015. fi
  3016. #
  3017. #rm lpd driver
  3018. if [ "$LPRPKGNAME" != '' ];then
  3019. echo "$PREPKGCMDL" >>$uninstaller_prn
  3020. echo "$RMPKGCMD $LPRPKGNAME""$pkgpostfix" >>$uninstaller_prn
  3021. fi
  3022.  
  3023. #rm pdrv driver
  3024. if [ "$PDRVPKGNAME" != '' ];then
  3025. echo "$PREPKGCMDP" >>$uninstaller_prn
  3026. echo "$RMPKGCMD $PDRVPKGNAME""$pkgpostfix" >>$uninstaller_prn
  3027. fi
  3028.  
  3029.  
  3030.  
  3031. if [ "$DUMMYCUPS" = 1 ] || \
  3032. [ "$DUMMYCUPSYS" = 1 ] || \
  3033. [ "$DUMMYLPD" = 1 ] || \
  3034. [ "$DUMMYLPRNG" = 1 ];then
  3035.  
  3036.  
  3037. echo 'if [ "$DUMMYCUPS" = 1 ];then' >>$uninstaller_prn
  3038. echo ' lsc=$(ls -al /etc/init.d/cups 2> /dev/null| grep ^l)' >>$uninstaller_prn
  3039. echo ' if [ "$lsc" != "" ];then' >>$uninstaller_prn
  3040. echo ' rm -f /etc/init.d/cups' >>$uninstaller_prn
  3041. echo ' fi' >>$uninstaller_prn
  3042. echo 'fi' >>$uninstaller_prn
  3043. echo '' >>$uninstaller_prn
  3044.  
  3045. echo 'if [ "$DUMMYCUPSYS" = 1 ];then' >>$uninstaller_prn
  3046. echo ' lsc=$(ls -al /etc/init.d/cupsys 2> /dev/null| grep ^l)' >>$uninstaller_prn
  3047. echo ' if [ "$lsc" != "" ];then' >>$uninstaller_prn
  3048. echo ' rm -f /etc/init.d/cupsys' >>$uninstaller_prn
  3049. echo ' fi' >>$uninstaller_prn
  3050. echo 'fi' >>$uninstaller_prn
  3051. echo '' >>$uninstaller_prn
  3052.  
  3053. echo 'if [ "$DUMMYLPD" = 1 ];then' >>$uninstaller_prn
  3054. echo ' lsc=$(ls -al /etc/init.d/lpd 2> /dev/null | grep ^l)' >>$uninstaller_prn
  3055. echo ' if [ "$lsc" != "" ];then' >>$uninstaller_prn
  3056. echo ' rm -f /etc/init.d/lpd' >>$uninstaller_prn
  3057. echo ' fi' >>$uninstaller_prn
  3058. echo 'fi' >>$uninstaller_prn
  3059. echo '' >>$uninstaller_prn
  3060.  
  3061. echo 'if [ "$DUMMYLPRNG" = 1 ];then' >>$uninstaller_prn
  3062. echo ' lsc=$(ls -al /etc/init.d/lprng | grep ^l)' >>$uninstaller_prn
  3063. echo ' if [ "$lsc" != "" ];then' >>$uninstaller_prn
  3064. echo ' rm -f /etc/init.d/lprng' >>$uninstaller_prn
  3065. echo ' fi' >>$uninstaller_prn
  3066. echo 'fi' >>$uninstaller_prn
  3067.  
  3068.  
  3069. echo $rm32filter >>$uninstaller_prn
  3070. echo $rm64filter >>$uninstaller_prn
  3071.  
  3072. fi
  3073.  
  3074.  
  3075. if [ "$SCAN" != '' ];then
  3076. echo $SCAN
  3077. fi
  3078.  
  3079. if [ "$SKEY" != '' ];then
  3080. echo $SKEY
  3081. fi
  3082.  
  3083. chmod 744 $uninstaller_prn
  3084.  
  3085. pre_proc
  3086. scanner_install # scanner
  3087. post_proc
  3088.  
  3089. if [ "$1" = '' ];then
  3090. echo -e -n $COLOR$MESSAGE240$MONO #"Hit Return/Enter Key"
  3091. read answer
  3092. fi
  3093. #DBG_MSG "exit 20"
  3094. exit 0[/CODE]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement