]> git.sven.stormbind.net Git - sven/java-package.git/commitdiff
Renamed the script files (j2sdk->jdk, j2re->jre, j2se->javase)
authorEmmanuel Bourg <ebourg@apache.org>
Wed, 5 Jun 2013 12:43:03 +0000 (14:43 +0200)
committerEmmanuel Bourg <ebourg@apache.org>
Wed, 5 Jun 2013 12:43:03 +0000 (14:43 +0200)
14 files changed:
lib/j2re.sh [deleted file]
lib/j2sdk-doc.sh [deleted file]
lib/j2sdk.sh [deleted file]
lib/j2se.sh [deleted file]
lib/javase.sh [new file with mode: 0644]
lib/jdk-doc.sh [new file with mode: 0644]
lib/jdk.sh [new file with mode: 0644]
lib/jre.sh [new file with mode: 0644]
lib/oracle-j2re.sh [deleted file]
lib/oracle-j2sdk-doc.sh [deleted file]
lib/oracle-j2sdk.sh [deleted file]
lib/oracle-jdk-doc.sh [new file with mode: 0644]
lib/oracle-jdk.sh [new file with mode: 0644]
lib/oracle-jre.sh [new file with mode: 0644]

diff --git a/lib/j2re.sh b/lib/j2re.sh
deleted file mode 100644 (file)
index 864f141..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-
-j2re_control() {
-    j2se_control
-    cat << EOF
-Package: $j2se_package
-Architecture: any
-Depends: \${shlibs:Depends}
-Recommends: netbase, libx11-6 | xlibs, libasound2, libgtk1.2
-Provides: java-virtual-machine, java-runtime, java2-runtime, java5-runtime, java6-runtime, java-runtime-headless, java2-runtime-headless, java5-runtime-headless, java6-runtime-headless, java-browser-plugin, j2re${j2se_release}
-Replaces: ${j2se_package}debian
-Description: $j2se_title
- The Java(TM) SE Runtime Environment contains the Java virtual machine,
- runtime class libraries, and Java application launcher that are
- necessary to run programs written in the Java progamming language
- (this includes the Java 2 Plug-In for Netscape and Mozilla
- browsers). It is not a development environment and doesn't contain
- development tools such as compilers or debuggers. For development
- tools, see the Java 2 SDK, Standard Edition.
- .
- This package has been automatically created with java-package ($version).
-EOF
-}
-
-# build debian package
-j2re_run() {
-    echo
-    diskfree "$j2se_required_space"
-    read_maintainer_info
-    j2se_package="$j2se_vendor-java$j2se_release-jre"
-    j2se_name="jre-$j2se_release-$j2se_vendor-$j2se_arch"
-    local target="$install_dir$jvm_base$j2se_name"
-    install -d -m 755 "$( dirname "$target" )"
-    extract_bin "$archive_path" "$j2se_expected_min_size" "$target"
-    rm -rf "$target/.systemPrefs"
-    echo "7" > "$debian_dir/compat"
-    j2se_readme > "$debian_dir/README.Debian"
-    j2se_changelog > "$debian_dir/changelog"
-    j2re_control > "$debian_dir/control"
-    j2se_copyright > "$debian_dir/copyright"
-    j2se_install_scripts
-    install -d "$target/debian"
-    j2se_info > "$target/debian/info"
-    eval "$j2se_jinfo" > "$install_dir$jvm_base.$j2se_name.jinfo"
-    j2se_build
-}
diff --git a/lib/j2sdk-doc.sh b/lib/j2sdk-doc.sh
deleted file mode 100644 (file)
index be98bfd..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-j2sdk_doc_control() {
-    j2se_control
-    cat << EOF
-Package: $j2se_package
-Architecture: any
-Depends: 
-Recommends: 
-Provides: 
-Replaces: 
-Description: $j2se_title
- The Java(TM) SE JDK is a development environment for building
- applications, applets, and components that can be deployed on the
- Java(TM) platform.
- .
- This package provides the official API documentation published
- by Oracle.
- .
- This package has been automatically created with java-package ($version).
-EOF
-}
-
-j2sdk_doc_doc-base() {
-    cat << EOF
-Document: $j2se_package
-Title: $j2se_title
-Author: $maintainer_name
-Abstract: This is the API Javadoc provided by the vendor
-Section: Programming
-
-Format: HTML
-Index: /usr/share/doc/$j2se_vendor-java$j2se_release-doc/index.html
-Files: /usr/share/doc/$j2se_vendor-java$j2se_release-doc/*.html
-
-EOF
-}
-
-# build debian package
-j2sdk_doc_run() {
-    echo
-    diskfree "$j2se_required_space"
-    read_maintainer_info
-    j2se_package="$j2se_vendor-java$j2se_release-doc"
-    j2se_name="jdk$j2se_release-$j2se_vendor-doc"
-    local target="$install_dir$javadoc_base$j2se_name"
-    install -d -m 755 "$( dirname "$target" )"
-    extract_bin "$archive_path" "$j2se_expected_min_size" "$target"
-    rm -rf "$target/.systemPrefs"
-    echo "7" > "$debian_dir/compat"
-    j2se_readme > "$debian_dir/README.Debian"
-    j2se_changelog > "$debian_dir/changelog"
-    j2sdk_doc_control > "$debian_dir/control"
-    j2se_copyright > "$debian_dir/copyright"
-    j2sdk_doc_doc-base > "$debian_dir/$j2se_package.doc-base"
-    j2se_install_scripts
-    install -d "$target/debian"
-    j2se_info > "$target/debian/info"
-    j2se_build
-}
diff --git a/lib/j2sdk.sh b/lib/j2sdk.sh
deleted file mode 100644 (file)
index 778b370..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-
-j2sdk_control() {
-    j2se_control
-    java_browser_plugin="java-browser-plugin, "
-    depends="\${shlibs:Depends}"
-    if [ "${DEB_BUILD_ARCH:0:3}" = "arm" ]; then
-        # ARM is only softfloat ATM so if building on armhf
-        # force the dependencies to pickup cross platform fu
-        if [ "${DEB_BUILD_ARCH}" == "armhf" ]; then
-            depends="libc6-armel, libsfgcc1, libsfstdc++6"
-        fi
-        # No browser on ARM yet
-        java_browser_plugin=""
-    fi
-    cat << EOF
-Package: $j2se_package
-Architecture: any
-Depends: $depends
-Recommends: netbase, libx11-6 | xlibs, libasound2, libgtk1.2, libstdc++5
-Provides: java-virtual-machine, java-runtime, java2-runtime, $java_browser_plugin java-compiler, java2-compiler, java-runtime-headless, java2-runtime-headless, java-sdk, java2-sdk, j2sdk$j2se_release, j2re$j2se_release
-Replaces: ${j2se_package}debian
-Description: $j2se_title
- The Java(TM) SE JDK is a development environment for building
- applications, applets, and components that can be deployed on the
- Java(TM) platform.
- .
- The Java(TM) SE JDK software includes tools useful for developing and
- testing programs written in the Java programming language and running
- on the Java platform. These tools are designed to be used from the
- command line. Except for appletviewer, these tools do not provide a
- graphical user interface.
- .
- This package has been automatically created with java-package ($version).
-EOF
-}
-
-# build debian package
-j2sdk_run() {
-    echo
-    diskfree "$j2se_required_space"
-    read_maintainer_info
-    j2se_package="$j2se_vendor-java$j2se_release-jdk"
-    j2se_name="jdk-$j2se_release-$j2se_vendor-$j2se_arch"
-    local target="$install_dir$jvm_base$j2se_name"
-    install -d -m 755 "$( dirname "$target" )"
-    extract_bin "$archive_path" "$j2se_expected_min_size" "$target"
-    rm -rf "$target/.systemPrefs"
-    echo "7" > "$debian_dir/compat"
-    j2se_readme > "$debian_dir/README.Debian"
-    j2se_changelog > "$debian_dir/changelog"
-    j2sdk_control > "$debian_dir/control"
-    j2se_copyright > "$debian_dir/copyright"
-    j2se_install_scripts
-    install -d "$target/debian"
-    j2se_info > "$target/debian/info"
-    eval "$j2se_jinfo" > "$install_dir$jvm_base.$j2se_name.jinfo"
-    j2se_build
-}
diff --git a/lib/j2se.sh b/lib/j2se.sh
deleted file mode 100644 (file)
index a98a915..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
-j2se_readme() {
-    cat << EOF
-Package for $j2se_title
----
-
-This package has been automatically created with java-package ($version). 
-All files from the original distribution should have been installed in
-the directory $jvm_base$j2se_name. Please take a look at this directory for
-further information.
-
-EOF
-}
-
-j2se_changelog() {
-    cat << EOF
-$j2se_package ($j2se_version) unstable; urgency=low
-
-  * This package was created with java-package ($version).
-
- -- $maintainer_name <$maintainer_email>  $( date -R )
-
-EOF
-}
-
-j2se_control() {
-    cat << EOF
-Source: $j2se_package
-Section: non-free/devel
-Priority: optional
-Maintainer: $maintainer_name <$maintainer_email>
-Build-Depends: debhelper (>= 4.0.0)
-Standards-Version: 3.7.2
-
-EOF
-}
-
-j2se_copyright() {
-    cat << EOF
-----------------------------------------------------------------------
-
-This file contains a copy of all copyright files found in the original
-distribution. The original copyright files and further information can
-be found in the directory $jvm_base$j2se_name and its
-subdirectories.
-
-----------------------------------------------------------------------
-EOF
-    ( 
-    cd "$install_dir"
-    find * -type f -iname copyright |
-    while read file; do
-        cat << EOF
-
-File: /$file
-
-----------------------------------------------------------------------
-
-EOF
-        cat "$file"
-        cat << EOF
-
-----------------------------------------------------------------------
-EOF
-    done
-    )
-}
-
-j2se_install_scripts() {
-    cat > "$debian_dir/postinst" << EOF
-#!/bin/bash
-
-set -e
-
-if [ "\$1" = configure ]; then
-
-    # Common functions for all install scripts
-
-    # install_alternatives program_base programs
-    install_alternatives() {
-        program_base="\$1"
-        shift
-        for program in \$*; do
-          if [[ -f "\$program_base/\$program" ]]; then
-            update-alternatives \\
-            --install "/usr/bin/\$program" "\$program" "\$program_base/\$program" $j2se_priority \\
-            --slave "/usr/share/man/man1/\$program.1.gz" "\$program.1.gz" "$jvm_base$j2se_name/man/man1/\$program.1.gz"
-          fi
-        done
-    }
-
-    # install_alternatives_no_man program_base programs
-    install_no_man_alternatives() {
-        program_base="\$1"
-        shift
-        for program in \$*; do
-          if [[ -f "\$program_base/\$program" ]]; then
-            update-alternatives --install "/usr/bin/\$program" "\$program" "\$program_base/\$program" $j2se_priority
-          fi
-        done
-    }
-
-    # install_browser_plugin link_path link_name plugin_name plugin
-    install_browser_plugin() {
-        local link_path="\$1"
-        local link_name="\$2"
-        local plugin_name="\$3"
-        local plugin="\$4"
-        [ -d "\$link_path" ] || install -d -m 755 "\$link_path"
-        if [[ -f "\$plugin" ]]; then
-          update-alternatives --install "\$link_path/\$link_name" "\$plugin_name" "\$plugin" $j2se_priority
-        fi
-    }
-
-EOF
-    eval "$j2se_install" >> "$debian_dir/postinst"
-
-    cat >> "$debian_dir/postinst" << EOF
-fi
-
-#DEBHELPER#
-
-exit 0
-EOF
-    chmod 755 "$debian_dir/postinst"
-    
-    cat > "$debian_dir/prerm" << EOF
-#!/bin/bash
-
-set -e
-
-case "\$1" in
-    remove | deconfigure)
-
-    # Common functions for all remove scripts
-
-    # remove_alternatives program_base programs
-    remove_alternatives() {
-        program_base="\$1"
-        shift
-        for program in \$*; do
-          update-alternatives --remove "\$program" "\$program_base/\$program"
-        done
-    }
-
-    # remove_browser_plugin plugin_name plugin
-    remove_browser_plugin() {
-        local plugin_name="\$1"
-        local plugin="\$2"
-        update-alternatives --remove "\$plugin_name" "\$plugin"
-    }
-
-EOF
-    eval "$j2se_remove" >> "$debian_dir/prerm"
-
-    cat >> "$debian_dir/prerm" << EOF
-    ;;
-esac
-
-#DEBHELPER#
-
-exit 0
-EOF
-    chmod 755 "$debian_dir/prerm"
-}
-
-j2se_info() {
-    cat << EOF
-version="$version"
-j2se_version="$j2se_version"
-maintainer_name="$maintainer_name"
-maintainer_email="$maintainer_email"
-date="$( date +%Y/%m/%d )"
-EOF
-}
-
-# jinfos prefix program_base programs
-jinfos() {
-    prefix="$1"
-    program_base="$2"
-    shift ; shift
-    for program in $*; do
-      echo "$prefix $program $program_base$program" 
-    done
-}
-
-j2se_build() {
-    cd "$tmp"
-    echo "Create debian package:"
-    
-    #export DH_VERBOSE=1
-    export DH_COMPAT=7
-    export DH_OPTIONS=--tmpdir="$install_dir"
-
-    echo "    dh_testdir"
-    dh_testdir
-    echo "    dh_testroot"
-    dh_testroot
-    echo "    dh_installchangelogs"
-    dh_installchangelogs
-    # Problem: dh_installchangelogs thinks this is a native package.
-    echo "    dh_installdocs"
-    dh_installdocs
-    # dh_install
-    # dh_link
-    # Conditionally wrapping this as not all JRE/JDKs have man directories
-    if [ -e "$install_dir/$jvm_base$j2se_name/man" ]; then
-        echo "    dh_compress"
-        dh_compress $( find "$install_dir/$jvm_base$j2se_name/man" -type f ! -name "*.gz" )
-    fi
-    echo "    dh_fixperms"
-    dh_fixperms
-    echo "    dh_installdeb"
-    dh_installdeb
-    echo "    dh_shlibdeps"
-    ldpath=
-    for dir in $( find "$install_dir" -type f -name "*.so*" -printf "%h\n" | sort -u ); do
-        if [[ -z "$ldpath" ]]; then
-            ldpath="$dir"
-        else
-            ldpath="$ldpath:$dir"
-        fi
-    done
-    # suppress some warnings
-    dh_shlibdeps -l"$ldpath" 2>&1 | 
-    { grep -v "warning: format of \`NEEDED lib.*\.so' not recognized" >&2 || true; }
-    echo "    dh_gencontrol"
-    dh_gencontrol
-    echo "    dh_md5sums"
-    dh_md5sums
-    echo "    dh_builddeb"
-    dh_builddeb --destdir="$tmp"
-    local deb_filename="$( echo "${j2se_package}_"*.deb )"
-    echo "    copy $deb_filename into directory $working_dir/"
-    cp "$deb_filename" "$working_dir/"
-    if [ -n "$genchanges" ]; then 
-        echo "    dpkg-genchanges"
-        local changes_filename="${deb_filename%.deb}.changes"
-        dpkg-genchanges -b -u. > "$changes_filename"
-        echo "    copy $changes_filename into directory $working_dir/"
-        cp "$changes_filename" "$working_dir/"
-    fi
-    cat << EOF
-
-The Debian package has been created in the current directory. You can
-install the package as root (e.g. dpkg -i $deb_filename). 
-
-EOF
-}
diff --git a/lib/javase.sh b/lib/javase.sh
new file mode 100644 (file)
index 0000000..a98a915
--- /dev/null
@@ -0,0 +1,248 @@
+j2se_readme() {
+    cat << EOF
+Package for $j2se_title
+---
+
+This package has been automatically created with java-package ($version). 
+All files from the original distribution should have been installed in
+the directory $jvm_base$j2se_name. Please take a look at this directory for
+further information.
+
+EOF
+}
+
+j2se_changelog() {
+    cat << EOF
+$j2se_package ($j2se_version) unstable; urgency=low
+
+  * This package was created with java-package ($version).
+
+ -- $maintainer_name <$maintainer_email>  $( date -R )
+
+EOF
+}
+
+j2se_control() {
+    cat << EOF
+Source: $j2se_package
+Section: non-free/devel
+Priority: optional
+Maintainer: $maintainer_name <$maintainer_email>
+Build-Depends: debhelper (>= 4.0.0)
+Standards-Version: 3.7.2
+
+EOF
+}
+
+j2se_copyright() {
+    cat << EOF
+----------------------------------------------------------------------
+
+This file contains a copy of all copyright files found in the original
+distribution. The original copyright files and further information can
+be found in the directory $jvm_base$j2se_name and its
+subdirectories.
+
+----------------------------------------------------------------------
+EOF
+    ( 
+    cd "$install_dir"
+    find * -type f -iname copyright |
+    while read file; do
+        cat << EOF
+
+File: /$file
+
+----------------------------------------------------------------------
+
+EOF
+        cat "$file"
+        cat << EOF
+
+----------------------------------------------------------------------
+EOF
+    done
+    )
+}
+
+j2se_install_scripts() {
+    cat > "$debian_dir/postinst" << EOF
+#!/bin/bash
+
+set -e
+
+if [ "\$1" = configure ]; then
+
+    # Common functions for all install scripts
+
+    # install_alternatives program_base programs
+    install_alternatives() {
+        program_base="\$1"
+        shift
+        for program in \$*; do
+          if [[ -f "\$program_base/\$program" ]]; then
+            update-alternatives \\
+            --install "/usr/bin/\$program" "\$program" "\$program_base/\$program" $j2se_priority \\
+            --slave "/usr/share/man/man1/\$program.1.gz" "\$program.1.gz" "$jvm_base$j2se_name/man/man1/\$program.1.gz"
+          fi
+        done
+    }
+
+    # install_alternatives_no_man program_base programs
+    install_no_man_alternatives() {
+        program_base="\$1"
+        shift
+        for program in \$*; do
+          if [[ -f "\$program_base/\$program" ]]; then
+            update-alternatives --install "/usr/bin/\$program" "\$program" "\$program_base/\$program" $j2se_priority
+          fi
+        done
+    }
+
+    # install_browser_plugin link_path link_name plugin_name plugin
+    install_browser_plugin() {
+        local link_path="\$1"
+        local link_name="\$2"
+        local plugin_name="\$3"
+        local plugin="\$4"
+        [ -d "\$link_path" ] || install -d -m 755 "\$link_path"
+        if [[ -f "\$plugin" ]]; then
+          update-alternatives --install "\$link_path/\$link_name" "\$plugin_name" "\$plugin" $j2se_priority
+        fi
+    }
+
+EOF
+    eval "$j2se_install" >> "$debian_dir/postinst"
+
+    cat >> "$debian_dir/postinst" << EOF
+fi
+
+#DEBHELPER#
+
+exit 0
+EOF
+    chmod 755 "$debian_dir/postinst"
+    
+    cat > "$debian_dir/prerm" << EOF
+#!/bin/bash
+
+set -e
+
+case "\$1" in
+    remove | deconfigure)
+
+    # Common functions for all remove scripts
+
+    # remove_alternatives program_base programs
+    remove_alternatives() {
+        program_base="\$1"
+        shift
+        for program in \$*; do
+          update-alternatives --remove "\$program" "\$program_base/\$program"
+        done
+    }
+
+    # remove_browser_plugin plugin_name plugin
+    remove_browser_plugin() {
+        local plugin_name="\$1"
+        local plugin="\$2"
+        update-alternatives --remove "\$plugin_name" "\$plugin"
+    }
+
+EOF
+    eval "$j2se_remove" >> "$debian_dir/prerm"
+
+    cat >> "$debian_dir/prerm" << EOF
+    ;;
+esac
+
+#DEBHELPER#
+
+exit 0
+EOF
+    chmod 755 "$debian_dir/prerm"
+}
+
+j2se_info() {
+    cat << EOF
+version="$version"
+j2se_version="$j2se_version"
+maintainer_name="$maintainer_name"
+maintainer_email="$maintainer_email"
+date="$( date +%Y/%m/%d )"
+EOF
+}
+
+# jinfos prefix program_base programs
+jinfos() {
+    prefix="$1"
+    program_base="$2"
+    shift ; shift
+    for program in $*; do
+      echo "$prefix $program $program_base$program" 
+    done
+}
+
+j2se_build() {
+    cd "$tmp"
+    echo "Create debian package:"
+    
+    #export DH_VERBOSE=1
+    export DH_COMPAT=7
+    export DH_OPTIONS=--tmpdir="$install_dir"
+
+    echo "    dh_testdir"
+    dh_testdir
+    echo "    dh_testroot"
+    dh_testroot
+    echo "    dh_installchangelogs"
+    dh_installchangelogs
+    # Problem: dh_installchangelogs thinks this is a native package.
+    echo "    dh_installdocs"
+    dh_installdocs
+    # dh_install
+    # dh_link
+    # Conditionally wrapping this as not all JRE/JDKs have man directories
+    if [ -e "$install_dir/$jvm_base$j2se_name/man" ]; then
+        echo "    dh_compress"
+        dh_compress $( find "$install_dir/$jvm_base$j2se_name/man" -type f ! -name "*.gz" )
+    fi
+    echo "    dh_fixperms"
+    dh_fixperms
+    echo "    dh_installdeb"
+    dh_installdeb
+    echo "    dh_shlibdeps"
+    ldpath=
+    for dir in $( find "$install_dir" -type f -name "*.so*" -printf "%h\n" | sort -u ); do
+        if [[ -z "$ldpath" ]]; then
+            ldpath="$dir"
+        else
+            ldpath="$ldpath:$dir"
+        fi
+    done
+    # suppress some warnings
+    dh_shlibdeps -l"$ldpath" 2>&1 | 
+    { grep -v "warning: format of \`NEEDED lib.*\.so' not recognized" >&2 || true; }
+    echo "    dh_gencontrol"
+    dh_gencontrol
+    echo "    dh_md5sums"
+    dh_md5sums
+    echo "    dh_builddeb"
+    dh_builddeb --destdir="$tmp"
+    local deb_filename="$( echo "${j2se_package}_"*.deb )"
+    echo "    copy $deb_filename into directory $working_dir/"
+    cp "$deb_filename" "$working_dir/"
+    if [ -n "$genchanges" ]; then 
+        echo "    dpkg-genchanges"
+        local changes_filename="${deb_filename%.deb}.changes"
+        dpkg-genchanges -b -u. > "$changes_filename"
+        echo "    copy $changes_filename into directory $working_dir/"
+        cp "$changes_filename" "$working_dir/"
+    fi
+    cat << EOF
+
+The Debian package has been created in the current directory. You can
+install the package as root (e.g. dpkg -i $deb_filename). 
+
+EOF
+}
diff --git a/lib/jdk-doc.sh b/lib/jdk-doc.sh
new file mode 100644 (file)
index 0000000..be98bfd
--- /dev/null
@@ -0,0 +1,58 @@
+j2sdk_doc_control() {
+    j2se_control
+    cat << EOF
+Package: $j2se_package
+Architecture: any
+Depends: 
+Recommends: 
+Provides: 
+Replaces: 
+Description: $j2se_title
+ The Java(TM) SE JDK is a development environment for building
+ applications, applets, and components that can be deployed on the
+ Java(TM) platform.
+ .
+ This package provides the official API documentation published
+ by Oracle.
+ .
+ This package has been automatically created with java-package ($version).
+EOF
+}
+
+j2sdk_doc_doc-base() {
+    cat << EOF
+Document: $j2se_package
+Title: $j2se_title
+Author: $maintainer_name
+Abstract: This is the API Javadoc provided by the vendor
+Section: Programming
+
+Format: HTML
+Index: /usr/share/doc/$j2se_vendor-java$j2se_release-doc/index.html
+Files: /usr/share/doc/$j2se_vendor-java$j2se_release-doc/*.html
+
+EOF
+}
+
+# build debian package
+j2sdk_doc_run() {
+    echo
+    diskfree "$j2se_required_space"
+    read_maintainer_info
+    j2se_package="$j2se_vendor-java$j2se_release-doc"
+    j2se_name="jdk$j2se_release-$j2se_vendor-doc"
+    local target="$install_dir$javadoc_base$j2se_name"
+    install -d -m 755 "$( dirname "$target" )"
+    extract_bin "$archive_path" "$j2se_expected_min_size" "$target"
+    rm -rf "$target/.systemPrefs"
+    echo "7" > "$debian_dir/compat"
+    j2se_readme > "$debian_dir/README.Debian"
+    j2se_changelog > "$debian_dir/changelog"
+    j2sdk_doc_control > "$debian_dir/control"
+    j2se_copyright > "$debian_dir/copyright"
+    j2sdk_doc_doc-base > "$debian_dir/$j2se_package.doc-base"
+    j2se_install_scripts
+    install -d "$target/debian"
+    j2se_info > "$target/debian/info"
+    j2se_build
+}
diff --git a/lib/jdk.sh b/lib/jdk.sh
new file mode 100644 (file)
index 0000000..778b370
--- /dev/null
@@ -0,0 +1,58 @@
+
+j2sdk_control() {
+    j2se_control
+    java_browser_plugin="java-browser-plugin, "
+    depends="\${shlibs:Depends}"
+    if [ "${DEB_BUILD_ARCH:0:3}" = "arm" ]; then
+        # ARM is only softfloat ATM so if building on armhf
+        # force the dependencies to pickup cross platform fu
+        if [ "${DEB_BUILD_ARCH}" == "armhf" ]; then
+            depends="libc6-armel, libsfgcc1, libsfstdc++6"
+        fi
+        # No browser on ARM yet
+        java_browser_plugin=""
+    fi
+    cat << EOF
+Package: $j2se_package
+Architecture: any
+Depends: $depends
+Recommends: netbase, libx11-6 | xlibs, libasound2, libgtk1.2, libstdc++5
+Provides: java-virtual-machine, java-runtime, java2-runtime, $java_browser_plugin java-compiler, java2-compiler, java-runtime-headless, java2-runtime-headless, java-sdk, java2-sdk, j2sdk$j2se_release, j2re$j2se_release
+Replaces: ${j2se_package}debian
+Description: $j2se_title
+ The Java(TM) SE JDK is a development environment for building
+ applications, applets, and components that can be deployed on the
+ Java(TM) platform.
+ .
+ The Java(TM) SE JDK software includes tools useful for developing and
+ testing programs written in the Java programming language and running
+ on the Java platform. These tools are designed to be used from the
+ command line. Except for appletviewer, these tools do not provide a
+ graphical user interface.
+ .
+ This package has been automatically created with java-package ($version).
+EOF
+}
+
+# build debian package
+j2sdk_run() {
+    echo
+    diskfree "$j2se_required_space"
+    read_maintainer_info
+    j2se_package="$j2se_vendor-java$j2se_release-jdk"
+    j2se_name="jdk-$j2se_release-$j2se_vendor-$j2se_arch"
+    local target="$install_dir$jvm_base$j2se_name"
+    install -d -m 755 "$( dirname "$target" )"
+    extract_bin "$archive_path" "$j2se_expected_min_size" "$target"
+    rm -rf "$target/.systemPrefs"
+    echo "7" > "$debian_dir/compat"
+    j2se_readme > "$debian_dir/README.Debian"
+    j2se_changelog > "$debian_dir/changelog"
+    j2sdk_control > "$debian_dir/control"
+    j2se_copyright > "$debian_dir/copyright"
+    j2se_install_scripts
+    install -d "$target/debian"
+    j2se_info > "$target/debian/info"
+    eval "$j2se_jinfo" > "$install_dir$jvm_base.$j2se_name.jinfo"
+    j2se_build
+}
diff --git a/lib/jre.sh b/lib/jre.sh
new file mode 100644 (file)
index 0000000..864f141
--- /dev/null
@@ -0,0 +1,45 @@
+
+j2re_control() {
+    j2se_control
+    cat << EOF
+Package: $j2se_package
+Architecture: any
+Depends: \${shlibs:Depends}
+Recommends: netbase, libx11-6 | xlibs, libasound2, libgtk1.2
+Provides: java-virtual-machine, java-runtime, java2-runtime, java5-runtime, java6-runtime, java-runtime-headless, java2-runtime-headless, java5-runtime-headless, java6-runtime-headless, java-browser-plugin, j2re${j2se_release}
+Replaces: ${j2se_package}debian
+Description: $j2se_title
+ The Java(TM) SE Runtime Environment contains the Java virtual machine,
+ runtime class libraries, and Java application launcher that are
+ necessary to run programs written in the Java progamming language
+ (this includes the Java 2 Plug-In for Netscape and Mozilla
+ browsers). It is not a development environment and doesn't contain
+ development tools such as compilers or debuggers. For development
+ tools, see the Java 2 SDK, Standard Edition.
+ .
+ This package has been automatically created with java-package ($version).
+EOF
+}
+
+# build debian package
+j2re_run() {
+    echo
+    diskfree "$j2se_required_space"
+    read_maintainer_info
+    j2se_package="$j2se_vendor-java$j2se_release-jre"
+    j2se_name="jre-$j2se_release-$j2se_vendor-$j2se_arch"
+    local target="$install_dir$jvm_base$j2se_name"
+    install -d -m 755 "$( dirname "$target" )"
+    extract_bin "$archive_path" "$j2se_expected_min_size" "$target"
+    rm -rf "$target/.systemPrefs"
+    echo "7" > "$debian_dir/compat"
+    j2se_readme > "$debian_dir/README.Debian"
+    j2se_changelog > "$debian_dir/changelog"
+    j2re_control > "$debian_dir/control"
+    j2se_copyright > "$debian_dir/copyright"
+    j2se_install_scripts
+    install -d "$target/debian"
+    j2se_info > "$target/debian/info"
+    eval "$j2se_jinfo" > "$install_dir$jvm_base.$j2se_name.jinfo"
+    j2se_build
+}
diff --git a/lib/oracle-j2re.sh b/lib/oracle-j2re.sh
deleted file mode 100644 (file)
index db287cd..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-# Detect product
-j2se_detect_oracle_j2re=oracle_j2re_detect
-oracle_j2re_detect() {
-
-  if [[ $archive_name =~ jre-([0-9]+)u([0-9]+)-linux-(i586|x64|amd64)\.(bin|tar\.gz) ]]
-  then
-    j2se_release=${BASH_REMATCH[1]}
-    j2se_update=${BASH_REMATCH[2]}
-    j2se_arch=${BASH_REMATCH[3]}
-    j2se_version=$j2se_release.$j2se_update
-    j2se_priority=$((310 + $j2se_release - 1))
-    j2se_expected_min_size=85 #Mb
-
-    # check if the architecture matches
-    let compatible=1
-  
-    case "${DEB_BUILD_ARCH:-$DEB_BUILD_GNU_TYPE}" in
-      i386|i486-linux-gnu)
-        if [[ "$j2se_arch" != "i586" ]]; then compatible=0; fi
-        ;;
-      amd64|x86_64-linux-gnu)
-        if [[ "$j2se_arch" != "x64" && "$j2se_arch" != "amd64" ]]; then compatible=0; fi
-        ;;
-    esac
-
-    if [[ $compatible == 0 ]]
-    then
-      echo "The archive $archive_name is not supported on the ${DEB_BUILD_ARCH} architecture"
-      return
-    fi
-
-
-    cat << EOF
-
-Detected product:
-    Java(TM) Runtime Environment (JRE)
-    Standard Edition, Version $j2se_release Update $j2se_update
-    Oracle(TM)
-EOF
-    if read_yn "Is this correct [Y/n]: "; then
-      j2se_found=true
-      j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 ))
-      j2se_vendor="oracle"
-      j2se_title="Java(TM) JRE, Standard Edition, Oracle(TM)"
-
-      j2se_install=oracle_j2re_install
-      j2se_remove=oracle_j2re_remove
-      j2se_jinfo=oracle_j2re_jinfo
-      oracle_jre_bin_hl="java javaws keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool"
-      oracle_jre_bin_jre="javaws policytool"
-      oracle_no_man_jre_bin_jre="ControlPanel"
-      oracle_jre_lib_hl="jexec"
-      j2re_run
-    fi
-  fi
-}
-
-oracle_j2re_install() {
-    cat << EOF
-if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then
-    exit 0
-fi
-
-install_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_hl
-install_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_jre
-install_no_man_alternatives $jvm_base$j2se_name/bin $oracle_no_man_jre_bin_jre
-install_no_man_alternatives $jvm_base$j2se_name/lib $oracle_jre_lib_hl
-
-plugin_dir="$jvm_base$j2se_name/lib/$DEB_BUILD_ARCH"
-for b in $browser_plugin_dirs;do
-    install_browser_plugin "/usr/lib/\$b/plugins" "libjavaplugin.so" "\$b-javaplugin.so" "\$plugin_dir/libnpjp2.so"
-done
-EOF
-}
-
-oracle_j2re_remove() {
-    cat << EOF
-if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then
-    exit 0
-fi
-
-remove_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_hl
-remove_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_jre
-remove_alternatives $jvm_base$j2se_name/bin $oracle_no_man_jre_bin_jre
-remove_alternatives $jvm_base$j2se_name/lib $oracle_jre_lib_hl
-
-plugin_dir="$jvm_base$j2se_name/lib/$DEB_BUILD_ARCH"
-for b in $browser_plugin_dirs;do
-    remove_browser_plugin "\$b-javaplugin.so" "\$plugin_dir/libnpjp2.so"
-done
-EOF
-}
-
-oracle_j2re_jinfo() {
-    cat << EOF
-name=$j2se_name
-priority=$j2se_priority
-section=main
-EOF
-    jinfos "hl" $jvm_base$j2se_name/bin/ $oracle_jre_bin_hl
-    jinfos "jre" $jvm_base$j2se_name/bin/ $oracle_jre_bin_jre
-    jinfos "jre" $jvm_base$j2se_name/bin/ $oracle_no_man_jre_bin_jre
-    jinfos "hl" $jvm_base$j2se_name/lib/ $oracle_jre_lib_hl
-    for b in $browser_plugin_dirs;do
-        echo "plugin $b-javaplugin.so $jvm_base$j2se_name/lib/$DEB_BUILD_ARCH/libnpjp2.so"
-    done
-}
-
diff --git a/lib/oracle-j2sdk-doc.sh b/lib/oracle-j2sdk-doc.sh
deleted file mode 100644 (file)
index 1bcf07f..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-# Detect product
-oracle_j2sdk_doc_detect() {
-
-  if [[ $archive_name =~ jdk-([0-9]+)u([0-9]+)-apidocs\.zip ]]
-  then
-    j2se_release=${BASH_REMATCH[1]}
-    j2se_update=${BASH_REMATCH[2]}
-    j2se_version=$j2se_release.$j2se_update
-    
-    case "$j2se_release" in
-    6) # JDK 6
-      j2se_expected_min_size=44 #Mb
-      ;;
-    *) # JDK 7 and higher
-      j2se_expected_min_size=290 #Mb
-      ;;
-    esac
-
-    cat << EOF
-
-Detected product:
-    Java(TM) Development Kit (JDK) Documentation
-    Standard Edition, Version $j2se_release Update $j2se_update
-    Oracle(TM)
-EOF
-    if read_yn "Is this correct [Y/n]: "; then
-      j2se_found=true
-      j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 ))
-      j2se_vendor="oracle"
-      j2se_title="Java(TM) JDK, Standard Edition, Oracle(TM) Documentation"
-
-      j2se_install=oracle_j2sdk_doc_install
-      j2se_remove=oracle_j2sdk_doc_remove
-      j2sdk_doc_run
-    fi
-  fi
-}
-
-j2se_detect_j2sdk_doc_oracle=oracle_j2sdk_doc_detect
-
-oracle_j2sdk_doc_install() {
-    cat << EOF
-if [ ! -e "$javadoc_base$j2se_name" ]; then
-    exit 0
-fi
-
-# Register the documentation in the various documentation systems, i.e. dhelp and dwww.
-if [ "\$1" = configure ] ; then
-    if which install-docs >/dev/null 2>&1; then
-        install-docs -i $javadoc_base$j2se_name
-    fi
-fi
-EOF
-}
-
-oracle_j2sdk_doc_remove() {
-    cat << EOF
-if [ ! -e "$javadoc_base$j2se_name" ]; then
-    exit 0
-fi
-
-# Unregister documentation from the various documentation systems, i.e. dhelp and dwww.
-if [ "\$1" = configure ] ; then
-    if which install-docs >/dev/null 2>&1; then
-        install-docs -r $javadoc_base$j2se_name
-    fi
-fi
-EOF
-}
-
diff --git a/lib/oracle-j2sdk.sh b/lib/oracle-j2sdk.sh
deleted file mode 100644 (file)
index 090c2cf..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-# Detect product
-j2se_detect_oracle_j2sdk=oracle_j2sdk_detect
-oracle_j2sdk_detect() {
-
-  if [[ $archive_name =~ jdk-([0-9]+)u([0-9]+)-linux-(i586|x64|amd64)\.(bin|tar\.gz) ]]
-  then
-    j2se_release=${BASH_REMATCH[1]}
-    j2se_update=${BASH_REMATCH[2]}
-    j2se_arch=${BASH_REMATCH[3]}
-    j2se_version=$j2se_release.$j2se_update
-    j2se_priority=$((310 + $j2se_release))
-    j2se_expected_min_size=130 #Mb
-
-    # check if the architecture matches
-    let compatible=1
-  
-    case "${DEB_BUILD_ARCH:-$DEB_BUILD_GNU_TYPE}" in
-      i386|i486-linux-gnu)
-        if [[ "$j2se_arch" != "i586" ]]; then compatible=0; fi
-        ;;
-      amd64|x86_64-linux-gnu)
-        if [[ "$j2se_arch" != "x64" && "$j2se_arch" != "amd64" ]]; then compatible=0; fi
-        ;;
-      armhf|armel|arm-linux-gnueabihf|arm-linux-gnueabi)
-      case "$archive_name" in
-        "jdk-7u"[0-9]"-linux-arm-sfp.tar.gz") # SUPPORTED
-            j2se_version=1.7.0+update${archive_name:6:1}${revision}
-            j2se_expected_min_size=100 #Mb
-            j2se_priority=317
-            found=true
-            ;;
-        "jdk-7u"[0-9][0-9]"-linux-arm-sfp.tar.gz") # SUPPORTED
-            j2se_version=1.7.0+update${archive_name:6:2}${revision}
-            j2se_expected_min_size=60 #Mb
-            j2se_priority=317
-            found=true
-            ;;
-      esac
-      ;;
-    esac
-
-    if [[ $compatible == 0 ]]
-    then
-      echo "The archive $archive_name is not supported on the ${DEB_BUILD_ARCH} architecture"
-      return
-    fi
-    
-    
-    cat << EOF
-
-Detected product:
-    Java(TM) Development Kit (JDK)
-    Standard Edition, Version $j2se_release Update $j2se_update
-    Oracle(TM)
-EOF
-    if read_yn "Is this correct [Y/n]: "; then
-      j2se_found=true
-      j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 ))
-      j2se_vendor="oracle"
-      j2se_title="Java(TM) JDK, Standard Edition, Oracle(TM)"
-
-      j2se_install=oracle_j2sdk_install
-      j2se_remove=oracle_j2sdk_remove
-      j2se_jinfo=oracle_j2sdk_jinfo
-      if [ "${DEB_BUILD_ARCH:0:3}" = "arm" ]; then
-           oracle_jre_bin_hl="java keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool"
-        oracle_jre_bin_jre="policytool"
-      else
-        oracle_jre_bin_hl="java javaws keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool"
-        oracle_jre_bin_jre="javaws policytool"
-      fi
-      if [ "${DEB_BUILD_ARCH:0:3}" != "arm" ]; then
-           oracle_no_man_jre_bin_jre="ControlPanel"
-      fi
-      oracle_jre_lib_hl="jexec"
-      oracle_bin_jdk="appletviewer extcheck idlj jar jarsigner javac javadoc javah javap jconsole jdb jinfo jmap jps jsadebugd jstack jstat jstatd native2ascii rmic serialver"
-      j2sdk_run
-    fi
-  fi
-}
-
-oracle_j2sdk_install() {
-    cat << EOF
-if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then
-    exit 0
-fi
-
-install_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_hl
-install_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_jre
-if [ -n "$oracle_no_man_jre_bin_jre" ]; then
-    install_no_man_alternatives $jvm_base$j2se_name/jre/bin $oracle_no_man_jre_bin_jre
-fi
-install_no_man_alternatives $jvm_base$j2se_name/jre/lib $oracle_jre_lib_hl
-install_alternatives $jvm_base$j2se_name/bin $oracle_bin_jdk
-
-# No plugin for ARM architecture yet
-if [ "${DEB_BUILD_ARCH:0:3}" != "arm" ]; then
-plugin_dir="$jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH"
-for b in $browser_plugin_dirs;do
-           install_browser_plugin "/usr/lib/\$b/plugins" "libjavaplugin.so" "\$b-javaplugin.so" "\$plugin_dir/libnpjp2.so"
-done
-fi
-EOF
-}
-
-oracle_j2sdk_remove() {
-    cat << EOF
-if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then
-    exit 0
-fi
-
-remove_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_hl
-remove_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_jre
-if [ -n "$oracle_no_man_jre_bin_jre" ]; then
-    remove_alternatives $jvm_base$j2se_name/jre/bin $oracle_no_man_jre_bin_jre
-fi
-remove_alternatives $jvm_base$j2se_name/jre/lib $oracle_jre_lib_hl
-remove_alternatives $jvm_base$j2se_name/bin $oracle_bin_jdk
-
-# No plugin for ARM architecture yet
-if [ "${DEB_BUILD_ARCH:0:3}" != "arm" ]; then
-plugin_dir="$jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH"
-for b in $browser_plugin_dirs;do
-    remove_browser_plugin "\$b-javaplugin.so" "\$plugin_dir/libnpjp2.so"
-done
-fi
-EOF
-}
-
-oracle_j2sdk_jinfo() {
-    cat << EOF
-name=$j2se_name
-priority=$j2se_priority
-section=main
-EOF
-    jinfos "hl" $jvm_base$j2se_name/jre/bin/ $oracle_jre_bin_hl
-    jinfos "jre" $jvm_base$j2se_name/jre/bin/ $oracle_jre_bin_jre
-    if [ -n "$oracle_no_man_jre_bin_jre" ]; then
-        jinfos "jre" $jvm_base$j2se_name/jre/bin/ $oracle_no_man_jre_bin_jre
-    fi
-    jinfos "hl" $jvm_base$j2se_name/jre/lib/ $oracle_jre_lib_hl
-    jinfos "jdk" $jvm_base$j2se_name/bin/ $oracle_bin_jdk
-    if [ "${DEB_BUILD_ARCH:0:3}" != "arm" ]; then
-        for b in $browser_plugin_dirs;do
-            echo "plugin iceweasel-javaplugin.so $jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH/libnpjp2.so"
-        done
-    fi
-}
diff --git a/lib/oracle-jdk-doc.sh b/lib/oracle-jdk-doc.sh
new file mode 100644 (file)
index 0000000..1bcf07f
--- /dev/null
@@ -0,0 +1,70 @@
+# Detect product
+oracle_j2sdk_doc_detect() {
+
+  if [[ $archive_name =~ jdk-([0-9]+)u([0-9]+)-apidocs\.zip ]]
+  then
+    j2se_release=${BASH_REMATCH[1]}
+    j2se_update=${BASH_REMATCH[2]}
+    j2se_version=$j2se_release.$j2se_update
+    
+    case "$j2se_release" in
+    6) # JDK 6
+      j2se_expected_min_size=44 #Mb
+      ;;
+    *) # JDK 7 and higher
+      j2se_expected_min_size=290 #Mb
+      ;;
+    esac
+
+    cat << EOF
+
+Detected product:
+    Java(TM) Development Kit (JDK) Documentation
+    Standard Edition, Version $j2se_release Update $j2se_update
+    Oracle(TM)
+EOF
+    if read_yn "Is this correct [Y/n]: "; then
+      j2se_found=true
+      j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 ))
+      j2se_vendor="oracle"
+      j2se_title="Java(TM) JDK, Standard Edition, Oracle(TM) Documentation"
+
+      j2se_install=oracle_j2sdk_doc_install
+      j2se_remove=oracle_j2sdk_doc_remove
+      j2sdk_doc_run
+    fi
+  fi
+}
+
+j2se_detect_j2sdk_doc_oracle=oracle_j2sdk_doc_detect
+
+oracle_j2sdk_doc_install() {
+    cat << EOF
+if [ ! -e "$javadoc_base$j2se_name" ]; then
+    exit 0
+fi
+
+# Register the documentation in the various documentation systems, i.e. dhelp and dwww.
+if [ "\$1" = configure ] ; then
+    if which install-docs >/dev/null 2>&1; then
+        install-docs -i $javadoc_base$j2se_name
+    fi
+fi
+EOF
+}
+
+oracle_j2sdk_doc_remove() {
+    cat << EOF
+if [ ! -e "$javadoc_base$j2se_name" ]; then
+    exit 0
+fi
+
+# Unregister documentation from the various documentation systems, i.e. dhelp and dwww.
+if [ "\$1" = configure ] ; then
+    if which install-docs >/dev/null 2>&1; then
+        install-docs -r $javadoc_base$j2se_name
+    fi
+fi
+EOF
+}
+
diff --git a/lib/oracle-jdk.sh b/lib/oracle-jdk.sh
new file mode 100644 (file)
index 0000000..090c2cf
--- /dev/null
@@ -0,0 +1,148 @@
+# Detect product
+j2se_detect_oracle_j2sdk=oracle_j2sdk_detect
+oracle_j2sdk_detect() {
+
+  if [[ $archive_name =~ jdk-([0-9]+)u([0-9]+)-linux-(i586|x64|amd64)\.(bin|tar\.gz) ]]
+  then
+    j2se_release=${BASH_REMATCH[1]}
+    j2se_update=${BASH_REMATCH[2]}
+    j2se_arch=${BASH_REMATCH[3]}
+    j2se_version=$j2se_release.$j2se_update
+    j2se_priority=$((310 + $j2se_release))
+    j2se_expected_min_size=130 #Mb
+
+    # check if the architecture matches
+    let compatible=1
+  
+    case "${DEB_BUILD_ARCH:-$DEB_BUILD_GNU_TYPE}" in
+      i386|i486-linux-gnu)
+        if [[ "$j2se_arch" != "i586" ]]; then compatible=0; fi
+        ;;
+      amd64|x86_64-linux-gnu)
+        if [[ "$j2se_arch" != "x64" && "$j2se_arch" != "amd64" ]]; then compatible=0; fi
+        ;;
+      armhf|armel|arm-linux-gnueabihf|arm-linux-gnueabi)
+      case "$archive_name" in
+        "jdk-7u"[0-9]"-linux-arm-sfp.tar.gz") # SUPPORTED
+            j2se_version=1.7.0+update${archive_name:6:1}${revision}
+            j2se_expected_min_size=100 #Mb
+            j2se_priority=317
+            found=true
+            ;;
+        "jdk-7u"[0-9][0-9]"-linux-arm-sfp.tar.gz") # SUPPORTED
+            j2se_version=1.7.0+update${archive_name:6:2}${revision}
+            j2se_expected_min_size=60 #Mb
+            j2se_priority=317
+            found=true
+            ;;
+      esac
+      ;;
+    esac
+
+    if [[ $compatible == 0 ]]
+    then
+      echo "The archive $archive_name is not supported on the ${DEB_BUILD_ARCH} architecture"
+      return
+    fi
+    
+    
+    cat << EOF
+
+Detected product:
+    Java(TM) Development Kit (JDK)
+    Standard Edition, Version $j2se_release Update $j2se_update
+    Oracle(TM)
+EOF
+    if read_yn "Is this correct [Y/n]: "; then
+      j2se_found=true
+      j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 ))
+      j2se_vendor="oracle"
+      j2se_title="Java(TM) JDK, Standard Edition, Oracle(TM)"
+
+      j2se_install=oracle_j2sdk_install
+      j2se_remove=oracle_j2sdk_remove
+      j2se_jinfo=oracle_j2sdk_jinfo
+      if [ "${DEB_BUILD_ARCH:0:3}" = "arm" ]; then
+           oracle_jre_bin_hl="java keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool"
+        oracle_jre_bin_jre="policytool"
+      else
+        oracle_jre_bin_hl="java javaws keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool"
+        oracle_jre_bin_jre="javaws policytool"
+      fi
+      if [ "${DEB_BUILD_ARCH:0:3}" != "arm" ]; then
+           oracle_no_man_jre_bin_jre="ControlPanel"
+      fi
+      oracle_jre_lib_hl="jexec"
+      oracle_bin_jdk="appletviewer extcheck idlj jar jarsigner javac javadoc javah javap jconsole jdb jinfo jmap jps jsadebugd jstack jstat jstatd native2ascii rmic serialver"
+      j2sdk_run
+    fi
+  fi
+}
+
+oracle_j2sdk_install() {
+    cat << EOF
+if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then
+    exit 0
+fi
+
+install_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_hl
+install_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_jre
+if [ -n "$oracle_no_man_jre_bin_jre" ]; then
+    install_no_man_alternatives $jvm_base$j2se_name/jre/bin $oracle_no_man_jre_bin_jre
+fi
+install_no_man_alternatives $jvm_base$j2se_name/jre/lib $oracle_jre_lib_hl
+install_alternatives $jvm_base$j2se_name/bin $oracle_bin_jdk
+
+# No plugin for ARM architecture yet
+if [ "${DEB_BUILD_ARCH:0:3}" != "arm" ]; then
+plugin_dir="$jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH"
+for b in $browser_plugin_dirs;do
+           install_browser_plugin "/usr/lib/\$b/plugins" "libjavaplugin.so" "\$b-javaplugin.so" "\$plugin_dir/libnpjp2.so"
+done
+fi
+EOF
+}
+
+oracle_j2sdk_remove() {
+    cat << EOF
+if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then
+    exit 0
+fi
+
+remove_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_hl
+remove_alternatives $jvm_base$j2se_name/jre/bin $oracle_jre_bin_jre
+if [ -n "$oracle_no_man_jre_bin_jre" ]; then
+    remove_alternatives $jvm_base$j2se_name/jre/bin $oracle_no_man_jre_bin_jre
+fi
+remove_alternatives $jvm_base$j2se_name/jre/lib $oracle_jre_lib_hl
+remove_alternatives $jvm_base$j2se_name/bin $oracle_bin_jdk
+
+# No plugin for ARM architecture yet
+if [ "${DEB_BUILD_ARCH:0:3}" != "arm" ]; then
+plugin_dir="$jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH"
+for b in $browser_plugin_dirs;do
+    remove_browser_plugin "\$b-javaplugin.so" "\$plugin_dir/libnpjp2.so"
+done
+fi
+EOF
+}
+
+oracle_j2sdk_jinfo() {
+    cat << EOF
+name=$j2se_name
+priority=$j2se_priority
+section=main
+EOF
+    jinfos "hl" $jvm_base$j2se_name/jre/bin/ $oracle_jre_bin_hl
+    jinfos "jre" $jvm_base$j2se_name/jre/bin/ $oracle_jre_bin_jre
+    if [ -n "$oracle_no_man_jre_bin_jre" ]; then
+        jinfos "jre" $jvm_base$j2se_name/jre/bin/ $oracle_no_man_jre_bin_jre
+    fi
+    jinfos "hl" $jvm_base$j2se_name/jre/lib/ $oracle_jre_lib_hl
+    jinfos "jdk" $jvm_base$j2se_name/bin/ $oracle_bin_jdk
+    if [ "${DEB_BUILD_ARCH:0:3}" != "arm" ]; then
+        for b in $browser_plugin_dirs;do
+            echo "plugin iceweasel-javaplugin.so $jvm_base$j2se_name/jre/lib/$DEB_BUILD_ARCH/libnpjp2.so"
+        done
+    fi
+}
diff --git a/lib/oracle-jre.sh b/lib/oracle-jre.sh
new file mode 100644 (file)
index 0000000..db287cd
--- /dev/null
@@ -0,0 +1,108 @@
+# Detect product
+j2se_detect_oracle_j2re=oracle_j2re_detect
+oracle_j2re_detect() {
+
+  if [[ $archive_name =~ jre-([0-9]+)u([0-9]+)-linux-(i586|x64|amd64)\.(bin|tar\.gz) ]]
+  then
+    j2se_release=${BASH_REMATCH[1]}
+    j2se_update=${BASH_REMATCH[2]}
+    j2se_arch=${BASH_REMATCH[3]}
+    j2se_version=$j2se_release.$j2se_update
+    j2se_priority=$((310 + $j2se_release - 1))
+    j2se_expected_min_size=85 #Mb
+
+    # check if the architecture matches
+    let compatible=1
+  
+    case "${DEB_BUILD_ARCH:-$DEB_BUILD_GNU_TYPE}" in
+      i386|i486-linux-gnu)
+        if [[ "$j2se_arch" != "i586" ]]; then compatible=0; fi
+        ;;
+      amd64|x86_64-linux-gnu)
+        if [[ "$j2se_arch" != "x64" && "$j2se_arch" != "amd64" ]]; then compatible=0; fi
+        ;;
+    esac
+
+    if [[ $compatible == 0 ]]
+    then
+      echo "The archive $archive_name is not supported on the ${DEB_BUILD_ARCH} architecture"
+      return
+    fi
+
+
+    cat << EOF
+
+Detected product:
+    Java(TM) Runtime Environment (JRE)
+    Standard Edition, Version $j2se_release Update $j2se_update
+    Oracle(TM)
+EOF
+    if read_yn "Is this correct [Y/n]: "; then
+      j2se_found=true
+      j2se_required_space=$(( $j2se_expected_min_size * 2 + 20 ))
+      j2se_vendor="oracle"
+      j2se_title="Java(TM) JRE, Standard Edition, Oracle(TM)"
+
+      j2se_install=oracle_j2re_install
+      j2se_remove=oracle_j2re_remove
+      j2se_jinfo=oracle_j2re_jinfo
+      oracle_jre_bin_hl="java javaws keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool"
+      oracle_jre_bin_jre="javaws policytool"
+      oracle_no_man_jre_bin_jre="ControlPanel"
+      oracle_jre_lib_hl="jexec"
+      j2re_run
+    fi
+  fi
+}
+
+oracle_j2re_install() {
+    cat << EOF
+if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then
+    exit 0
+fi
+
+install_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_hl
+install_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_jre
+install_no_man_alternatives $jvm_base$j2se_name/bin $oracle_no_man_jre_bin_jre
+install_no_man_alternatives $jvm_base$j2se_name/lib $oracle_jre_lib_hl
+
+plugin_dir="$jvm_base$j2se_name/lib/$DEB_BUILD_ARCH"
+for b in $browser_plugin_dirs;do
+    install_browser_plugin "/usr/lib/\$b/plugins" "libjavaplugin.so" "\$b-javaplugin.so" "\$plugin_dir/libnpjp2.so"
+done
+EOF
+}
+
+oracle_j2re_remove() {
+    cat << EOF
+if [ ! -e "$jvm_base$j2se_name/debian/info" ]; then
+    exit 0
+fi
+
+remove_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_hl
+remove_alternatives $jvm_base$j2se_name/bin $oracle_jre_bin_jre
+remove_alternatives $jvm_base$j2se_name/bin $oracle_no_man_jre_bin_jre
+remove_alternatives $jvm_base$j2se_name/lib $oracle_jre_lib_hl
+
+plugin_dir="$jvm_base$j2se_name/lib/$DEB_BUILD_ARCH"
+for b in $browser_plugin_dirs;do
+    remove_browser_plugin "\$b-javaplugin.so" "\$plugin_dir/libnpjp2.so"
+done
+EOF
+}
+
+oracle_j2re_jinfo() {
+    cat << EOF
+name=$j2se_name
+priority=$j2se_priority
+section=main
+EOF
+    jinfos "hl" $jvm_base$j2se_name/bin/ $oracle_jre_bin_hl
+    jinfos "jre" $jvm_base$j2se_name/bin/ $oracle_jre_bin_jre
+    jinfos "jre" $jvm_base$j2se_name/bin/ $oracle_no_man_jre_bin_jre
+    jinfos "hl" $jvm_base$j2se_name/lib/ $oracle_jre_lib_hl
+    for b in $browser_plugin_dirs;do
+        echo "plugin $b-javaplugin.so $jvm_base$j2se_name/lib/$DEB_BUILD_ARCH/libnpjp2.so"
+    done
+}
+