Package: java-package
Version: 0.61
Severity: wishlist
Tags: patch

Dear Maintainer,

I'd like for there to be an option to extract the unlimited strength
cryptography files into the resulting deb. I've included a patch that should
add a '--jce-zip FILE' option, where FILE is the jce policy zip downloaded from
upstream.

I used 'git --format-patch' to create this, let me know if you'd like another
format. This is my first patch submission to Debian, so I hope I'm following
all the correct guidelines :)

Thanks!
Alex



-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (990, 'testing'), (600, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.6.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages java-package depends on:
ii  build-essential  12.2
ii  debhelper        9.20160403
ii  dpkg-dev         1.18.9
ii  fakeroot         1.21-1
ii  libasound2       1.1.1-2
ii  libfontconfig1   2.11.0-6.4
ii  libgl1-mesa-glx  11.2.2-1
ii  libgtk2.0-0      2.24.30-4
ii  libx11-6         2:1.6.3-1
ii  libxslt1.1       1.1.28-4
ii  libxtst6         2:1.2.2-1+b1
ii  libxxf86vm1      1:1.1.4-1
ii  unzip            6.0-20

java-package recommends no packages.

Versions of packages java-package suggests:
pn  openjdk-7-jre  <none>

-- no debconf information
>From 99905dc0fe0dcc3a99ac48c6435893e20c5b0f4d Mon Sep 17 00:00:00 2001
From: Alex Brown <[email protected]>
Date: Tue, 2 Aug 2016 12:38:53 -0400
Subject: [PATCH] Add --jce-zip option

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

make-jpkg --jce-zip /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..cb41903 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_zip" ]]; 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..8c03ac2 100755
--- a/make-jpkg
+++ b/make-jpkg
@@ -32,6 +32,7 @@ fi
 
 genchanges=""
 build_source=""
+jce_zip=""
 
 ### check for run in fakeroot
 
@@ -79,6 +80,8 @@ Supported java binary distributions currently include:
 
 The following options are recognized:
 
+  --jce-zip FILE       Replace cryptography files with unlimited strength
+                       versions from downloaded zip
   --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-zip ]]; then
+    [ $# -le 1 ] && missing_argument "$1"
+    shift
+    jce_zip="$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_zip" )"
+jce_dir="$( cd "$( dirname "$jce_zip" )" ; pwd )"
+jce_path="$jce_dir/$jce_name"
 
 # error handling
 
-- 
2.8.1

Reply via email to