orcainbox

Untitled

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