Advertisement
Guest User

Untitled

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