lib/deprec/recipes/java.rb in le1t0-deprec-2.1.6.001 vs lib/deprec/recipes/java.rb in le1t0-deprec-2.1.6.002
- old
+ new
@@ -1,23 +1,271 @@
+def accept_license
+ return if java_dlj_11_license_accepted
+ in_license = false
+ Capistrano::CLI.ui.say(IO.readlines(__FILE__).collect do |line|
+ in_license = false if line =~ /^# END_LICENSE/
+ current_line = in_license ? line.strip.gsub(/^#[ ]?/, '') : nil
+ in_license = true if line =~ /^# START_LICENSE/
+ current_line
+ end.compact.join("\n"))
+ prompt = "Accept license (YES, [NO])? "
+ answer = Capistrano::CLI.ui.ask(prompt) do |q|
+ q.overwrite = false
+ q.default = 'NO'
+ q.validate = /(yes)|(no)|\n/i
+ q.responses[:not_valid] = prompt
+ end
+ if answer.upcase == 'YES'
+ set :java_dlj_11_license_accepted, true
+ end
+end
+
# Copyright 2010 by le1t0@github. All rights reserved.
Capistrano::Configuration.instance(:must_exist).load do
namespace :deprec do
namespace :java do
set :java_include_jdk, false
+ set :java_dlj_11_license_accepted, false
+ set :java_stopthread, true # no idea what this does, but it defaults to true on Hardy and should be preset for auto inst
desc "Install Java"
task :install do
- packages = %w(sun-java6-bin sun-java6-jre)
- packages << "sun-java6-jdk" if java_include_jdk
- apt.install( {:base => packages}, :stable )
+ accept_license
+ if java_dlj_11_license_accepted
+ debconf_set_selections_file = "/tmp/java_debconf_set_selections.#{Time.now.strftime("%Y%m%d%H%M%S")}"
+ debconf_set_selections = [
+ "sun-java6-jre sun-java6-jre/stopthread boolean #{java_stopthread}",
+ "sun-java6-jre sun-java6-jre/jcepolicy note",
+ "sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean #{java_dlj_11_license_accepted}",
+ "sun-java6-jre shared/accepted-sun-dlj-v1-1 boolean #{java_dlj_11_license_accepted}",
+ "sun-java6-bin shared/present-sun-dlj-v1-1 note",
+ "sun-java6-jre shared/present-sun-dlj-v1-1 note"
+ ]
+ packages = %w(sun-java6-bin sun-java6-jre)
+ if java_include_jdk
+ packages << "sun-java6-jdk"
+ debconf_set_selections += [
+ "sun-java6-jdk shared/accepted-sun-dlj-v1-1 boolean #{java_dlj_11_license_accepted}",
+ "sun-java6-jdk shared/present-sun-dlj-v1-1 note"
+ ]
+ end
+ put debconf_set_selections.join("\n"), debconf_set_selections_file, :mode => 0644
+ sudo "debconf-set-selections #{debconf_set_selections_file} ; rm -f #{debconf_set_selections_file}"
+ apt.install( {:base => packages}, :stable )
+ end
end
desc "Config java"
task :config do
deprec2.append_to_file_if_missing('/etc/profile', 'export JAVA_HOME=/usr/lib/jvm/java-6-sun')
deprec2.append_to_file_if_missing('/etc/profile', 'export PATH=$PATH:${JAVA_HOME}/bin')
end
end
end
-end
+end
+
+# leave this license in! it is shown to the user during installation
+#
+# START_LICENSE
+#
+# Operating System Distributor License for Java version 1.1
+#
+# SUN MICROSYSTEMS, INC. ("SUN") IS WILLING TO LICENSE THE JAVA PLATFORM
+# STANDARD EDITION DEVELOPER KIT ("JDK" - THE "SOFTWARE") TO YOU ONLY
+# UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS
+# LICENSE AGREEMENT (THE "AGREEMENT"). PLEASE READ THE AGREEMENT
+# CAREFULLY. BY INSTALLING, USING, OR DISTRIBUTING THIS SOFTWARE, YOU
+# ACCEPT ALL OF THE TERMS OF THE AGREEMENT.
+#
+# 1. DEFINITIONS. "Software" means the code identified above in binary
+# form, any other machine readable materials including, but not
+# limited to, libraries, source files, header files, and data files),
+# any updates or error corrections provided by Sun, and any user
+# manuals, programming guides and other documentation provided to you
+# by Sun under this Agreement, and any subsequent versions that Sun
+# makes available to you hereunder. "Operating System" means any
+# version of the Linux or OpenSolaris operating systems that manages
+# the hardware resources of a general purpose desktop or server
+# computer and shares these resources with various software programs
+# that run on top of it. "Programs" means Java technology applets and
+# applications intended to run on the Java Platform Standard Edition
+# (Java SE platform) platform on Java-enabled general purpose desktop
+# computers and servers.
+#
+# 2. License Grant. Subject to the terms and conditions of this
+# Agreement, as well as the restrictions and exceptions set forth in
+# the Software README file, Sun grants you a non-exclusive,
+# non-transferable, royalty-free limited license to reproduce and use
+# the Software internally, complete and unmodified, for the sole
+# purposes of running Programs and designing, developing and testing
+# Programs. Sun also grants you a non-exclusive, non-transferable,
+# royalty-free limited license to reproduce and distribute the
+# Software, directly or indirectly through your licensees,
+# distributors, resellers, or OEMs, electronically or in physical
+# form or pre-installed with your Operating System on a general
+# purpose desktop computer or server, provided that: (a) the Software
+# and any proprietary legends or notices are complete and unmodified;
+# (b) the Software is distributed with your Operating System, and
+# such distribution is solely for the purposes of running Programs
+# under the control of your Operating System and designing,
+# developing and testing Programs to be run under the control of your
+# Operating System; (c) you do not combine, configure or distribute
+# the Software to run in conjunction with any additional software
+# that implements the same or similar functionality or APIs as the
+# Software; (d) you do not remove or modify any included license
+# agreement or impede or prevent it from displaying and requiring
+# acceptance; (e) you only distribute the Software subject to this
+# license agreement; and (f) you agree to defend and indemnify Sun
+# and its licensors from and against any damages, costs, liabilities,
+# settlement amounts and/or expenses (including attorneys' fees)
+# incurred in connection with any claim, lawsuit or action by any
+# third party that arises or results from (i) the use or distribution
+# of your Operating System, or any part thereof, in any manner, or
+# (ii) your use or distribution of the Software in violation of the
+# terms of this Agreement or applicable law. You shall not be
+# obligated under Section 2(f)(i) if such claim would not have
+# occurred but for a modification made to your Operating System by
+# someone not under your direction or control, and you were in
+# compliance with all other terms of this Agreement. If the Software
+# README file permits certain files to be replaced or omitted from
+# your distribution, then any such replacement(s) or omission(s)
+# shall not be considered a breach of Section 2(a).
+#
+# 3. RESTRICTIONS. Software is copyrighted and title to Software and
+# all associated intellectual property rights is retained by Sun
+# and/or its licensors. Unless enforcement is prohibited by
+# applicable law, you may not modify, decompile, or reverse engineer
+# Software. You may not create, modify, or change the behavior of,
+# or authorize your licensees, distributors, resellers, OEMs, or end
+# users (collectively, "Licensees") to create, modify, or change the
+# behavior of, classes, interfaces, or subpackages that are in any
+# way identified as "java", "javax", "sun" or similar convention as
+# specified by Sun in any naming convention designation. You
+# acknowledge that Licensed Software is not designed or intended for
+# use in the design, construction, operation or maintenance of any
+# nuclear facility. Sun Microsystems, Inc. disclaims any express or
+# implied warranty of fitness for such uses.
+#
+# 4. COMPATIBILITY. If you exercise the license in Section 2, and Sun
+# or a licensee of the Software (under section 4(b)) notifies you
+# that there are compatibility issues (as determined by the
+# applicable Technology Compatibility Kit) caused by the interaction
+# of the Software with your Operating System, then within ninety
+# (90) days you must either: (a) modify the Operating System in a
+# way that resolves the compatibility issue (as determined by Sun)
+# and make a patch or replacement version available to your
+# Licensees who have already received the version of your Operating
+# System that was the subject of the compatibility issue ("Your
+# Incompatible Operating System"); or (b) cease distributing the
+# Software and make commercially reasonable attempts to forward the
+# notification to your Licensees who have already received Your
+# Incompatible Operating System.
+#
+# 5. Trademarks and Logos. No right, title or interest in or to any
+# trademark, service mark, logo or trade name of Sun or its
+# licensors is granted under this Agreement. You acknowledge and
+# agree that, as between you and Sun, Sun owns the SUN and JAVA
+# trademarks and all SUN and JAVA-related trademarks, service marks,
+# logos and other brand designations ("Sun Marks"), and you agree to
+# comply with the Sun Trademark and Logo Usage Requirements
+# currently located at http://www.sun.com/policies/trademarks. Any
+# use you make of the Sun Marks inures to Sun's benefit.
+#
+# 6. LIMITED WARRANTY. If you received the Software directly from Sun
+# or its authorized resellers, Sun warrants to you that for a period
+# of ninety (90) days from delivery to you, the media on which
+# Software is furnished (if any) will be free of defects in
+# materials and workmanship under normal use. Except for the
+# foregoing, Software is provided "AS IS". Your exclusive remedy
+# and Sun's entire liability under this limited warranty will be
+# replacement of the Software media. This limited warranty gives
+# you specific legal rights. You may have others, which vary from
+# state to state.
+#
+# 7. DISCLAIMER OF WARRANTY. UNLESS SPECIFIED IN THIS AGREEMENT, ALL
+# EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+# PARTICULAR PURPOSE OR NON-INFRINGEMENT ARE DISCLAIMED, EXCEPT TO
+# THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.
+#
+# 8. LIMITATION OF LIABILITY. IN NO EVENT WILL SUN OR ITS LICENSORS BE
+# LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL OR
+# PUNITIVE DAMAGES IN CONNECTION WITH OR ARISING OUT OF THIS
+# AGREEMENT (INCLUDING LOSS OF PROFITS, USE, DATA, OR OTHER ECONOMIC
+# ADVANTAGE), NO MATTER WHAT THEORY OF LIABILITY, EVEN IF SUN HAS
+# BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event will
+# Sun's liability to you, whether in contract, tort (including
+# negligence), or otherwise, exceed the amount paid by you for the
+# Software under this Agreement. The foregoing limitations will
+# apply even if the above stated warranty fails of its essential
+# purpose. Some states do not allow the exclusion of incidental or
+# consequential damages, so some of the terms above may not be
+# applicable to you.
+#
+# 9. THIRD PARTY CODE. Additional copyright notices and license terms
+# applicable to portions of the Software are set forth in the
+# THIRDPARTYLICENSEREADME.txt file. In addition to any terms and
+# conditions of any third party opensource/freeware license
+# identified in the THIRDPARTYLICENSEREADME.txt file, the disclaimer
+# of warranty and limitation of liability provisions in paragraphs 7
+# and 8 of this Agreement shall apply to all Software in this
+# distribution.
+#
+# 10. Termination. This Agreement is effective until it is
+# terminated. You may terminate this Agreement at any time by
+# ceasing distribution of the Software. This Agreement will
+# terminate immediately without notice from Sun if you fail to
+# comply with any material provision herein. Either party may
+# terminate this Agreement immediately should any Software become,
+# or in either party's opinion be likely to become, the subject of a
+# claim of infringement of any intellectual property right. Upon
+# termination, you must destroy all copies and cease copying and
+# distribution of the Software. All of your obligations and any
+# applicable limitations on your rights and remedies under this
+# Agreement shall survive termination.
+#
+# 11. SOURCE CODE. Software may contain source code that, unless
+# expressly licensed for other purposes, is provided solely for
+# reference purposes pursuant to the terms of this Agreement.
+# Source code may not be redistributed unless expressly provided for
+# in this Agreement.
+#
+# 12. Export Regulations. All Software and technical data delivered
+# under this Agreement are subject to US export control laws and may
+# be subject to export or import regulations in other countries.
+# You acknowledge that you have the responsibility to obtain such
+# licenses to export, re-export, or import as may be required after
+# delivery to you.
+#
+# 13. U.S. GOVERNMENT RESTRICTED RIGHTS. If Software is being acquired
+# by or on behalf of the U.S. Government or by a U.S. Government
+# prime contractor or subcontractor (at any tier), then the
+# Government's rights in Software and accompanying documentation
+# will be only as set forth in this Agreement; this is in accordance
+# with 48 CFR 227.7201 through 227.7202-4 (for Department of Defense
+# (DOD) acquisitions) and with 48 CFR 2.101 and 12.212 (for non-DOD
+# acquisitions).
+#
+# 14. MISCELLANEOUS. Any action related to this Agreement will be
+# governed by California law and controlling U.S. federal law. No
+# choice of law rules of any jurisdiction will apply. If any
+# provision of this Agreement is held to be unenforceable, this
+# Agreement will remain in effect upon the parties' agreement to
+# revised terms that most nearly accomplish the same effect. This
+# Agreement is the entire agreement between you and Sun relating to
+# its subject matter. It supersedes all prior or contemporaneous
+# oral or written communications, proposals, representations and
+# warranties and prevails over any conflicting or additional terms
+# of any quote, order, acknowledgment, or other communication
+# between the parties relating to its subject matter during the term
+# of this Agreement. No modification of this Agreement will be
+# binding, unless in writing and signed by an authorized
+# representative of each party.
+#
+# For inquiries please contact: Sun Microsystems, Inc., 4150 Network Circle,
+# Santa Clara, California 95054, U.S.A.
+#
+# DLJ v1.1 27APR2006ANS
+#
+# END_LICENSE
\ No newline at end of file