From 75f5226c04b43239311849dd295e3a2db0d81ae6 Mon Sep 17 00:00:00 2001 From: Gordon Hall Date: Tue, 9 Aug 2016 10:28:45 -0400 Subject: [PATCH 1/2] remove symlink to prevent collisions with storjshare gui --- resources/linux/DEBIAN/postinst | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/resources/linux/DEBIAN/postinst b/resources/linux/DEBIAN/postinst index 3880ad8..67680f5 100755 --- a/resources/linux/DEBIAN/postinst +++ b/resources/linux/DEBIAN/postinst @@ -1,9 +1,5 @@ #!/bin/sh -FILE=/usr/local/bin/storjshare -FILE2=/opt/storjshare/storjshare -if [[ -L $FILE ]]; then - echo "File exists and there is a symbolic link" -else - echo "Creating symbolic link between $FILE and $FILE2" - ln -s $FILE2 $FILE -fi + +### +# Any post-install logic on debian based systems goes here +### From 53802bd364bef4b5b7a6f8d980074ad7fe181fab Mon Sep 17 00:00:00 2001 From: Gordon Hall Date: Tue, 9 Aug 2016 10:48:52 -0400 Subject: [PATCH 2/2] use async version of diskpace check to prevent EMFILE --- app/client.js | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/app/client.js b/app/client.js index 0a3c864..6599970 100644 --- a/app/client.js +++ b/app/client.js @@ -21,7 +21,7 @@ var about = require('./package'); var Updater = require('./lib/updater'); var UserData = require('./lib/userdata'); var Tab = require('./lib/tab'); -var diskspace = require('fd-diskspace').diskSpaceSync; +var diskspace = require('fd-diskspace').diskSpace; var storj = require('storj'); var Monitor = storj.Monitor; var SpeedTest = require('myspeed').Client; @@ -521,20 +521,28 @@ var main = new Vue({ }, getFreeSpace: function(tab) { - var disks = diskspace().disks; - var free = 0; - - for (var disk in disks) { - if (tab.storage.path.indexOf(disk) !== -1) { - // The `df` command on linux returns KB by default, so we need to - // convert to bytes. - free = process.platform === 'win32' ? - disks[disk].free : - disks[disk].free * 1000; + var self = this; + + diskspace(function(err, result) { + if (err) { + return; } - } - var freespace = utils.autoConvert({size: free, unit: 'B'}); - this.freespace = freespace; + + var free = 0; + + for (var disk in result.disks) { + if (tab.storage.path.indexOf(disk) !== -1) { + // The `df` command on linux returns KB by default, so we need to + // convert to bytes. + free = process.platform === 'win32' ? + result.disks[disk].free : + result.disks[disk].free * 1000; + } + } + + var freespace = utils.autoConvert({size: free, unit: 'B'}); + self.freespace = freespace; + }); } }, created: function() {