Bug#266273: java-package: patch for gnome integration

Aaron Read Aaron Read <amread@nyx.net>, 266273@bugs.debian.org
Sun Nov 14 18:11:02 2004


Package: java-package
Version: 0.17
Followup-For: Bug #266273

The sun installer will not install to a different root, it seems like
the best solution is to fix stuff after the installer has finished. It
might even be a good idea to move things around more aggressively so it
better matches Debian policy.

This patch makes symlinks to the icon files, installs mime and gnome
stuff for jar and javaws.

The scary messages from the sun installer are still displayed, we do
the same things the right way afterwards.

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.8.1
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages java-package depends on:
ii  debhelper                     4.2.24     helper programs for debian/rules

-- no debconf information

*** /home/amread/java-package.patch
diff -ruN java-package-0.17/debian/sun-j2re1.5debian.links java-package-0.17-new/debian/sun-j2re1.5debian.links
--- java-package-0.17/debian/sun-j2re1.5debian.links	1969-12-31 16:00:00.000000000 -0800
+++ java-package-0.17-new/debian/sun-j2re1.5debian.links	2004-11-14 16:13:28.000000000 -0800
@@ -0,0 +1,4 @@
+usr/lib/j2sdk1.5-sun/jre/lib/images/icons/sun-java.png usr/share/pixmaps/sun-java.png
+usr/lib/j2sdk1.5-sun/jre/lib/images/icons/sun-java_HighContrast.png usr/share/icons/HighContrast/48x48/apps/sun-java.png
+usr/lib/j2sdk1.5-sun/jre/lib/images/icons/sun-java_HighContrastInverse.png usr/share/icons/HighContrastInverse/48x48/apps/sun-java.png
+usr/lib/j2sdk1.5-sun/jre/lib/images/icons/sun-java_LowContrast.png usr/share/icons/LowContrast/48x48/apps/sun-java.png
diff -ruN java-package-0.17/debian/sun-j2sdk1.5debian.links java-package-0.17-new/debian/sun-j2sdk1.5debian.links
--- java-package-0.17/debian/sun-j2sdk1.5debian.links	1969-12-31 16:00:00.000000000 -0800
+++ java-package-0.17-new/debian/sun-j2sdk1.5debian.links	2004-11-14 16:13:28.000000000 -0800
@@ -0,0 +1,4 @@
+usr/lib/j2sdk1.5-sun/jre/lib/images/icons/sun-java.png usr/share/pixmaps/sun-java.png
+usr/lib/j2sdk1.5-sun/jre/lib/images/icons/sun-java_HighContrast.png usr/share/icons/HighContrast/48x48/apps/sun-java.png
+usr/lib/j2sdk1.5-sun/jre/lib/images/icons/sun-java_HighContrastInverse.png usr/share/icons/HighContrastInverse/48x48/apps/sun-java.png
+usr/lib/j2sdk1.5-sun/jre/lib/images/icons/sun-java_LowContrast.png usr/share/icons/LowContrast/48x48/apps/sun-java.png
diff -ruN java-package-0.17/lib/j2re.sh java-package-0.17-new/lib/j2re.sh
--- java-package-0.17/lib/j2re.sh	2004-10-11 16:24:31.000000000 -0700
+++ java-package-0.17-new/lib/j2re.sh	2004-11-14 16:13:28.000000000 -0800
@@ -6,6 +6,14 @@
     j2se_changelog
 }
 
+function j2re_mime() {
+    j2se_mime
+}
+
+function j2re_gnome {
+    j2se_gnome "$@"
+}
+
 function j2re_control() {
     j2se_control
     cat << EOF
@@ -53,11 +61,17 @@
     local target="$install_dir$j2se_base"
     install -d -m 755 "$( dirname "$target" )"
     extract_bin "$archive_path" "$j2se_expected_min_size" "$target"
+
+    local share_dir="$install_dir/usr/share"
+    j2re_gnome "$share_dir" "application/java-archive" "Java Archive" "java-archive" "jar" "/usr/bin/jar"
+    j2re_gnome "$share_dir" "application/x-java-jnlp-file" "Java Web Start Application" "java-web-start" "jnlp" "/usr/bin/javaws"
+
     rm -rf "$target/.systemPrefs"
     j2re_readme > "$debian_dir/README.Debian"
     j2re_changelog > "$debian_dir/changelog"
     j2re_control > "$debian_dir/control"
     j2re_copyright > "$debian_dir/copyright"
+    j2re_mime > "$debian_dir/${j2se_package}.mime"
     j2re_install_scripts
     install -d "$target/debian"
     j2re_info > "$target/debian/info"
diff -ruN java-package-0.17/lib/j2sdk.sh java-package-0.17-new/lib/j2sdk.sh
--- java-package-0.17/lib/j2sdk.sh	2004-10-11 16:24:31.000000000 -0700
+++ java-package-0.17-new/lib/j2sdk.sh	2004-11-14 16:13:28.000000000 -0800
@@ -6,6 +6,14 @@
     j2se_changelog
 }
 
+function j2sdk_mime() {
+    j2se_mime
+}
+
+function j2sdk_gnome {
+    j2se_gnome "$@"
+}
+
 function j2sdk_control() {
     j2se_control
     cat << EOF
@@ -55,11 +63,17 @@
     local target="$install_dir$j2se_base"
     install -d -m 755 "$( dirname "$target" )"
     extract_bin "$archive_path" "$j2se_expected_min_size" "$target"
+
+    local share_dir="$install_dir/usr/share"
+    j2sdk_gnome "$share_dir" "application/java-archive" "Java Archive" "java-archive" "jar" "/usr/bin/jar"
+    j2sdk_gnome "$share_dir" "application/x-java-jnlp-file" "Java Web Start Application" "java-web-start" "jnlp" "/usr/bin/javaws"
+
     rm -rf "$target/.systemPrefs"
     j2sdk_readme > "$debian_dir/README.Debian"
     j2sdk_changelog > "$debian_dir/changelog"
     j2sdk_control > "$debian_dir/control"
     j2sdk_copyright > "$debian_dir/copyright"
+    j2sdk_mime > "$debian_dir/${j2se_package}.mime"
     j2sdk_install_scripts
     install -d "$target/debian"
     j2sdk_info > "$target/debian/info"
diff -ruN java-package-0.17/lib/j2se.sh java-package-0.17-new/lib/j2se.sh
--- java-package-0.17/lib/j2se.sh	2004-10-11 16:24:31.000000000 -0700
+++ java-package-0.17-new/lib/j2se.sh	2004-11-14 16:13:28.000000000 -0800
@@ -22,6 +22,72 @@
 EOF
 }
 
+function j2se_mime() {
+    cat << EOF
+application/x-java-archive; /usr/bin/jar tf %s
+application/x-java-jnlp-file; /usr/bin/javaws %s
+
+EOF
+}
+
+function j2se_gnome_mime {
+    cat << EOF
+$1
+        ext: $2
+
+EOF
+}
+
+function j2se_gnome_applications {
+    local mime_type="$1"
+    local id="$2"
+    local command="$3"
+
+    cat << EOF
+$id
+        command=$command
+        name=$id
+        can_open_multiple_files=false
+        requires_terminal=false
+        mime_types=$mime_type
+
+EOF
+}
+
+function j2se_gnome_keys {
+    local mime_type="$1"
+    local description="$2"
+    local id="$3"
+    cat << EOF
+$1
+        description=$2
+        icon_filename=sun-java
+        default_action_type=application
+        default_application_id=$3
+        short_list_application_user_additions=$3
+
+EOF
+}
+
+function j2se_gnome {
+    local share_dir="$1"
+    local mime_type="$2"
+    local description="$3"
+    local id="$4"
+    local ext="$5"
+    local command="$6"
+
+    local mime_dir="$share_dir/mime-info"
+    local app_dir="$share_dir/application-registry"
+
+    mkdir -p "$mime_dir"
+    mkdir -p "$app_dir"
+
+    j2se_gnome_mime "$mime_type" "$ext" > "$mime_dir/$id.mime"
+    j2se_gnome_keys "$mime_type" "$description" "$ext" > "$mime_dir/$id.keys"
+    j2se_gnome_applications "$mime_type" "$id" "$command" > "$app_dir/$id.applications"
+}
+
 function j2se_control() {
     cat << EOF
 Source: $j2se_package
@@ -132,6 +198,8 @@
     # Problem: dh_installchangelogs thinks this is a native package.
     echo "    dh_installdocs"
     dh_installdocs
+    echo "    dh_installmime"
+    dh_installmime
     # dh_install
     # dh_link
     echo "    dh_strip"
diff -ruN java-package-0.17/sun-j2re1.5/install java-package-0.17-new/sun-j2re1.5/install
--- java-package-0.17/sun-j2re1.5/install	2004-10-11 16:10:25.000000000 -0700
+++ java-package-0.17-new/sun-j2re1.5/install	2004-11-14 16:13:28.000000000 -0800
@@ -19,10 +19,10 @@
 }
 
 program_alternative java
+program_alternative javaws
 program_alternative rmid
 program_alternative rmiregistry
 
-
 plugin_dir="$j2se_base/plugin/i386"
 
 # netscape
diff -ruN java-package-0.17/sun-j2re1.5/remove java-package-0.17-new/sun-j2re1.5/remove
--- java-package-0.17/sun-j2re1.5/remove	2004-10-11 16:10:25.000000000 -0700
+++ java-package-0.17-new/sun-j2re1.5/remove	2004-11-14 16:13:28.000000000 -0800
@@ -15,10 +15,10 @@
 }
 
 program_alternative java
+program_alternative javaws
 program_alternative rmid
 program_alternative rmiregistry
 
-
 plugin_dir="$j2se_base/plugin/i386"
 
 # netscape
diff -ruN java-package-0.17/sun-j2sdk1.5/install java-package-0.17-new/sun-j2sdk1.5/install
--- java-package-0.17/sun-j2sdk1.5/install	2004-10-11 16:10:25.000000000 -0700
+++ java-package-0.17-new/sun-j2sdk1.5/install	2004-11-14 16:13:28.000000000 -0800
@@ -27,6 +27,7 @@
 program_alternative javadoc
 program_alternative javah
 program_alternative javap
+program_alternative javaws
 program_alternative jdb
 program_alternative rmic
 program_alternative rmid