7 # version of this package
10 working_dir="$( pwd )"
11 program_name="$( basename "$0" )"
12 program_dir="$( cd "$( dirname "$( type -p "$0" )" )" ; pwd )"
14 lib_dir="/usr/share/java-package"
15 [ "$J2SE_PACKAGE_LIBDIR" ] && lib_dir="$J2SE_PACKAGE_LIBDIR"
17 # If a default has been set for either of the
18 # environment variables, use it; otherwise,
19 # default to the name and email used by the
20 # Debian Java Maintainers project.
21 if [ -z "$J2SE_PACKAGE_FULL_NAME" ]; then
22 maintainer_name="Debian Java Maintainers"
24 maintainer_name="$J2SE_PACKAGE_FULL_NAME"
27 if [ -z "$J2SE_PACKAGE_EMAIL" ]; then
28 maintainer_email="pkg-java-maintainers@lists.alioth.debian.org"
30 maintainer_email="$J2SE_PACKAGE_EMAIL"
36 ### check for run in fakeroot
38 # are we running as fakeroot
39 if ! dh_testroot >/dev/null 2>&1; then
40 if [ -n "$FAKEROOTKEY" ]; then
41 echo "Internal error, fakeroot seems to fail faking root" >&2
44 exec fakeroot "$0" "$@"
47 # check whether I'm real root, and bail out if so... ugly, but needed
48 if touch /lib/.test 2>/dev/null; then
50 echo "You are real root -- unfortunately, some Java distributions have" >&2
51 echo "install scripts that directly manipulate /etc, and may cause some" >&2
52 echo "inconsistencies on your system. Instead, you should become a" >&2
53 echo "non-root user and run:" >&2
55 echo "fakeroot make-jpkg $@" >&2
57 echo "which will allow no damage to be done to your system files and" >&2
58 echo "still permit the Java distribution to successfully extract." >&2
69 Usage: $program_name [OPTION]... FILE
71 $program_name builds a Debian package from the given Java binary distribution FILE
73 Supported java binary distributions currently include:
74 * Oracle (http://www.oracle.com/technetwork/java/javase/downloads) :
75 - The Java Development Kit (JDK), version 6, 7 and 8
76 - The Java Runtime Environment (JRE), version 6, 7 and 8
77 - The Java API Javadoc, version 6, 7 and 8
78 (Choose tar.gz archives or self-extracting archives, do _not_ choose the RPM!)
80 The following options are recognized:
82 --full-name NAME full name used in the maintainer field of the package
83 --email EMAIL email address used in the maintainer field of the package
84 --changes create a .changes file
85 --revision add debian revision
86 --source build a source package instead of a binary deb package
88 --help display this help and exit
89 --version output version information and exit
94 unrecognized_option() {
96 $program_name: unrecognized option \`$1'
97 Try \`$program_name --help' for more information.
104 $program_name: missing argument for option \`$1'
105 Try \`$program_name --help' for more information.
111 while [[ $# -gt 0 && "x$1" == x--* ]]; do
112 if [[ "x$1" == x--version ]]; then
113 echo "make-jpkg $version"
115 elif [[ "x$1" == x--help ]]; then
118 elif [[ "x$1" == x--full-name ]]; then
119 [ $# -le 1 ] && missing_argument "$1"
122 elif [[ "x$1" == x--email ]]; then
123 [ $# -le 1 ] && missing_argument "$1"
125 maintainer_email="$1"
126 elif [[ "x$1" == x--revision ]]; then
127 [ $# -le 1 ] && missing_argument "$1"
130 elif [[ "x$1" == x--changes ]]; then
132 elif [[ "x$1" == x--source ]]; then
135 unrecognized_option "$1"
141 if [[ $# -ne 1 ]]; then
143 $program_name: missing pathname
144 Try \`$program_name --help' for more information.
150 if [[ ! -e "$archive" ]]; then
151 echo "Error: The file \"$archive\" does not exist."
153 elif [[ ! -r "$archive" ]]; then
154 echo "Error: The file \"$archive\" is not readable."
158 archive_name="$( basename "$archive" )"
159 archive_dir="$( cd "$( dirname "$archive" )" ; pwd )"
160 archive_path="$archive_dir/$archive_name"
169 # function is called when script terminates
172 if [[ -z "$success" && -z "$failed" ]]; then
179 # remove temporary directory
180 if [ -n "$tmp" -a -d "$tmp" ]; then
181 echo -n "Removing temporary directory: "
188 # print error message and terminate
201 # The environment variable tmp points to a secure temporary directory.
202 # There should be enough free disk space.
203 echo -n "Creating temporary directory: "
204 tmp="$( mktemp -d -t "$program_name.XXXXXXXXXX" )"
207 package_dir="$tmp/package"
208 install -d -m 755 "$package_dir"
210 debian_dir="$package_dir/debian"
211 install -d -m 755 "$debian_dir"
213 # load and execute plugins
214 echo -n "Loading plugins:"
215 files=($lib_dir/*.sh)
216 for file in "${files[@]}"; do
223 # get architecture information
226 # get browser plugin directories
227 get_browser_plugin_dirs
229 jvm_base="/usr/lib/jvm/"
230 javadoc_base="/usr/share/doc/"
233 for var in ${!j2se_detect_*}; do
235 if [[ "$j2se_found" == "true" ]]; then
241 if [[ -z "$j2se_found" ]]; then
242 echo "No matching packaging method was found for $archive_name."
243 echo "Please make sure you are using a tar.gz or a self-extracting archive"