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"
37 ### check for run in fakeroot
39 # are we running as fakeroot
40 if ! dh_testroot >/dev/null 2>&1; then
41 if [ -n "$FAKEROOTKEY" ]; then
42 echo "Internal error, fakeroot seems to fail faking root" >&2
45 exec fakeroot "$0" "$@"
48 # check whether I'm real root, and bail out if so... ugly, but needed
49 if touch /lib/.test 2>/dev/null; then
51 echo "You are real root -- unfortunately, some Java distributions have" >&2
52 echo "install scripts that directly manipulate /etc, and may cause some" >&2
53 echo "inconsistencies on your system. Instead, you should become a" >&2
54 echo "non-root user and run:" >&2
56 echo "fakeroot make-jpkg $@" >&2
58 echo "which will allow no damage to be done to your system files and" >&2
59 echo "still permit the Java distribution to successfully extract." >&2
70 Usage: $program_name [OPTION]... FILE
72 $program_name builds a Debian package from the given Java binary distribution FILE
74 Supported java binary distributions currently include:
75 * Oracle (http://www.oracle.com/technetwork/java/javase/downloads) :
76 - The Java Development Kit (JDK), version 6, 7 and 8
77 - The Java Runtime Environment (JRE), version 6, 7 and 8
78 - The Java API Javadoc, version 6, 7 and 8
79 (Choose tar.gz archives or self-extracting archives, do _not_ choose the RPM!)
81 The following options are recognized:
83 --jce-policy FILE Replace cryptography files with unlimited strength versions
84 from downloaded archive
85 --full-name NAME full name used in the maintainer field of the package
86 --email EMAIL email address used in the maintainer field of the package
87 --changes create a .changes file
88 --revision add debian revision
89 --source build a source package instead of a binary deb package
90 --with-system-certs integrate with the system's keystore
91 --distribution Define the distribution to use in the changelog
93 --help display this help and exit
94 --version output version information and exit
99 unrecognized_option() {
101 $program_name: unrecognized option \`$1'
102 Try \`$program_name --help' for more information.
109 $program_name: missing argument for option \`$1'
110 Try \`$program_name --help' for more information.
116 while [[ $# -gt 0 && "x$1" == x--* ]]; do
117 if [[ "x$1" == x--version ]]; then
118 echo "make-jpkg $version"
120 elif [[ "x$1" == x--help ]]; then
123 elif [[ "x$1" == x--jce-policy ]]; then
124 [ $# -le 1 ] && missing_argument "$1"
127 elif [[ "x$1" == x--full-name ]]; then
128 [ $# -le 1 ] && missing_argument "$1"
131 elif [[ "x$1" == x--email ]]; then
132 [ $# -le 1 ] && missing_argument "$1"
134 maintainer_email="$1"
135 elif [[ "x$1" == x--distribution ]]; then
136 [ $# -le 1 ] && missing_argument "$1"
139 elif [[ "x$1" == x--revision ]]; then
140 [ $# -le 1 ] && missing_argument "$1"
143 elif [[ "x$1" == x--changes ]]; then
145 elif [[ "x$1" == x--source ]]; then
147 elif [[ "x$1" == x--with-system-certs ]]; then
148 create_cert_softlinks="true"
150 unrecognized_option "$1"
156 if [[ $# -ne 1 ]]; then
158 $program_name: missing pathname
159 Try \`$program_name --help' for more information.
165 if [[ ! -e "$archive" ]]; then
166 echo "Error: The file \"$archive\" does not exist."
168 elif [[ ! -r "$archive" ]]; then
169 echo "Error: The file \"$archive\" is not readable."
173 archive_name="$( basename "$archive" )"
174 archive_dir="$( cd "$( dirname "$archive" )" ; pwd )"
175 archive_path="$archive_dir/$archive_name"
177 jce_name="$( basename "$jce_archive" )"
178 jce_dir="$( cd "$( dirname "$jce_archive" )" ; pwd )"
179 jce_path="$jce_dir/$jce_name"
187 # function is called when script terminates
190 if [[ -z "$success" && -z "$failed" ]]; then
197 # remove temporary directory
198 if [ -n "$tmp" -a -d "$tmp" ]; then
199 echo -n "Removing temporary directory: "
206 # print error message and terminate
219 # The environment variable tmp points to a secure temporary directory.
220 # There should be enough free disk space.
221 echo -n "Creating temporary directory: "
222 tmp="$( mktemp -d -t "$program_name.XXXXXXXXXX" )"
225 package_dir="$tmp/package"
226 install -d -m 755 "$package_dir"
228 debian_dir="$package_dir/debian"
229 install -d -m 755 "$debian_dir"
231 # load and execute plugins
232 echo -n "Loading plugins:"
233 files=($lib_dir/*.sh)
234 for file in "${files[@]}"; do
241 # get architecture information
244 # get browser plugin directories
245 get_browser_plugin_dirs
247 jvm_base="/usr/lib/jvm/"
248 javadoc_base="/usr/share/doc/"
251 for var in ${!j2se_detect_*}; do
253 if [[ "$j2se_found" == "true" ]]; then
259 if [[ -z "$j2se_found" ]]; then
260 echo "No matching packaging method was found for $archive_name."
261 echo "Please make sure you are using a tar.gz or a self-extracting archive"