Coder Social home page Coder Social logo

oab-java6's Introduction

OAB-Java

oab-java.sh v0.3.0 - Create a local 'apt' repository for Sun Java 6 and/or Oracle Java 7 packages.

Copyright (c) Martin Wimpress, http://flexion.org. MIT License

By running this script to download Java you acknowledge that you have read and accepted the terms of the Oracle end user license agreement.

Donate

If you or your organisation has found oab-java.sh useful please consider donating to this project. It is nice to have the effort I've put into this script recognised, I don't ask for much, it is at your discretion.

Donate to OAB-Java Flattr OAB-Java

Usage

sudo ./oab-java.sh

Optional parameters

  • -7 : Build oracle-java7 packages instead of sun-java6
  • -c : Remove pre-existing packages from /var/local/oab/deb and sources from /var/local/oab/src.
  • -k : Use the specified existing key instead of generating one
  • -s : Skip building if the packages already exist
  • -t : Specify the Java version tag to use from the upstream Debian packaging script.
  • -h : This help

How do I download and run this thing?

Like this.

cd ~/
wget https://github.com/flexiondotorg/oab-java6/raw/0.3.0/oab-java.sh -O oab-java.sh
chmod +x oab-java.sh
sudo ./oab-java.sh

If you are behind a proxy you may need to run using:

sudo -i ./oab-java.sh

If you want to see what this script is doing while it is running then execute the following from another shell:

tail -f ./oab-java.sh.log

How it works

This script is merely a wrapper for the most excellent Debian packaging scripts prepared by Janusz Dziemidowicz.

The basic execution steps are:

  • Remove, my now disabled, Java PPA ppa:flexiondotorg/java.
  • Install the tools required to build the Java packages.
  • Create download cache in /var/local/oab/pkg.
  • Download the i586 and x64 Java install binaries from Oracle. Yes, both are required (for sun-java6 only).
  • Clone the build scripts from https://github.com/rraptorr/
  • Build the Java packages applicable to your system.
  • Create local apt repository in /var/local/oab/deb for the newly built Java Packages.
  • Create a GnuPG signing key in /var/local/oab/gpg if none exists.
  • Sign the local apt repository using the local GnuPG signing key.

What gets installed?

This script will no longer try and directly install or upgrade any Java packages, instead a local apt repository is created that hosts locally built Java packages applicable to your system. It is up to you to install or upgrade the Java packages you require using apt-get, aptitude or synaptic, etc. For example, once this script has been run you can simply install the JRE by executing the following from a shell.

sudo apt-get install sun-java6-jre

Or if you ran the script with the -7 option.

sudo apt-get install oracle-java7-jre

If you already have the "official" Ubuntu packages installed then you can upgrade by executing the following from a shell.

sudo apt-get upgrade

The local apt repository is just that, local. It is not accessible remotely and oab-java.sh will never enable that capability to ensure compliance with Oracle's asinine license requirements.

By default, the script creates a temporary GPG keyring in the working directory. In order to use the current user's GPG chain instead, specify the key ID of an existing secret key. Run gpg -K to list available keys.

Known Issues

  • Building Java 7 on Ubuntu Lucid 10.04 is no longer supported as the upstream scripts require debhelper>=8 which is not officially available for Lucid.
  • The Oracle download servers can be horribly slow. My script caches the downloads so you only need download each file once.

What is 'oab'?

Because, O.A.B! ;-)

History

0.3.0

  • Fixed download Java7 JCE. Thanks to Michał Kowalczuk.

0.2.9

  • Fixed downloading Java6 JCE. Thanks to Naoya Nakazawa.
  • Fixed downloading Java7.
  • Building Java7 on Ubunu Lucid 10.04 is no longer supported.

0.2.8

  • Fixed building on Ubuntu 13.04 and Debian 7.
  • Added spinner overide support. Thanks to Paul Scott.
  • Added manual overide of Java version to build using the upstream Git tags. Thanks to Jonathan Harker.
  • Updated (-c) option to optionally clean .deb packages and sources.
  • Updated documentation and migrated to Markdown.
  • Removed imvirt requirement.
  • Tested on Ubuntu 10.04, Ubuntu 12.04, Ubuntu 13.04, Debian 6 and Debian 7.

0.2.7

  • Many fixes and improvements. Thanks for all the contributions!

0.2.6

  • Fixed screen scraping of the Oracle website.

0.2.5

  • Fixed building Oracle Java 7 by adding libxrender1 to the dependencies.

0.2.4

  • Added support for JCE Unlimited Strength Jurisdiction Policy Files. Thanks to Ladios Jonquil and Jameson J Lee.
  • Reverted to https for git clone of upstream tools.
  • Updated download links to Sun Java 6 and Oracle Java 7. Thanks to Ladios Jonquil and Jameson J Lee.

0.2.3

  • Added an option to build oracle-java7 packages.
  • Integrated common function into oab-java6.sh

0.2.2

  • Added an option to use a pre-existing signing key. Thanks to Hannes Schmidt.
  • The git clone of rraptorr/sun-java6 now uses http rather than https.

0.2.1

  • Fixed downloading from edelivery.oracle.com (again). Thanks to onlymostlydead (Mark).

0.2.0

  • Fixed downloading from edelivery.oracle.com when ca-certificates is not installed.
  • Fixed the skip rebuilding behaviour so it works as described.
  • Fixed the format of apt source file.
  • Documentation is now self referencing.

0.1.9

  • Fixed download of the Oracle binary packages, which now requires cookies. Thanks to Martin Polden and Miah Johnson.
  • Added an option (-s) to skip rebuilding if packages already exist, tanks to Derek Chen-Becker.
  • Added a comment to the apt source file, thanks to Eshwar Andhavarapu.
  • Added documentation for user running the script behind a proxy server, thanks to Olzhas.
  • Should now build on Ubuntu 12.04 LTS, but untested.
  • Updated documentation which is now correctly formatted as reStructuredText.

0.1.8

  • Added dynamic determination of Java package URLs and sizes.
  • Added an option (-c) to optionally clean .deb package.

0.1.7

  • Fixed GPG key creation on VMware ESX Server.
  • Fixed clone of the sun-java6 repository for users behind restrictive firewalls, thanks to Thorsten Möllers.

0.1.6

  • Fixed downloading of common.sh when ca-certificates is not installed.
    • Closes : #3
  • Updated to support Java6u31
    • Closes : #7
    • Closes : #8
  • NOTE! Requires that the upstream script tags Java6u31 as stable, see the following ticket https://github.com/rraptorr/sun-java6/issues/3
  • Prevent script from running under Ubuntu Precise as it is currently known to be unsupported.
    • Closes : #4
  • Prevent automated key generation when running in an OpenVZ container because I'm too stupid to work out a proper solution

0.1.5

  • Added the missing code that actually does the build. Doh!

0.1.4

  • Added GnuPG signing of the local apt repository.
  • Updated package building to preserve the upstream package urgency.
  • Re-factored to remove hard coded versions, now uses debian/changelog.
  • Fixed the override file generation to ensure it doesn't contain duplicates.
  • Updated documentation.

0.1.3

  • Added checking out of tagged releases of the upstream scripts.
    • Closes : #1
  • Added loose distribution checking so it should now work with Linux Mint and other Ubuntu derivatives.
    • Closes : #2
  • Added the creation of a local apt repository.
  • Removed installation of Java packages, you can now use apt-get yourself.
  • Updated documentation.

0.1.2

  • Fixed build requirements.
  • Fixed install of ia32-sun-java6-bin on 64-bit systems.
  • Fixed install of Java browser plug-in on systems without a supported browser.
  • Added runtime requirements.
  • Added TODO.
  • Updated documentation.

0.1.1

  • Updated to use dynamic version detection throughout.
  • Fixed package installation when upgrading.
  • Minor documentation updates.

0.1.0

  • Initial release.

Credits

This package is written and maintained by Martin Wimpress, [email protected]

Other contributors, listed alphabetically, are:

  • Björgvin Ragnarsson
  • David Kovach
  • Derek Chen-Becker
  • Eshwar Andhavarapu
  • Greg Swallow
  • Hannes Schmidt
  • Ihor Kaharlichenko
  • Jameson J Lee
  • Jonathan Harker
  • Ladios Jonquil
  • Martin Polden
  • Miah Johnson
  • Michał Kowalczuk
  • Naoya Nakazawa
  • onlymostlydead
  • Paul Scott
  • Peter Leibiger
  • Robert Pendell
  • Thorsten Möllers

Many thanks for all contributions!

Todo

  • Check the binary packages downloaded from Oracle are the correct size.
  • Add support to build for a given Ubuntu distribution.
  • Add support to build using pbuilder or use fakeroot.

License

Copyright (c) 2013 Martin Wimpress, http://flexion.org/

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

oab-java6's People

Contributors

bretagne-peiqi avatar dchenbecker avatar flexiondotorg avatar gontadu avatar icio avatar ladios avatar markdevlin avatar mkowalczuk avatar mpolden avatar n0ts avatar nifgraup avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

oab-java6's Issues

Use of uninitialized value $avail

Machine:
AMI: ubuntu/images/ebs/ubuntu-oneiric-11.10-i386-server-20120222 (ami-8d5069f9)


oab-java6.sh v0.1.9 - Create a local 'apt' repository for Ubuntu Java packages.
Copyright (c) Martin Wimpress, http://flexion.org. MIT License

By running this script to download Java you acknowledge that you have
read and accepted the terms of the Oracle end user license agreement.

If you want to see what this is script is doing while it is running then execute
the following from another shell:

tail -f /home/ubuntu/oab-java6.sh.log

Downloading common.sh
[x] Removing ppa:flexiondotorg/java success
[x] Installing Java build requirements success
[x] Making build directories success
[x] Removing clones of https://github.com/rraptorr/sun-java6 success
[x] Cloning https://github.com/rraptorr/sun-java6 success
[x] Checking out v6.31-2 success
[x] Getting Java SE download pagesuccess
[x] Getting current release download page success
[x] Downloading jdk-6u31-linux-i586.bin : 81.34 MB success
[x] Symlinking jdk-6u31-linux-i586.bin success
[x] Downloading jdk-6u31-linux-x64.bin : 81.62 MB success
[x] Symlinking jdk-6u31-linux-x64.bin success
[x] Updating the changelog success
[x] Building the packages success
[x] Moving the packages success
[x] Creating Packages.gz file success
[x] Creating Release file success
Use of uninitialized value $avail in concatenation (.) or string at /usr/share/perl5/ImVirt/Utils/dmidecode/kernel.pm line 45.
Use of uninitialized value $avail in concatenation (.) or string at /usr/share/perl5/ImVirt/Utils/dmidecode/kernel.pm line 45.
Use of uninitialized value $avail in concatenation (.) or string at /usr/share/perl5/ImVirt/Utils/dmidecode/kernel.pm line 45.
Use of uninitialized value $avail in concatenation (.) or string at /usr/share/perl5/ImVirt/Utils/dmidecode/kernel.pm line 45.
Use of uninitialized value $avail in concatenation (.) or string at /usr/share/perl5/ImVirt/Utils/dmidecode/kernel.pm line 45.
Use of uninitialized value $avail in concatenation (.) or string at /usr/share/perl5/ImVirt/Utils/dmidecode/kernel.pm line 45.
[x] Create GnuPG configuration success
[x] Start generating entropy success
[x] Creating signing key success
[x] Stop generating entropy success
[x] Signing the 'Release' file success
[x] Exporting public key success
[x] Adding public key success
[x] Update package list success
All done!

dpkg-shlibdeps: warning: Can't extract name and version from library name

I thought the build went fine until I tried to install:

[x] Update package list success
All done!
djerk@nsc-djerk:~$ sudo apt-get install sun-java-jre sun-java-jdk sun-java6-plugin sun-java6-fonts
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package sun-java-jre
E: Unable to locate package sun-java-jdk

The logs show many lines like this:

dpkg-shlibdeps: warning: Can't extract name and version from library name libjava.so' dpkg-shlibdeps: warning: Can't extract name and version from library namelibjvm.so'
dpkg-shlibdeps: warning: Can't extract name and version from library name libjli.so' dpkg-shlibdeps: warning: couldn't find library libmawt.so needed by debian/sun-java6-bin/usr/lib/jvm/java-6-sun-1.6.0.33/jre/lib/i386/libjawt.so (ELF format: 'elf32-i386'; RPATH: '/usr/lib/jvm/java-6-sun-1.6.0.33/jre/lib/i386'). dpkg-shlibdeps: warning: Can't extract name and version from library namelibawt.so'
...

Ubuntu 12.04 LTS i386

imvirt not available on Hardy Heron

Old version of ubuntu don't have imvirt available. It would be good if there were an environmental variable that could be set to not try to apt-get it.

404 in http://github.com/rraptorr/sun-java6/info/refs

Well the whole http://github.com/rraptorr/sun-java6/info is actually missing
so the oab-java6.sh does not work.
here's the ouput

oab-java.sh v0.2.3 - Create a local 'apt' repository for Sun Java 6 and/or Oracle Java 7 packages.

Copyright (c) Martin Wimpress, http://flexion.org. MIT License

By running this script to download Java you acknowledge that you have
read and accepted the terms of the Oracle end user license agreement.

If you want to see what this is script is doing while it is running then execute
the following from another shell:

tail -f /home/h205g/oab-java6/oab-java.sh.log

[x] Installing Java build requirements success
[x] Making build directories success
[x] Removing clones of http://github.com/rraptorr/sun-java6 success
[x] Cloning http://github.com/rraptorr/sun-java6 failed
[i] Showing the last 5 lines from the logfile (/home/h205g/oab-java6/oab-java.sh.log)...
error: Failed to connect to 207.97.227.239: Network is unreachable while accessing http://github.com/rraptorr/sun-java6/info/refs

fatal: HTTP request failed
13035's retcode: 128
failed

ERROR! Packages failed to build.

Output from script:

oab-java.sh v0.2.5 - Create a local 'apt' repository for Sun Java 6 and/or Oracle Java 7 packages.

Copyright (c) Martin Wimpress, http://flexion.org. MIT License

By running this script to download Java you acknowledge that you have
read and accepted the terms of the Oracle end user license agreement.

If you want to see what this is script is doing while it is running then execute
the following from another shell:

tail -f /home/omero/oab-java6/oab-java.sh.log

[x] Installing Java build requirements success
[x] Making build directories success
[x] Removing clones of https://github.com/rraptorr/sun-java6 success
[x] Cloning https://github.com/rraptorr/sun-java6 success
[x] Checking out v6.35-1 success
[x] Getting Java SE download page success
[x] Getting current release download page success
[x] Getting previous releases download page success
[x] Downloading jdk-6u35-linux-i586.bin : success
[x] Symlinking jdk-6u35-linux-i586.bin success
[x] Downloading jdk-6u35-linux-x64.bin : success
[x] Symlinking jdk-6u35-linux-x64.bin success
[x] Getting Java Cryptography Extension download page success
[x] Downloading jce_policy-6.zip : 8.89 KB success
[x] Symlinking jce_policy-6.zip success
[x] Updating the changelog success
[x] Building the packages success
ERROR! Packages failed to build.

This is the last part of the log (the one with error):

Build information

TOP = usr/lib/jvm
VENDOR = sun
RELEASE = 6
PRODUCT = java6
basename = sun-java6
version = 6
releng_ver = 35
unpackdir = jdk1.6.0_35
srcdir = x64-jdk
all_archs = i586 x64
arch = x64
archdir = amd64
bin_pattern = jdk-6u35-linux-%.bin

rm -rf jdk1.6.0_35
binsize=$(wc -c jdk-6u35-linux-i586.bin | awk '{print $1}');
zipstart=$(unzip -ql jdk-6u35-linux-i586.bin 2>&1 >/dev/null | sed -n -e 's/.* ([0-9][0-9]) extra bytes./\1/p');
tail -c $(expr $binsize - $zipstart) jdk-6u35-linux-i586.bin > tmp-jdk.zip
expr: syntax error
tail: jdk-6u35-linux-i586.bin: invalid number of bytes
make: *** [unpack-i586-stamp] Error 1
dpkg-buildpackage: error: debian/rules build gave error exit status 2
��13917's retcode: 2
success

Running on fresh install of Ubuntu 11.04 64b server. Any idea what is going on?

failed to download

W: Failed to fetch http://ppa.launchpad.net/kazam-team/unstable-series/ubuntu/dists/lucid/main/binary-amd64/Packages.gz

E: Some index files failed to download, they have been ignored, or old ones used instead.
21255's retcode: 100
failed

on a

lsb_release -a
LSB Version: core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch
Distributor ID: Ubuntu
Description: Ubuntu 10.04.4 LTS
Release: 10.04
Codename: lucid

Packages failed to build

I got the following error when executing the oab-java.sh script (on Ubuntu 10.04 64 bit):
...
...
[x] Symlinking jdk-6u33-linux-i586.bin success
[x] Downloading jdk-6u33-linux-x64.bin : success
[x] Symlinking jdk-6u33-linux-x64.bin success
[x] Updating the changelog success
[x] Building the packages success
ERROR! Packages failed to build.

The end of the log file looks like this:

Build information

TOP = usr/lib/jvm
VENDOR = sun
RELEASE = 6
PRODUCT = java6
basename = sun-java6
version = 6
releng_ver = 33
unpackdir = jdk1.6.0_33
srcdir = x64-jdk
all_archs = i586 x64
arch = x64
archdir = amd64
bin_pattern = jdk-6u33-linux-%.bin

rm -rf jdk1.6.0_33
binsize=$(wc -c jdk-6u33-linux-i586.bin | awk '{print $1}');
zipstart=$(unzip -ql jdk-6u33-linux-i586.bin 2>&1 >/dev/null | sed -n -e 's/.* ([0-9][0-9]) extra bytes./\1/p');
tail -c $(expr $binsize - $zipstart) jdk-6u33-linux-i586.bin > tmp-jdk.zip
expr: syntax error
tail: jdk-6u33-linux-i586.bin: invalid number of bytes
make: *** [unpack-i586-stamp] Error 1
dpkg-buildpackage: error: debian/rules build gave error exit status 2
^H^H1774's retcode: 2
success

Could you help me please to find out the root cause of this problem?

Couldn't resolve host 'github.com' while accessing https://github.com/rraptorr/sun-java6/info/refs

I get the following error when I run

$ sudo ./oab-java.sh

[x] Installing Java build requirements success
[x] Making build directories success
[x] Removing clones of https://github.com/rraptorr/sun-java6 success
[x] Cloning https://github.com/rraptorr/sun-java6 failed
[i] Showing the last 5 lines from the logfile (/home/vagrant/oab-java.sh.log)...
error: Couldn't resolve host 'github.com' while accessing https://github.com/rraptorr/sun-java6/info/refs

The same kind of error occurs when I run

$ sudo oab-java.sh -7

Currently broken, oracle redirecting to homepage

removed directory: /var/local/oab/src/.git/refs' removed/var/local/oab/src/.git/info/exclude'
removed directory: /var/local/oab/src/.git/info' removed directory:/var/local/oab/src/.git'
removed directory: `/var/local/oab/src'
^H^H21873's retcode: 0
success
[x] Cloning https://github.com/rraptorr/sun-java6 Cloning into 'src'...
^H^H21879's retcode: 0
success
[x] Checking out v6.32-1 Note: checking out 'v6.32-1'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

git checkout -b new_branch_name

HEAD is now at abd6e47... Java 6u32 release
^H^H21896's retcode: 0
success
[x] Getting Java SE download page --2012-04-26 22:49:12-- http://www.oracle.com/technetwork/java/javase/downloads/index.html
Resolving www.oracle.com (www.oracle.com)... 23.47.17.55
Connecting to www.oracle.com (www.oracle.com)|23.47.17.55|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `/tmp/oab-index.html'

 0K .......... .......... .......... .......... .......... 5.19M
50K .......... .......... .......... .......... .......... 12.1M

100K .......... .......... .......... .......... ........ 14.4M=0.02s

2012-04-26 22:49:12 (8.67 MB/s) - `/tmp/oab-index.html' saved [152122]

^H^H21917's retcode: 0
success
[x] Getting current release download page --2012-04-26 22:49:12-- http://www.oracle.com/tr%3E
Resolving www.oracle.com (www.oracle.com)... 23.47.17.55
Connecting to www.oracle.com (www.oracle.com)|23.47.17.55|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.oracle.com/us/tr%3E [following]
--2012-04-26 22:49:12-- http://www.oracle.com/us/tr%3E
Reusing existing connection to www.oracle.com:80.
HTTP request sent, awaiting response... 404 Not Found
2012-04-26 22:49:14 ERROR 404: Not Found.

^H^H21928's retcode: 8
failed

Script attempted to build 32-bit JDK 6 on amd64.

The following lead to an attempted build of 32-bit JDK 6u35:

wget https://github.com/flexiondotorg/oab-java6/raw/0.2.1/oab-java6.sh -O oab-java6.sh
chmod +x oab-java6.sh 
sudo ./oab-java6.sh 

Ubuntu LTS 12.04.1 amd64 fresh install

Also, this is a 64-bit system, not a 32-bit one.

~  ᐅ uname -mps
Linux x86_64 x86_64

You are on a branch yet to be born

I have no idea what is going on and the best I can do is post this error message.

[~]$ sudo ./oab-java6.sh 
oab-java6.sh v0.1.9 - Create a local 'apt' repository for Ubuntu Java packages.
Copyright (c) Martin Wimpress, http://flexion.org. MIT License

By running this script to download Java you acknowledge that you have
read and accepted the terms of the Oracle end user license agreement.

* http://www.oracle.com/technetwork/java/javase/terms/license/

If you want to see what this is script is doing while it is running then execute
the following from another shell:

  tail -f /home/nfarring/oab-java6.sh.log

Downloading common.sh
 [x] Installing Java build requirements success
 [x] Making build directories success
 [x] Removing clones of https://github.com/rraptorr/sun-java6 success
 [x] Cloning https://github.com/rraptorr/sun-java6 success
 [x] Checking out  failed
 [i] Showing the last 5 lines from the logfile (/home/nfarring/oab-java6.sh.log)...
8596's retcode: 0
success
 [x] Checking out    fatal: You are on a branch yet to be born
8609's retcode: 128
failed

update-alternatives warning

I'm not clear what's happening so here's all the text bits.

Setting up sun-java6-bin (6.37-1oneiric1) ...
update-alternatives: using /usr/lib/jvm/java-6-sun/jre/bin/ControlPanel to provide /usr/bin/ControlPanel (ControlPanel) in auto mode.
update-alternatives: warning: alternative /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java (part of link group java) doesn't exist. Removing from list of alternatives.
update-alternatives: using /usr/lib/jvm/java-6-sun/jre/bin/java_vm to provide /usr/bin/java_vm (java_vm) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/jre/bin/javaws to provide /usr/bin/javaws (javaws) in auto mode.
update-alternatives: using /usr/lib/jvm/java-6-sun/jre/bin/jcontrol to provide /usr/bin/jcontrol (jcontrol) in auto mode.
update-alternatives: warning: alternative /usr/lib/jvm/java-7-openjdk-i386/jre/bin/keytool (part of link group keytool) doesn't exist. Removing from list of alternatives.
update-alternatives: warning: alternative /usr/lib/jvm/java-7-openjdk-i386/jre/bin/pack200 (part of link group pack200) doesn't exist. Removing from list of alternatives.
update-alternatives: warning: alternative /usr/lib/jvm/java-7-openjdk-i386/jre/bin/policytool (part of link group policytool) doesn't exist. Removing from list of alternatives.
update-alternatives: warning: alternative /usr/lib/jvm/java-7-openjdk-i386/jre/bin/rmid (part of link group rmid) doesn't exist. Removing from list of alternatives.
update-alternatives: warning: alternative /usr/lib/jvm/java-7-openjdk-i386/jre/bin/rmiregistry (part of link group rmiregistry) doesn't exist. Removing from list of alternatives.
update-alternatives: warning: alternative /usr/lib/jvm/java-7-openjdk-i386/jre/bin/unpack200 (part of link group unpack200) doesn't exist. Removing from list of alternatives.
update-alternatives: warning: alternative /usr/lib/jvm/java-7-openjdk-i386/jre/bin/orbd (part of link group orbd) doesn't exist. Removing from list of alternatives.
update-alternatives: warning: alternative /usr/lib/jvm/java-7-openjdk-i386/jre/bin/servertool (part of link group servertool) doesn't exist. Removing from list of alternatives.
update-alternatives: warning: alternative /usr/lib/jvm/java-7-openjdk-i386/jre/bin/tnameserv (part of link group tnameserv) doesn't exist. Removing from list of alternatives.
update-alternatives: warning: alternative /usr/lib/jvm/java-7-openjdk-i386/jre/lib/jexec (part of link group jexec) doesn't exist. Removing from list of alternatives.
Setting up sun-java6-jre (6.37-1
oneiric1) ...
Setting up sun-java6-plugin (6.37-1~oneiric1) ...
Processing triggers for menu ...

... previously...

[x] Installing Java build requirements success
[x] Making build directories success
[x] Removing clones of https://github.com/rraptorr/sun-java6 success
[x] Cloning https://github.com/rraptorr/sun-java6 success
[x] Checking out v6.37-1 success
[x] Getting Java SE download page success
[x] Getting current release download page success
[x] Downloading jdk-6u37-linux-i586.bin : 68.44 MB success
[x] Symlinking jdk-6u37-linux-i586.bin success
[x] Downloading jdk-6u37-linux-x64.bin : 68.71 MB success
[x] Symlinking jdk-6u37-linux-x64.bin success
[x] Getting Java Cryptography Extension download page success
[x] Downloading jce_policy-6.zip : 8.89 KB success
[x] Symlinking jce_policy-6.zip success
[x] Updating the changelog success
[x] Building the packages success
[x] Removing existing .deb packages success
[x] Moving the packages success
[x] Creating Packages.gz file success
[x] Creating Release file success
[x] Signing the 'Release' file success
[x] Exporting public key success
[x] Adding public key success
[x] Update package list success
All done!
me@hooray:/srcSafely$ sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-bin
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
gsfonts-x11
Suggested packages:
sun-java6-fonts ttf-baekmuk ttf-unfonts-core ttf-kochi-gothic
ttf-sazanami-gothic ttf-kochi-mincho ttf-sazanami-mincho ttf-arphic-uming
The following NEW packages will be installed:
gsfonts-x11 sun-java6-bin sun-java6-jre sun-java6-plugin
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 9,108 B/36.7 MB of archives.
After this operation, 104 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ oneiric/main gsfonts-x11 all 0.22 [9,108 B]
Fetched 9,108 B in 2s (3,741 B/s)
Selecting previously deselected package gsfonts-x11.
(Reading database ... 389068 files and directories currently installed.)
Unpacking gsfonts-x11 (from .../gsfonts-x11_0.22_all.deb) ...
Selecting previously deselected package sun-java6-jre.
Unpacking sun-java6-jre (from .../sun-java6-jre_6.37-1
oneiric1_all.deb) ...
Selecting previously deselected package sun-java6-bin.
Unpacking sun-java6-bin (from .../sun-java6-bin_6.37-1oneiric1_i386.deb) ...
Selecting previously deselected package sun-java6-plugin.
Unpacking sun-java6-plugin (from .../sun-java6-plugin_6.37-1
oneiric1_i386.deb) ...
Processing triggers for fontconfig ...
Processing triggers for shared-mime-info ...
Unknown media type in type 'all/all'
Unknown media type in type 'all/allfiles'
Unknown media type in type 'uri/mms'
Unknown media type in type 'uri/mmst'
Unknown media type in type 'uri/mmsu'
Unknown media type in type 'uri/pnm'
Unknown media type in type 'uri/rtspt'
Unknown media type in type 'uri/rtspu'
Unknown media type in type 'interface/x-winamp-skin'
Processing triggers for menu ...
Processing triggers for desktop-file-utils ...
Processing triggers for gnome-menus ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Setting up gsfonts-x11 (0.22) ...
Setting up sun-java6-bin (6.37-1~oneiric1) ...

Local repository for multiple servers

On our LAN there are several virtual servers that require Sun Java. Is it possible to use this technique to set up a local repository on a server which can be accessed by several servers on the LAN. This will avoid installing the local repository for every machine and save a lot of time and bandwidth as well.

error checking jars with same content -- looking for user input

I am using the 0.2.5 script from here on an Ubuntu 10.04 (2.6.32-38 x86_64) machine to build the java6 package and I'm running into an error while building:

[x] Installing Java build requirements success
[x] Making build directories success
[x] Removing clones of https://github.com/rraptorr/sun-java6 success
[x] Cloning https://github.com/rraptorr/sun-java6 success
[x] Checking out v6.34-1 success
[x] Getting Java SE download page success
[x] Getting current release download page success
[x] Downloading jdk-6u34-linux-i586.bin : 68.43 MB success
[x] Symlinking jdk-6u34-linux-i586.bin success
[x] Downloading jdk-6u34-linux-x64.bin : 68.7 MB success
[x] Symlinking jdk-6u34-linux-x64.bin success
[x] Getting Java Cryptography Extension download page success
[x] Downloading jce_policy-6.zip : 8.89 KB success
[x] Symlinking jce_policy-6.zip success
[x] Updating the changelog success
[x] Building the packages success

ERROR! Packages failed to build.

The last few lines of the log file are:

: # check for jars with the same content
set -e; \
    for j in jre/lib/ext/dnsns.jar jre/lib/ext/localedata.jar jre/lib/im/indicim.jar jre/lib/im/thaiim.jar jre/lib/charsets.jar jre/lib/management-agent.jar jre/lib/plugin.jar jre/lib/resources.jar jre/lib/javaws.jar jre/lib/deploy.jar jre/lib/alt-rt.jar jre/lib/alt-string.jar ; do \
      echo "  Comparing $j ..."; \
      d=${j%*.jar}; \
      set -- i586 x64; a1=$1; shift; \
      mkdir -p tmp-$a1/$d; \
      unzip -q -d tmp-$a1/$d $a1-jdk/$j; \
      for a2; do \
        mkdir -p tmp-$a2/$d; \
        unzip -q -d tmp-$a2/$d $a2-jdk/$j; \
        if diff -ur tmp-$a1/$d tmp-$a2/$d; then \
          echo "    OK"; \
        else \
          echo "    differ"; \
          badjars="$badjars $j ($a1, $a2)"; \
        fi; \
      done; \
    done; \
    if [ -n "$badjars" ]; then \
      echo "Differing jar files: $badjars"; \
      exit 1; \
    fi
  Comparing jre/lib/ext/dnsns.jar ...
replace tmp-i586/jre/lib/ext/dnsns/META-INF/MANIFEST.MF? [y]es, [n]o, [A]ll, [N]one, [r]ename:  NULL
(EOF or read error, treating as "[N]one" ...)
make: *** [unpack-stamp] Error 1
dpkg-buildpackage: error: debian/rules binary gave error exit status 2 29834's retcode: 2
success

This was working for me a few days ago on a different machine. Is there something in my environment setup that is causing it to ask about replacing this file during the dpkg-buildpackage (version 1.15.5.6ubuntu2) execution? I'm happy to help debug/write patches/submit pull requests to get this fixed if someone that knows more can point me in the right direction.

Moving the packages failed on 64bit system

I'm on Ubuntu 11.10 64bit.

Build information

TOP = usr/lib/jvm
VENDOR = sun
RELEASE = 6
PRODUCT = java6
basename = sun-java6
version = 6
releng_ver = 30
unpackdir = jdk1.6.0_30
srcdir = x64-jdk
all_archs = i586 x64
arch = x64
archdir = amd64
bin_pattern = jdk-6u30-linux-%.bin

rm -rf jdk1.6.0_30
binsize=$(wc -c jdk-6u30-linux-i586.bin | awk '{print $1}');
zipstart=$(unzip -ql jdk-6u30-linux-i586.bin 2>&1 >/dev/null | sed -n -e 's/.* ([0-9][0-9]) extra bytes./\1/p');
tail -c $(expr $binsize - $zipstart) jdk-6u30-linux-i586.bin > tmp-jdk.zip
unzip -q tmp-jdk.zip
mv jdk1.6.0_30 i586-jdk
i586
diff -u i586-jdk/LICENSE i586-jdk/jre/LICENSE
diff -u i586-jdk/THIRDPARTYLICENSEREADME.txt
i586-jdk/jre/THIRDPARTYLICENSEREADME.txt
set -e;
for i in $(find i586-jdk -name '.pack'); do
i586-jdk/bin/unpack200 $i
$(dirname $i)/$(basename $i .pack).jar;
rm -f $i;
done
/bin/bash: line 2: i586-jdk/bin/unpack200: No such file or directory
make: *
* [unpack-i586-stamp] Fehler 1
dpkg-buildpackage: Fehler: Fehler-Exitstatus von debian/rules build war 2
^H^H9285's retcode: 2
success
[x] Moving the packages mv: Aufruf von stat für „/var/local/oab/sun-java6_6.30-4oneiric1_amd64.changes“ nicht möglich: Datei oder Verzeichnis nicht gefunden
mv: Aufruf von stat für „/var/local/oab/_sun-java6-__6.30-4
oneiric1_*.deb“ nicht möglich: Datei oder Verzeichnis nicht gefunden
^H^H9614's retcode: 1
failed

line 363 should use [[ ]] rather than [ ]

Hi,

I think word splitting in line 363 causes this error:

[: too many arguments

I'm running VMware to the result of "imvirt" is "VMware ESX Server".

Because of the issue with line 363, the oab-java6.sh script skips the entire routine that creates GPG keys and signs the repository? Replacing [ ] with [[ ]] fixes the problem as [[ ]] disables word splitting:

if [[ imvirt != "OpenVZ" ]]; then

Autogenerated GPG key export failed if hostname was changed later

This line just checked for gpg database files exists not for valid keys inside:
if [ -n "${BUILD_KEY}" ] || [ -e ${WORK_PATH}/gpg/pubring.gpg ] && [ -e ${WORK_PATH}/gpg/secring.gpg ] && [ -e ${WORK_PATH}/gpg/trustdb.gpg ]; then

But next command try to export keys related to hostname:
gpg --homedir ${WORK_PATH}/gpg --export -a "hostname --fqdn" > ${WORK_PATH}/deb/pubkey.asc

So no key exported if hostname was changed after initial keys generation

failure to compile repo

rm -f debian/shlibs.local
rm -f debian/sun-java6-bin.substvars
dh_shlibdeps
-lusr/lib/jvm/java-6-sun-1.6.0.37/jre/lib/amd64/server
-Xlibjavaplugin_oji.so -Xlibnpjp2.so
-- --warnings=0
dpkg-shlibdeps: warning: Can't extract name and version from library name libjvm.so' dpkg-shlibdeps: warning: Can't extract name and version from library namelibjvm.so'
dpkg-shlibdeps: warning: Can't extract name and version from library name libjava.so' dpkg-shlibdeps: warning: Can't extract name and version from library namelibjava.so'
dpkg-shlibdeps: warning: Can't extract name and version from library name libjvm.so' dpkg-shlibdeps: warning: Can't extract name and version from library namelibjvm.so'
dpkg-shlibdeps: warning: Can't extract name and version from library name libjava.so' dpkg-shlibdeps: warning: Can't extract name and version from library namelibjava.so'
dpkg-shlibdeps: warning: Can't extract name and version from library name libjvm.so' dpkg-shlibdeps: warning: Can't extract name and version from library namelibjvm.so'
dpkg-shlibdeps: warning: Can't extract name and version from library name libjli.so' dpkg-shlibdeps: warning: Can't extract name and version from library namelibjli.so'
dpkg-shlibdeps: warning: Can't extract name and version from library name libjvm.so' dpkg-shlibdeps: warning: Can't extract name and version from library namelibjvm.so'
dpkg-shlibdeps: warning: Can't extract name and version from library name libjava.so' dpkg-shlibdeps: warning: Can't extract name and version from library namelibjava.so'
dpkg-shlibdeps: warning: Can't extract name and version from library name libjvm.so' dpkg-shlibdeps: warning: Can't extract name and version from library namelibjvm.so'
dpkg-shlibdeps: warning: Can't extract name and version from library name libawt.so' dpkg-shlibdeps: warning: Can't extract name and version from library namelibawt.so'
dpkg-shlibdeps: warning: Can't extract name and version from library name libjava.so' dpkg-shlibdeps: warning: Can't extract name and version from library namelibjava.so'
dpkg-shlibdeps: warning: Can't extract name and version from library name libjvm.so' dpkg-shlibdeps: warning: Can't extract name and version from library namelibjvm.so'
dpkg-shlibdeps: warning: Can't extract name and version from library name libjava.so' dpkg-shlibdeps: warning: Can't extract name and version from library namelibjava.so

Doesn't Work

ryannathans@GingerbreadKitchen:~$ sudo ./oab-java6.sh -k jre
oab-java6.sh v0.1.2 - Install Java 6u30 from locally built packages.
Copyright (c) 2012 Flexion.Org, http://flexion.org. MIT License

By running this script to download and/or install Java you acknowledge that
you have read and accepted the terms of the Oracle end user license agreement.

If you want to see what this is script is doing while it is running then execute
the following from another shell:

tail -f /home/ryannathans/oab-java6.sh.log

./oab-java6.sh: line 189: check_root: command not found
./oab-java6.sh: line 190: check_sudo: command not found
./oab-java6.sh: line 191: check_ubuntu: command not found
./oab-java6.sh: line 192: lsb: command not found
Here we go...
./oab-java6.sh: line 233: ncecho: command not found
./oab-java6.sh: line 234: : No such file or directory
./oab-java6.sh: line 235: progress: command not found
./oab-java6.sh: line 238: ncecho: command not found
./oab-java6.sh: line 239: : No such file or directory
./oab-java6.sh: line 240: progress: command not found
./oab-java6.sh: line 244: ncecho: command not found
./oab-java6.sh: line 245: : No such file or directory
./oab-java6.sh: line 246: progress: command not found
./oab-java6.sh: line 249: ncecho: command not found
./oab-java6.sh: line 251: progress: command not found
./oab-java6.sh: line 254: ncecho: command not found
./oab-java6.sh: line 255: : No such file or directory
./oab-java6.sh: line 256: : No such file or directory
./oab-java6.sh: line 257: progress: command not found
./oab-java6.sh: line 263: ncecho: command not found
./oab-java6.sh: line 264: : No such file or directory
./oab-java6.sh: line 265: progress_loop: command not found
./oab-java6.sh: line 267: ncecho: command not found
./oab-java6.sh: line 268: : No such file or directory
./oab-java6.sh: line 269: progress_loop: command not found
./oab-java6.sh: line 263: ncecho: command not found
./oab-java6.sh: line 264: : No such file or directory
./oab-java6.sh: line 265: progress_loop: command not found
./oab-java6.sh: line 267: ncecho: command not found
./oab-java6.sh: line 268: : No such file or directory
./oab-java6.sh: line 269: progress_loop: command not found
./oab-java6.sh: line 273: cd: /var/local/oab/sun-java6-6.30/: No such file or directory
head: cannot open `debian/changelog' for reading: No such file or directory
./oab-java6.sh: line 283: ncecho: command not found
./oab-java6.sh: line 284: : No such file or directory
./oab-java6.sh: line 285: progress: command not found
./oab-java6.sh: line 288: ncecho: command not found
./oab-java6.sh: line 289: : No such file or directory
./oab-java6.sh: line 290: progress_can_fail: command not found
./oab-java6.sh: line 293: ncecho: command not found
./oab-java6.sh: line 294: : No such file or directory
./oab-java6.sh: line 296: progress: command not found
./oab-java6.sh: line 295: : No such file or directory
./oab-java6.sh: line 310: ncecho: command not found
./oab-java6.sh: line 311: : No such file or directory
./oab-java6.sh: line 312: : No such file or directory
./oab-java6.sh: line 313: progress: command not found
./oab-java6.sh: line 319: ncecho: command not found
./oab-java6.sh: line 320: : No such file or directory
./oab-java6.sh: line 321: : No such file or directory
./oab-java6.sh: line 322: progress: command not found
All done!

provide script for manual downloads?

Since Oracle just moved the download page (and probably will in the future), would you consider providing a script that expects the user to download the two (or four) bin files and the jce files manually and then does all the magic with those files?

That way Oracle can't say that you're going around the license agreement.

Build Packages Fails - Java 6

I tried to execute the script...and the packages failed to build.

Not sure whats going on, because it worked this morning.

 [x] Installing Java build requirementssuccess
 [x] Making build directoriessuccess
 [x] Removing clones of https://github.com/rraptorr/sun-java6success
 [x] Cloning https://github.com/rraptorr/sun-java6success
 [x] Checking out v6.33-1success
 [x] Getting Java SE download pagesuccess
 [x] Getting current release download pagesuccess
 [x] Downloading jdk-6u33-linux-i586.bin : 68.42 MBsuccess
 [x] Symlinking jdk-6u33-linux-i586.binsuccess
 [x] Downloading jdk-6u33-linux-x64.bin : 68.69 MBsuccess
 [x] Symlinking jdk-6u33-linux-x64.binsuccess
 [x] Getting Java Cryptography Extension download pagesuccess
 [x] Downloading jce_policy-6.zip : 8.89 KBsuccess
 [x] Symlinking jce_policy-6.zipsuccess
 [x] Updating the changelogsuccess
 [x] Building the packagessuccess
ERROR! Packages failed to build.

I checked the log and this was the last entry

make: *** [unpack-stamp] Error 1
dpkg-buildpackage: error: debian/rules build gave error exit status 2
��9656's retcode: 2
success

Error downloading jce_policy-6.zip

Trying to run the script as sudo ./oab-java.sh

Everything works until it tries to download the jce policy where it seems to fail to get a valid hostname:

[x] Downloading jce_policy-6.zip : 8.89 KB --2012-06-26 16:16:26-- http://java%20cryptography%20extension%20(jce)%20unlimited%20strength%20jurisdiction%20policy%20files%206jce_policy-6.zip/ Resolving java cryptography extension (jce) unlimited strength jurisdiction policy files 6jce_policy-6.zip (java cryptography extension (jce) unlimited strength jurisdiction policy files 6jce_policy-6.zip)... failed: Name or service not known. wget: unable to resolve host addressjava cryptography extension (jce) unlimited strength jurisdiction policy files 6jce_policy-6.zip'
31219's retcode: 4
`

git clone vs wget

Another github publisher, pylanglois, offers a tweak to your instructions. For your consideration:

hxxp://gaggl.com/2012/04/installing-java6-jdk-on-ubuntu-12-04/comment-page-1/#comment-1469

sudo apt-get purge sun-java
mkdir ~/src_SunJava6
cd ~/src_SunJava6
git clone https://github.com/flexiondotorg/oab-java6.git
cd ~/src_SunJava6/oab-java6
sudo ./oab-java.sh -c

sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-bin sun-java6-jdk

I have slightly changed the target directory for scrape sanity and defaulted to -c. It is not clear the advantage of installing also " sun-java6-bin sun-java6-jdk" unless one needed the jdk, too?

Can -7 and -c be combined?

Can not lines 2-5 be consolidated (without &&) specifying target directory with git command? [git help clone]. This seems to play nicely:

sudo apt-get purge sun-java
git clone https://github.com/flexiondotorg/oab-java6.git ~/src_SunJava6
sudo ~/src_SunJava6/oab-java.sh -c

No oab-java6 directory will be created as location is specified to git.

Old packages are not cleaned

Looking in /var/local/oab/pkg, it contains:
jdk-6u30-linux-i586.bin jdk-6u30-linux-x64.bin jdk-6u31-linux-i586.bin jdk-6u31-linux-x64.bin
after running the script. Furthermore the /var/local/oab/deb also contains multiple versions.
Shouldn't there be some cleaning built into the script when new versions emerge, or some way to trigger cleaning?

fails to create java7 local repository

Hi,

First of all; thanks for a great way to install java6 on Ubuntu. It works like a charm.

I've tried to install java7, but somehow it fails on my machine. Here's the command line output:

tail -f /tmp/oab/oab-java.sh.log

[x] Installing Java build requirements success
[x] Making build directories success
[x] Removing clones of http://github.com/rraptorr/oracle-java7 success
[x] Cloning http://github.com/rraptorr/oracle-java7 success
[x] Checking out v7.5-1 success
[x] Getting Java SE download page success
[x] Getting previous releases download page success
[x] Downloading jdk-7u5-linux-i586.tar.gz : failed
[i] Showing the last 5 lines from the logfile (/tmp/oab/oab-java.sh.log)...
3091's retcode: 0
success
[x] Downloading jdk-7u5-linux-i586.tar.gz : http://: Invalid host name.
3108's retcode: 1
failed

Any idea what the cause might be?

Package signing fails if the host doesn't have an entry in /etc/hosts

But first of all, thanks for a great script!

Now back to the issue at hand: the package signing fails if the host doesn't have an entry in /etc/hosts. Or more specifically, oab-java.sh uses hostname --fqdn, but this doesn't return anything if the host's name (as set in /etc/hostname and returned by a simple hostname) isn't available.

 [x] Create GnuPG configuration hostname: Name or service not known                  
hostname: Name or service not known                          
success
 [x] Start generating entropy success
 [x] Creating signing key failed
 [i] Showing the last 5 lines from the logfile (/tmp/j/oab-java6/oab-java.sh.log)...
 [x] Creating signing key   gpg: keyring `/var/local/oab/gpg/secring.gpg' created
gpg: keyring `/var/local/oab/gpg/pubring.gpg' created
gpg: /var/local/oab/gpg-key.conf:5: missing argument
30511's retcode: 2
failed

I suggest enhancing the script to falling back to simple hostname output in case the hostname --fqdn fails.

Workaround for others that might experience this: simply do:

# echo 127.0.1.1 $HOSTNAME >> /etc/hosts

then remove the directory oab-java.sh created (/var/local/oab) and re-run the script.

Cheers,

-Torstein

Error checking certificate for edelivery.oracle.com

Attempted to install on an alestic Ubuntu 11.10 EC2 box. Here's the log:

Downloading common.sh
[x] Installing Java build requirements success
[x] Making build directories success
[x] Removing clones of https://github.com/rraptorr/sun-java6 success
[x] Cloning https://github.com/rraptorr/sun-java6 success
[x] Checking out v6.31-2 success
[x] Getting Java SE download pagesuccess
[x] Getting current release download page success
[x] Downloading jdk-6u31-linux-i586.bin : 81.34 MB failed
[i] Showing the last 5 lines from the logfile (/mnt/oab-java6.sh.log)...
ERROR: cannot verify edelivery.oracle.com's certificate, issued by /C=US/O=Akamai Technologies Inc/CN=Akamai Subordinate CA 3': Unable to locally verify the issuer's authority. To connect to edelivery.oracle.com insecurely, use--no-check-certificate'.
885's retcode: 5

This patch seems to work:

diff --git a/oab-java6.sh b/oab-java6.sh
index deefa55..bd8fb56 100755
--- a/oab-java6.sh
+++ b/oab-java6.sh
@@ -297,7 +297,7 @@ do
     COOKIES="oraclelicensejdk-${JAVA_VER}u${JAVA_UPD}-oth-JPR=accept-securebackup-cookie;gpw_e24=http://edelivery.oracle.com"

     ncecho " [x] Downloading ${JAVA_BIN} : ${DOWNLOAD_SIZE} "
-    wget --header="Cookie: ${COOKIES}" -c "${DOWNLOAD_URL}" -O /var/local/oab/pkg/${JAVA_BIN} >> "$log" 2>&1 &
+    wget --no-check-certificate --header="Cookie: ${COOKIES}" -c "${DOWNLOAD_URL}" -O /var/local/oab/pkg/${JAVA_BIN} >> "$log" 2>&1 &
     pid=$!;progress_loop $pid

     ncecho " [x] Symlinking ${JAVA_BIN} "

builds broken packages in Precise alpha1

Your script worked great in Maverick, but it is failing on Precise.

Selecting previously unselected package sun-java6-jre. (Reading database ... 404727 files and directories currently installed.) Unpacking sun-java6-jre (from .../sun-java6-jre_6.30-3~precise1_all.deb) ... Selecting previously unselected package sun-java6-bin. Unpacking sun-java6-bin (from .../sun-java6-bin_6.30-3~precise1_amd64.deb) ... Selecting previously unselected package sun-java6-plugin. Unpacking sun-java6-plugin (from .../sun-java6-plugin_6.30-3~precise1_amd64.deb) ... Processing triggers for shared-mime-info ... Unknown media type in type 'all/all' Unknown media type in type 'all/allfiles' Unknown media type in type 'uri/mms' Unknown media type in type 'uri/mmst' Unknown media type in type 'uri/mmsu' Unknown media type in type 'uri/pnm' Unknown media type in type 'uri/rtspt' Unknown media type in type 'uri/rtspu' Setting up sun-java6-bin (6.30-3~precise1) ... update-alternatives: error: alternative path /usr/lib/jvm/java-6-sun/jre/bin/ControlPanel doesn't exist. dpkg: error processing sun-java6-bin (--configure): subprocess installed post-installation script returned error exit status 2 dpkg: dependency problems prevent configuration of sun-java6-jre: sun-java6-jre depends on sun-java6-bin (>= 6.30-3~precise1) | ia32-sun-java6-bin (>= 6.30-3~precise1); however: Package sun-java6-bin is not configured yet. Package ia32-sun-java6-bin is not installed. dpkg: error processing sun-java6-jre (--configure): dependency problems - leaving unconfigured No apport report written because the error message indicates its a followup error from a previous failure. dpkg: dependency problems prevent configuration of sun-java6-plugin: sun-java6-plugin depends on sun-java6-bin (>= 6.30-3~precise1); however: Package sun-java6-bin is not configured yet. dpkg: error processing sun-java6-plugin (--configure): dependency problems - leaving unconfigured No apport report written because the error message indicates its a followup error from a previous failure. Errors were encountered while processing: sun-java6-bin sun-java6-jre sun-java6-plugin E: Sub-process /usr/bin/dpkg returned an error code (1)

New upstream release

A new Java6 has been released, this script needs updating in order to support it.

Sent via Hubroid

Downloading error

Downloading jdk-7u6-linux-i586.tar.gz : http://: Invalid host name.
Downloading jdk-6u34-linux-i586.bin : http://: Invalid host name.

current download page has moved

I tried to run this script and it failed in this manner:

 [x] Making build directories success
 [x] Removing clones of https://github.com/rraptorr/sun-java6 success
 [x] Cloning https://github.com/rraptorr/sun-java6 success
 [x] Checking out v6.33-1 success
 [x] Getting Java SE download pagesuccess
 [x] Getting previous releases download page success
 [x] Downloading jdk-6u33-linux-i586.bin :  failed
 [i] Showing the last 5 lines from the logfile (/home/danhul01/oab-java6.sh.log)...
12395's retcode: 0
success
 [x] Downloading jdk-6u33-linux-i586.bin :    http://: Invalid host name.
12414's retcode: 1
failed

Debugging a little, I saw that in /tmp/oab-index.html, there wasn't a link of the form jdk-6u33-downloads-\d+, which is what the script searches for on line 278. In the current index page, the correct link has the form jdk6-downloads-\d+. That's incredibly useless, I know, because it's not specific to the update number, so it doesn't tell you whether to use the 'current' or 'previous' releases pages. A real change to fix this will probably involve downloading and grepping both the current and previous pages to find the package URL, but I hacked it to work for me by replacing line 278 with

DOWNLOAD_INDEX=`grep -P -o "/technetwork/java/javase/downloads/jdk${JAVA_VER}-downloads-\d+\.html" /tmp/oab-index.html | uniq`

jdk-6u31-linux-i586.bin: invalid number of bytes

The repository building process fails with this message:
Downloading common.sh
[x] Installing Java build requirements success
[x] Making build directories success
[x] Removing clones of https://github.com/rraptorr/sun-java6 success
[x] Cloning https://github.com/rraptorr/sun-java6 success
[x] Checking out v6.31-1 success
[x] Getting Java SE download pagesuccess
[x] Getting current release download page success
[x] Downloading jdk-6u31-linux-i586.bin : 81.34 MB success
[x] Symlinking jdk-6u31-linux-i586.bin success
[x] Downloading jdk-6u31-linux-x64.bin : 81.62 MB success
[x] Symlinking jdk-6u31-linux-x64.bin success
[x] Updating the changelog success
[x] Building the packages success
ERROR! Packages failed to build. Please raise an issue with the upstream script developer - https://github.com/rraptorr/sun-java6/issues

The last lines of the log are:

rm -rf jdk1.6.0_31
binsize=$(wc -c jdk-6u31-linux-i586.bin | awk '{print $1}');
zipstart=$(unzip -ql jdk-6u31-linux-i586.bin 2>&1 >/dev/null | sed -n -e 's/.* ([0-9][0-9]) extra bytes./\1/p');
tail -c $(expr $binsize - $zipstart) jdk-6u31-linux-i586.bin > tmp-jdk.zip
expr: syntax error
tail: jdk-6u31-linux-i586.bin: invalid number of bytes
make: *** [unpack-i586-stamp] Error 1
dpkg-buildpackage: fallo: debian/rules build devolvió un estado de salida de error 2
30810's retcode: 2
success

Script can't find jdk-6u32-linux-i586.bin download file

I am running the script on Ubuntu 12.04 LTS, though I suspect it would happen on any other version.

A failure occurs when attempting to retrieve the download for jdk-6u32-linux-i586.bin:

$ ./oab-java.sh 
oab-java.sh v0.2.3 - Create a local 'apt' repository for Sun Java 6 and/or Oracle Java 7 packages.

Copyright (c) Martin Wimpress, http://flexion.org. MIT License

By running this script to download Java you acknowledge that you have
read and accepted the terms of the Oracle end user license agreement.

* http://www.oracle.com/technetwork/java/javase/terms/license/

If you want to see what this is script is doing while it is running then execute
the following from another shell:

  tail -f /usr/local/src/oab-java6/oab-java.sh.log

 [x] Installing Java build requirements success
 [x] Making build directories success
 [x] Removing clones of http://github.com/rraptorr/sun-java6 success
 [x] Cloning http://github.com/rraptorr/sun-java6 success
 [x] Checking out v6.32-2 success
 [x] Getting Java SE download page success
 [x] Getting previous releases download page success
 [x] Downloading jdk-6u32-linux-i586.bin :  failed
 [i] Showing the last 5 lines from the logfile (/usr/local/src/oab-java6/oab-java.sh.log)...
16958's retcode: 0
success
 [x] Downloading jdk-6u32-linux-i586.bin :    http://: Invalid host name.
16976's retcode: 1
failed

This is because http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html no longer has any mention of jdk-6u32-linux-i586.bin for some reason.

I'm not sure what the appropriate resolution would be. Any thoughts?

Non-privileged mode

How difficult would it be to add a non-privileged mode that doesn't require to be run as root?

I would love to build this using our continuous integration system which obviously runs as a normal user. Another reason is that I don't feel comfortable running scripts as root that interact with websites.

I see two possible methods: simply omit the commands that require root privileges or hardcode the sudo into them. With the latter method, I could then give sudo access to these specific commands to my continuous integration user via /etc/sudoers.

ERROR! Packages failed to build.

I get the following errormessage after applying the fix to adjust to Oracles website changes for 6u35:

rm -rf jdk1.6.0_35
binsize=$(wc -c jdk-6u35-linux-i586.bin | awk '{print $1}'); \
        zipstart=$(unzip -ql jdk-6u35-linux-i586.bin 2>&1 >/dev/null | sed -n -e 's/.* \([0-9][0-9]*\) extra bytes.*/\1/p'); \
        tail -c $(expr $binsize - $zipstart) jdk-6u35-linux-i586.bin > tmp-jdk.zip
expr: syntax error
tail: jdk-6u35-linux-i586.bin: invalid number of bytes
make: *** [unpack-i586-stamp] Fehler 1
dpkg-buildpackage: Fehler: debian/rules build gab Fehler-Exitstatus 2
^H^H23419's retcode: 2
success

Any ideas what's going wrong and how I can fix it? It used to work on this machine ...

Running without root (e.g. in Jenkins)

It would be nice to have a command line option to skip the things that need root and just build the packages.

The following allows this, and happens to be suitable for a build step in Jenkins:

mkdir -p $WORKSPACE/tmp
perl -pe 's!^(\s*)(check_root|check_sudo|apt-get)\b!${1}true!g;
          s!^WORK_PATH=.*!WORK_PATH=\$WORKSPACE/oab!g;
          s!^(\s*)spinny\b!${1}true!g;
          s! /tmp! \$WORKSPACE/tmp!g;
         ' < oab-java.sh > oab-java-ci.sh
rm -f oab-java-ci.sh.log
bash ./oab-java-ci.sh -k none

You can tell Jenkins to archive artifacts: oab/deb/*.deb

Consider using tagged version

Hi,
please consider using tagged version of my Java packaging script:

  • that way you can have repeatable builds (master branch changes, so the builds created at different times can be slightly different)
  • from time to time I can break something in master, using tagged version will make your script work regardless of any breakage in master

You can either hardcode the tag you want to use (like v6.30-2) or use something like this to detect newest version:

TAG=`git tag -l 'v6.30-*'|tail -n1`
git checkout $TAG

Add support for JCE Unlimited Strength Jurisdiction Policy Files

I've just merge a pull request for JCE Unlimited Strength Jurisdiction Policy Files into sun-java6. This removes all restrictions from Java Cryptography Extension and requires additional file to be downloaded.
Please update your script to download this file as next tagged release of sun-java6 will require it.

Defoma is deprecated

Defoma package is not anymore available on debian testing or sid, it's being replaced in all distros for the not-so-debian-specific fontconfig package.
Probably replacing defoma by fontconfig should do it, but, why is defoma a build-dep?

Numerous "command not found" when common.sh already exists

If, for whatever reason, the file /tmp/common.sh already exists, the oab-java6.sh script fails, outputting numerous "command not found" and "No such file or directory" messages. The oab-java6.sh.log is not created.

Removing common.sh from /tmp fixes the issue.

I don't know why I already had that file, if the download failed or another application created it. I am on Ubuntu 10.04.


./oab-java6.sh: line 177: update_thyself: command not found
./oab-java6.sh: line 192: check_root: command not found
./oab-java6.sh: line 193: check_sudo: command not found
./oab-java6.sh: line 194: check_ubuntu: command not found
./oab-java6.sh: line 230: ncecho: command not found
./oab-java6.sh: line 232: progress: command not found
./oab-java6.sh: line 231: : No such file or directory
./oab-java6.sh: line 235: ncecho: command not found
./oab-java6.sh: line 237: progress: command not found
./oab-java6.sh: line 236: : No such file or directory
./oab-java6.sh: line 244: ncecho: command not found
./oab-java6.sh: line 247: progress: command not found
./oab-java6.sh: line 250: ncecho: command not found
./oab-java6.sh: line 251: : No such file or directory
./oab-java6.sh: line 253: progress: command not found
./oab-java6.sh: line 256: : No such file or directory
./oab-java6.sh: line 252: : No such file or directory
fatal: Not a git repository (or any of the parent directories): .git
./oab-java6.sh: line 260: ncecho: command not found
./oab-java6.sh: line 262: progress: command not found
./oab-java6.sh: line 261: : No such file or directory
head: cannot open `/var/local/oab/src/debian/changelog' for reading: No such file or directory
head: cannot open `/var/local/oab/src/debian/changelog' for reading: No such file or directory
./oab-java6.sh: line 273: ncecho: command not found
./oab-java6.sh: line 275: progress: command not found
./oab-java6.sh: line 274: : No such file or directory
grep: /tmp/oab-index.html: No such file or directory
./oab-java6.sh: line 285: ncecho: command not found
./oab-java6.sh: line 287: progress: command not found
./oab-java6.sh: line 286: : No such file or directory
grep: /tmp/oab-download.html: No such file or directory
grep: /tmp/oab-download.html: No such file or directory
./oab-java6.sh: line 299: ncecho: command not found
./oab-java6.sh: line 301: progress_loop: command not found
./oab-java6.sh: line 300: : No such file or directory
./oab-java6.sh: line 303: ncecho: command not found
./oab-java6.sh: line 305: progress_loop: command not found
./oab-java6.sh: line 304: : No such file or directory
grep: /tmp/oab-download.html: No such file or directory
grep: /tmp/oab-download.html: No such file or directory
./oab-java6.sh: line 299: ncecho: command not found
./oab-java6.sh: line 301: progress_loop: command not found
./oab-java6.sh: line 300: : No such file or directory
./oab-java6.sh: line 303: ncecho: command not found
./oab-java6.sh: line 305: progress_loop: command not found
./oab-java6.sh: line 321: cd: /var/local/oab/src: No such file or directory
./oab-java6.sh: line 304: : No such file or directory
./oab-java6.sh: line 324: ncecho: command not found
./oab-java6.sh: line 326: progress: command not found
./oab-java6.sh: line 325: : No such file or directory
./oab-java6.sh: line 329: ncecho: command not found
./oab-java6.sh: line 331: progress_can_fail: command not found
./oab-java6.sh: line 330: : No such file or directory
./oab-java6.sh: line 347: error_msg: command not found
dpkg-deb: failed to read archive `/var/local/oab/deb/*.deb': No such file or directory
dpkg-deb: failed to read archive `/var/local/oab/deb/*.deb': No such file or directory
./oab-java6.sh: line 361: /var/local/oab/deb/override: No such file or directory
./oab-java6.sh: line 364: ncecho: command not found
./oab-java6.sh: line 365: cd: /var/local/oab/deb: No such file or directory
./oab-java6.sh: line 369: cecho: command not found
./oab-java6.sh: line 372: ncecho: command not found
./oab-java6.sh: line 373: cd: /var/local/oab/deb: No such file or directory
./oab-java6.sh: line 388: cecho: command not found
./oab-java6.sh: line 392: imvirt: command not found
./oab-java6.sh: line 396: ncecho: command not found
./oab-java6.sh: line 397: /var/local/oab/gpg-key.conf: No such file or directory
./oab-java6.sh: line 398: /var/local/oab/gpg-key.conf: No such file or directory
./oab-java6.sh: line 399: /var/local/oab/gpg-key.conf: No such file or directory
./oab-java6.sh: line 400: /var/local/oab/gpg-key.conf: No such file or directory
./oab-java6.sh: line 401: /var/local/oab/gpg-key.conf: No such file or directory
./oab-java6.sh: line 402: /var/local/oab/gpg-key.conf: No such file or directory
./oab-java6.sh: line 403: /var/local/oab/gpg-key.conf: No such file or directory
./oab-java6.sh: line 404: cecho: command not found
./oab-java6.sh: line 407: : No such file or directory
./oab-java6.sh: line 409: ncecho: command not found
./oab-java6.sh: line 411: progress: command not found
./oab-java6.sh: line 410: : No such file or directory
./oab-java6.sh: line 413: ncecho: command not found
./oab-java6.sh: line 415: progress: command not found
./oab-java6.sh: line 414: : No such file or directory
./oab-java6.sh: line 417: ncecho: command not found
./oab-java6.sh: line 419: progress: command not found
cat: /tmp/rngd.pid: No such file or directory
./oab-java6.sh: line 418: : No such file or directory
./oab-java6.sh: line 423: : No such file or directory
./oab-java6.sh: line 449: apt_update: command not found
All done!

invalid hostname jdk-6u33-linux-i586.bin

tail -f /home/NEF/Downloads/oab-java6.sh.log

[x] Installing Java build requirementssuccess
[x] Making build directoriessuccess
[x] Removing clones of http://github.com/rraptorr/sun-java6success
[x] Cloning http://github.com/rraptorr/sun-java6success
[x] Checking out v6.33-2success
[x] Getting Java SE download pagesuccess
[x] Getting current release download pagesuccess
[x] Getting previous releases download pagesuccess
[x] Downloading jdk-6u33-linux-i586.bin : failed
[i] Showing the last 5 lines from the logfile (/home/NEF/Downloads/oab-java6.sh.log)...
10395's retcode: 0
success
[x] Downloading jdk-6u33-linux-i586.bin : http://: Invalid host name.
10412's retcode: 1
failed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.