changeset 4008:0809810d0ae1

RT-27989 Linux DEB installer does not specify Installed-Size [mhowe] Contributed-by: Danno Ferrin <danno.ferrin@shemnon.com> Re-applying using io instead of nio, so it's compatible with Fx2U
author mhowe
date Wed, 12 Jun 2013 15:34:39 -0700
parents 7fa0244ee54e
children 1ef5290637c0
files deploy/packager/src/com/sun/javafx/tools/packager/bundlers/LinuxDebBundler.java deploy/packager/src/com/sun/javafx/tools/resource/linux/template.control
diffstat 2 files changed, 20 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/deploy/packager/src/com/sun/javafx/tools/packager/bundlers/LinuxDebBundler.java	Wed Jun 12 14:56:27 2013 -0700
+++ b/deploy/packager/src/com/sun/javafx/tools/packager/bundlers/LinuxDebBundler.java	Wed Jun 12 15:34:39 2013 -0700
@@ -28,13 +28,10 @@
 import com.sun.javafx.tools.packager.Log;
 import com.sun.javafx.tools.resource.linux.LinuxResources;
 import java.io.BufferedWriter;
-import java.io.ByteArrayOutputStream;
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.Writer;
 import java.util.HashMap;
 import java.util.Map;
@@ -278,6 +275,23 @@
         }
     }
 
+    private long getInstalledSizeKB() {
+        return getInstalledSizeKB(appImageRoot) >> 10;
+    }
+
+    private long getInstalledSizeKB(File dir) {
+        long count = 0;
+        for (File file : dir.listFiles()) {
+            if (file.isFile()) {
+                count += file.length();
+            }
+            else if (file.isDirectory()) {
+                count += getInstalledSizeKB(file);
+            }
+        }
+        return count;
+    }
+
     private boolean prepareProjectConfig() throws IOException {
         Map<String, String> data = new HashMap<String, String>();
 
@@ -301,6 +315,7 @@
                 params.licenseType != null ? params.licenseType : "unknown");
         data.put("APPLICATION_LICENSE_TEXT", getLicenseText());
         data.put("APPLICATION_ARCH", getArch());
+        data.put("APPLICATION_INSTALLED_SIZE", Long.toString(getInstalledSizeKB()));
 
         //prepare control file
         Writer w = new BufferedWriter(new FileWriter(getConfig_ControlFile()));
--- a/deploy/packager/src/com/sun/javafx/tools/resource/linux/template.control	Wed Jun 12 14:56:27 2013 -0700
+++ b/deploy/packager/src/com/sun/javafx/tools/resource/linux/template.control	Wed Jun 12 15:34:39 2013 -0700
@@ -4,6 +4,6 @@
 Maintainer: APPLICATION_VENDOR
 Priority: optional
 Architecture: APPLICATION_ARCH
-Provides: APPLICATION_NAME  
+Provides: APPLICATION_NAME
 Description: APPLICATION_SUMMARY
-
+Installed-Size: APPLICATION_INSTALLED_SIZE