apply patch for --jce-policy (Closes: #833301)
authortony mancill <tmancill@debian.org>
Sat, 10 Sep 2016 17:48:40 +0000 (10:48 -0700)
committertony mancill <tmancill@debian.org>
Sat, 10 Sep 2016 17:48:40 +0000 (10:48 -0700)
From 600a834bfb5b36b59b3fd75e01e38abf945651fc Mon Sep 17 00:00:00 2001
From: Alex Brown <alexpbrown9@gmail.com>
Date: Tue, 2 Aug 2016 12:38:53 -0400
Subject: [PATCH] Add --jce-policy option

This should give users the option to add the unlimited strength
cryptography files to the install. Example:

make-jpkg --jce-policy /tmp/jce_policy-8.zip /tmp/jdk-8u101-linux-x64.tar.gz
---
 lib/common.sh |  9 +++++++++
 lib/javase.sh |  3 +++
 make-jpkg     | 10 ++++++++++
 3 files changed, 22 insertions(+)

diff --git a/lib/common.sh b/lib/common.sh
index 73d729f..ca09f07 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -128,6 +128,15 @@ EOF
     fi
 }

+extract_jce() {
+  local zip_file="$1"
+  local dest_dir="$2"
+
+  echo "Installing unlimited strength cryptography files using $zip_file"
+  for f in {US_export,local}_policy.jar; do
+    unzip -o -j -d "$dest_dir" "$zip_file" "*/$f"
+  done
+}

 read_maintainer_info() {
     if [ -z "$maintainer_name" ]; then
diff --git a/lib/javase.sh b/lib/javase.sh
index ed0745c..6c01270 100644
--- a/lib/javase.sh
+++ b/lib/javase.sh
@@ -293,6 +293,9 @@ j2se_run() {
     local target="$package_dir/$j2se_name"
     install -d -m 755 "$( dirname "$target" )"
     extract_bin "$archive_path" "$j2se_expected_min_size" "$target"
+    if [[ -n "$jce_archive" ]]; then
+      extract_jce "$jce_path" "$target/jre/lib/security"
+    fi
     rm -rf "$target/.systemPrefs"
     echo "9" > "$debian_dir/compat"
     j2se_readme > "$debian_dir/README.Debian"
diff --git a/make-jpkg b/make-jpkg
index 6e53003..69d83c9 100755
--- a/make-jpkg
+++ b/make-jpkg
@@ -32,6 +32,7 @@ fi

 genchanges=""
 build_source=""
+jce_archive=""

 ### check for run in fakeroot

@@ -79,6 +80,8 @@ Supported java binary distributions currently include:

 The following options are recognized:

+  --jce-policy FILE    Replace cryptography files with unlimited strength versions
+                       from downloaded archive
   --full-name NAME     full name used in the maintainer field of the package
   --email EMAIL        email address used in the maintainer field of the package
   --changes            create a .changes file
@@ -116,6 +119,10 @@ while [[ $# -gt 0 && "x$1" == x--* ]]; do
     elif [[ "x$1" == x--help ]]; then
     print_usage
     exit 0
+    elif [[ "x$1" == x--jce-policy ]]; then
+    [ $# -le 1 ] && missing_argument "$1"
+    shift
+    jce_archive="$1"
     elif [[ "x$1" == x--full-name ]]; then
     [ $# -le 1 ] && missing_argument "$1"
     shift
@@ -162,6 +169,9 @@ archive_name="$( basename "$archive" )"
 archive_dir="$( cd "$( dirname "$archive" )" ; pwd )"
 archive_path="$archive_dir/$archive_name"

+jce_name="$( basename "$jce_archive" )"
+jce_dir="$( cd "$( dirname "$jce_archive" )" ; pwd )"
+jce_path="$jce_dir/$jce_name"

 # error handling

--
2.8.1

lib/common.sh
lib/javase.sh
make-jpkg

index 268c458..ab07236 100644 (file)
@@ -128,6 +128,15 @@ EOF
     fi
 }
 
+extract_jce() {
+  local zip_file="$1"
+  local dest_dir="$2"
+
+  echo "Installing unlimited strength cryptography files using $zip_file"
+  for f in {US_export,local}_policy.jar; do
+    unzip -o -j -d "$dest_dir" "$zip_file" "*/$f"
+  done
+}
 
 read_maintainer_info() {
     if [ -z "$maintainer_name" ]; then
index 8955c92..a0eab00 100644 (file)
@@ -294,6 +294,9 @@ j2se_run() {
     local target="$package_dir/$j2se_name"
     install -d -m 755 "$( dirname "$target" )"
     extract_bin "$archive_path" "$j2se_expected_min_size" "$target"
+    if [[ -n "$jce_archive" ]]; then
+      extract_jce "$jce_path" "$target/jre/lib/security"
+    fi
     rm -rf "$target/.systemPrefs"
     echo "9" > "$debian_dir/compat"
     j2se_readme > "$debian_dir/README.Debian"
index 6ec655a..48f2028 100755 (executable)
--- a/make-jpkg
+++ b/make-jpkg
@@ -32,6 +32,7 @@ fi
 
 genchanges=""
 build_source=""
+jce_archive=""
 
 ### check for run in fakeroot
 
@@ -79,6 +80,8 @@ Supported java binary distributions currently include:
 
 The following options are recognized:
 
+  --jce-policy FILE    Replace cryptography files with unlimited strength versions
+                       from downloaded archive
   --full-name NAME     full name used in the maintainer field of the package
   --email EMAIL        email address used in the maintainer field of the package
   --changes            create a .changes file
@@ -117,6 +120,10 @@ while [[ $# -gt 0 && "x$1" == x--* ]]; do
     elif [[ "x$1" == x--help ]]; then
     print_usage
     exit 0
+    elif [[ "x$1" == x--jce-policy ]]; then
+    [ $# -le 1 ] && missing_argument "$1"
+    shift
+    jce_archive="$1"
     elif [[ "x$1" == x--full-name ]]; then
     [ $# -le 1 ] && missing_argument "$1"
     shift
@@ -167,6 +174,9 @@ archive_name="$( basename "$archive" )"
 archive_dir="$( cd "$( dirname "$archive" )" ; pwd )"
 archive_path="$archive_dir/$archive_name"
 
+jce_name="$( basename "$jce_archive" )"
+jce_dir="$( cd "$( dirname "$jce_archive" )" ; pwd )"
+jce_path="$jce_dir/$jce_name"
 
 # error handling