From e393f86ba910052df9cefa275c1278e5611c81d0 Mon Sep 17 00:00:00 2001
From: doug-salvati <dougiesal@gmail.com>
Date: Thu, 21 Sep 2017 13:04:16 -0400
Subject: [PATCH 01/12] Libreoffice install version 1

---
 .ebextensions/deploy.config | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/.ebextensions/deploy.config b/.ebextensions/deploy.config
index e2f1ab33d..b705ee201 100644
--- a/.ebextensions/deploy.config
+++ b/.ebextensions/deploy.config
@@ -14,6 +14,18 @@ packages:
     sendmail-cf: []
 
 files:
+  "/tmp/libreofficeinstall.sh" :
+    mode: "000755"
+    owner: root
+    group: root
+    content: |
+      #!/usr/bin/env bash
+      sudo wget https://www.libreoffice.org/donate/dl/deb-x86_64/5.3.6/en-US/LibreOffice_5.3.6_Linux_x86-64_deb.tar.gz
+      sudo tar -xvzf LibreOffice_5.3.6_Linux_x86-64_deb.tar.gz
+      sudo cd DEBS
+      sudo dpkg -i *.deb
+      sudo cd /
+      sudo rm -r /tmp/LibreOffice_5.3.6_Linux_x86-64_deb.tar.gz /tmp/DEBS
   "/etc/nginx/conf.d/proxy.conf" :
     mode: "000755"
     owner: root
@@ -250,6 +262,10 @@ files:
       echo "$(date '+%Y-%m-%d %H:%M:%S') $(free -m | grep Mem: | sed 's/Mem://g')"
       exit 0
 
+commands:
+  install_libreoffice:
+    command: libreofficeinstall.sh
+    cwd: /tmp
 
 Resources:
   AWSEBAutoScalingGroup:

From 95a7c06577d68825b2a2e38c60bc7e63c8b96692 Mon Sep 17 00:00:00 2001
From: doug-salvati <dougiesal@gmail.com>
Date: Thu, 21 Sep 2017 13:12:09 -0400
Subject: [PATCH 02/12] Libreoffice install version 2

---
 .ebextensions/deploy.config | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.ebextensions/deploy.config b/.ebextensions/deploy.config
index b705ee201..8539a1d11 100644
--- a/.ebextensions/deploy.config
+++ b/.ebextensions/deploy.config
@@ -264,8 +264,8 @@ files:
 
 commands:
   install_libreoffice:
-    command: libreofficeinstall.sh
-    cwd: /tmp
+    command: /tmp/libreofficeinstall.sh
+    test: "[ -x /usr/bin/libreoffice ]"
 
 Resources:
   AWSEBAutoScalingGroup:

From 53e04783c8e090e7df1a4480d2c6975795e4c475 Mon Sep 17 00:00:00 2001
From: doug-salvati <dougiesal@gmail.com>
Date: Thu, 21 Sep 2017 13:31:44 -0400
Subject: [PATCH 03/12] Libreoffice install version 3

---
 .ebextensions/deploy.config | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/.ebextensions/deploy.config b/.ebextensions/deploy.config
index 8539a1d11..ed5939aa8 100644
--- a/.ebextensions/deploy.config
+++ b/.ebextensions/deploy.config
@@ -20,12 +20,12 @@ files:
     group: root
     content: |
       #!/usr/bin/env bash
-      sudo wget https://www.libreoffice.org/donate/dl/deb-x86_64/5.3.6/en-US/LibreOffice_5.3.6_Linux_x86-64_deb.tar.gz
-      sudo tar -xvzf LibreOffice_5.3.6_Linux_x86-64_deb.tar.gz
-      sudo cd DEBS
-      sudo dpkg -i *.deb
-      sudo cd /
-      sudo rm -r /tmp/LibreOffice_5.3.6_Linux_x86-64_deb.tar.gz /tmp/DEBS
+      wget http://download.documentfoundation.org/libreoffice/stable/5.3.6/deb/x86_64/LibreOffice_5.3.6_Linux_x86-64_deb.tar.gz
+      tar -xvzf LibreOffice_5.3.6_Linux_x86-64_deb.tar.gz
+      cd DEBS
+      dpkg -i *.deb
+      cd /
+      rm -r /tmp/LibreOffice_5.3.6_Linux_x86-64_deb.tar.gz /tmp/DEBS
   "/etc/nginx/conf.d/proxy.conf" :
     mode: "000755"
     owner: root
@@ -264,7 +264,7 @@ files:
 
 commands:
   install_libreoffice:
-    command: /tmp/libreofficeinstall.sh
+    command: cd tmp; libreofficeinstall.sh
     test: "[ -x /usr/bin/libreoffice ]"
 
 Resources:

From 0a6566ce67ed19ffe9065fa2ac891a37ac0ab856 Mon Sep 17 00:00:00 2001
From: doug-salvati <dougiesal@gmail.com>
Date: Thu, 21 Sep 2017 13:50:44 -0400
Subject: [PATCH 04/12] Libreoffice install version 3

---
 .ebextensions/deploy.config | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/.ebextensions/deploy.config b/.ebextensions/deploy.config
index ed5939aa8..88195cc03 100644
--- a/.ebextensions/deploy.config
+++ b/.ebextensions/deploy.config
@@ -12,6 +12,8 @@ packages:
     git: []
     sendmail: []
     sendmail-cf: []
+    dpkg-devel: []
+    dpkg-dev: []
 
 files:
   "/tmp/libreofficeinstall.sh" :
@@ -22,7 +24,7 @@ files:
       #!/usr/bin/env bash
       wget http://download.documentfoundation.org/libreoffice/stable/5.3.6/deb/x86_64/LibreOffice_5.3.6_Linux_x86-64_deb.tar.gz
       tar -xvzf LibreOffice_5.3.6_Linux_x86-64_deb.tar.gz
-      cd DEBS
+      cd LibreOffice_5.3.6_Linux_x86-64_deb/DEBS
       dpkg -i *.deb
       cd /
       rm -r /tmp/LibreOffice_5.3.6_Linux_x86-64_deb.tar.gz /tmp/DEBS
@@ -264,8 +266,9 @@ files:
 
 commands:
   install_libreoffice:
-    command: cd tmp; libreofficeinstall.sh
-    test: "[ -x /usr/bin/libreoffice ]"
+    command: ./libreofficeinstall.sh
+    cwd: /tmp
+    
 
 Resources:
   AWSEBAutoScalingGroup:

From 4090358524c439f43fcbe59ca5d84e18a8b224f7 Mon Sep 17 00:00:00 2001
From: doug-salvati <dougiesal@gmail.com>
Date: Thu, 21 Sep 2017 13:57:23 -0400
Subject: [PATCH 05/12] Libreoffice install version 5

---
 .ebextensions/deploy.config | 1 -
 1 file changed, 1 deletion(-)

diff --git a/.ebextensions/deploy.config b/.ebextensions/deploy.config
index 88195cc03..cf94174cd 100644
--- a/.ebextensions/deploy.config
+++ b/.ebextensions/deploy.config
@@ -13,7 +13,6 @@ packages:
     sendmail: []
     sendmail-cf: []
     dpkg-devel: []
-    dpkg-dev: []
 
 files:
   "/tmp/libreofficeinstall.sh" :

From 448947aa71d6738417d6f167eb7630ffe716632f Mon Sep 17 00:00:00 2001
From: doug-salvati <dougiesal@gmail.com>
Date: Thu, 21 Sep 2017 14:04:40 -0400
Subject: [PATCH 06/12] Libreoffice install version 6

---
 .ebextensions/deploy.config | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/.ebextensions/deploy.config b/.ebextensions/deploy.config
index cf94174cd..2e4f9cab4 100644
--- a/.ebextensions/deploy.config
+++ b/.ebextensions/deploy.config
@@ -12,7 +12,6 @@ packages:
     git: []
     sendmail: []
     sendmail-cf: []
-    dpkg-devel: []
 
 files:
   "/tmp/libreofficeinstall.sh" :
@@ -24,6 +23,9 @@ files:
       wget http://download.documentfoundation.org/libreoffice/stable/5.3.6/deb/x86_64/LibreOffice_5.3.6_Linux_x86-64_deb.tar.gz
       tar -xvzf LibreOffice_5.3.6_Linux_x86-64_deb.tar.gz
       cd LibreOffice_5.3.6_Linux_x86-64_deb/DEBS
+      yum -y install epel-release
+      yum repolist
+      yum install dpkg-devel dpkg-dev
       dpkg -i *.deb
       cd /
       rm -r /tmp/LibreOffice_5.3.6_Linux_x86-64_deb.tar.gz /tmp/DEBS

From c65818038dff4bf63e2d4ea747f4b748fde902d5 Mon Sep 17 00:00:00 2001
From: doug-salvati <dougiesal@gmail.com>
Date: Thu, 21 Sep 2017 14:18:42 -0400
Subject: [PATCH 07/12] Libreoffice install version 6

---
 .ebextensions/deploy.config | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/.ebextensions/deploy.config b/.ebextensions/deploy.config
index 2e4f9cab4..2ba0a5f23 100644
--- a/.ebextensions/deploy.config
+++ b/.ebextensions/deploy.config
@@ -20,15 +20,12 @@ files:
     group: root
     content: |
       #!/usr/bin/env bash
-      wget http://download.documentfoundation.org/libreoffice/stable/5.3.6/deb/x86_64/LibreOffice_5.3.6_Linux_x86-64_deb.tar.gz
-      tar -xvzf LibreOffice_5.3.6_Linux_x86-64_deb.tar.gz
-      cd LibreOffice_5.3.6_Linux_x86-64_deb/DEBS
-      yum -y install epel-release
-      yum repolist
-      yum install dpkg-devel dpkg-dev
-      dpkg -i *.deb
+      wget http://download.documentfoundation.org/libreoffice/stable/5.3.6/rpm/x86_64/LibreOffice_5.3.6_Linux_x86-64_rpm.tar.gz
+      tar -xvzf LibreOffice_5.3.6_Linux_x86-64_rpm.tar.gz
+      cd LibreOffice_5.3.6_Linux_x86-64_rpm/RPMS
+      yum install *.rpm
       cd /
-      rm -r /tmp/LibreOffice_5.3.6_Linux_x86-64_deb.tar.gz /tmp/DEBS
+      rm -r /tmp/LibreOffice_5.3.6_Linux_x86-64_rpm.tar.gz /tmp/LibreOffice_5.3.6.1_Linux_x86-64_rpm
   "/etc/nginx/conf.d/proxy.conf" :
     mode: "000755"
     owner: root

From 2de6bb825f0143b1e549176c5463c4f96f2748f1 Mon Sep 17 00:00:00 2001
From: doug-salvati <dougiesal@gmail.com>
Date: Thu, 21 Sep 2017 14:29:07 -0400
Subject: [PATCH 08/12] Libreoffice install version 8

---
 .ebextensions/deploy.config | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.ebextensions/deploy.config b/.ebextensions/deploy.config
index 2ba0a5f23..6b33dc6d2 100644
--- a/.ebextensions/deploy.config
+++ b/.ebextensions/deploy.config
@@ -22,7 +22,7 @@ files:
       #!/usr/bin/env bash
       wget http://download.documentfoundation.org/libreoffice/stable/5.3.6/rpm/x86_64/LibreOffice_5.3.6_Linux_x86-64_rpm.tar.gz
       tar -xvzf LibreOffice_5.3.6_Linux_x86-64_rpm.tar.gz
-      cd LibreOffice_5.3.6_Linux_x86-64_rpm/RPMS
+      cd LibreOLibreOffice_5.3.6.1_Linux_x86-64_rpm/RPMS
       yum install *.rpm
       cd /
       rm -r /tmp/LibreOffice_5.3.6_Linux_x86-64_rpm.tar.gz /tmp/LibreOffice_5.3.6.1_Linux_x86-64_rpm
@@ -264,7 +264,7 @@ files:
 
 commands:
   install_libreoffice:
-    command: ./libreofficeinstall.sh
+    command: 'yes | sudo ./libreofficeinstall.sh'
     cwd: /tmp
     
 

From 9a96cc7031b9890d42496ab45fc5b8fd26ef2c8a Mon Sep 17 00:00:00 2001
From: doug-salvati <dougiesal@gmail.com>
Date: Thu, 21 Sep 2017 14:38:06 -0400
Subject: [PATCH 09/12] Libreoffice install version 9

---
 .ebextensions/deploy.config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.ebextensions/deploy.config b/.ebextensions/deploy.config
index 6b33dc6d2..4c8999ff6 100644
--- a/.ebextensions/deploy.config
+++ b/.ebextensions/deploy.config
@@ -22,7 +22,7 @@ files:
       #!/usr/bin/env bash
       wget http://download.documentfoundation.org/libreoffice/stable/5.3.6/rpm/x86_64/LibreOffice_5.3.6_Linux_x86-64_rpm.tar.gz
       tar -xvzf LibreOffice_5.3.6_Linux_x86-64_rpm.tar.gz
-      cd LibreOLibreOffice_5.3.6.1_Linux_x86-64_rpm/RPMS
+      cd LibreOffice_5.3.6.1_Linux_x86-64_rpm/RPMS
       yum install *.rpm
       cd /
       rm -r /tmp/LibreOffice_5.3.6_Linux_x86-64_rpm.tar.gz /tmp/LibreOffice_5.3.6.1_Linux_x86-64_rpm

From 512bf68206d6e800f16639606e2da7dfa5401b0c Mon Sep 17 00:00:00 2001
From: doug-salvati <dougiesal@gmail.com>
Date: Thu, 21 Sep 2017 14:55:20 -0400
Subject: [PATCH 10/12] Libreoffice install version 10

---
 .ebextensions/deploy.config | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/.ebextensions/deploy.config b/.ebextensions/deploy.config
index 4c8999ff6..b6ffa669a 100644
--- a/.ebextensions/deploy.config
+++ b/.ebextensions/deploy.config
@@ -12,6 +12,9 @@ packages:
     git: []
     sendmail: []
     sendmail-cf: []
+    libXinerama.x86_64: []
+    cups-libs: []
+    dbus-glib: []
 
 files:
   "/tmp/libreofficeinstall.sh" :
@@ -26,6 +29,7 @@ files:
       yum install *.rpm
       cd /
       rm -r /tmp/LibreOffice_5.3.6_Linux_x86-64_rpm.tar.gz /tmp/LibreOffice_5.3.6.1_Linux_x86-64_rpm
+      alias libreoffice="libreoffice5.3"
   "/etc/nginx/conf.d/proxy.conf" :
     mode: "000755"
     owner: root

From ff73c2ebdc158d13177cfb45d921515157085eb4 Mon Sep 17 00:00:00 2001
From: doug-salvati <dougiesal@gmail.com>
Date: Thu, 21 Sep 2017 15:10:37 -0400
Subject: [PATCH 11/12] It works!

---
 .ebextensions/deploy.config | 1 -
 lib/file_uploader.rb        | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/.ebextensions/deploy.config b/.ebextensions/deploy.config
index b6ffa669a..7aba5ca1c 100644
--- a/.ebextensions/deploy.config
+++ b/.ebextensions/deploy.config
@@ -29,7 +29,6 @@ files:
       yum install *.rpm
       cd /
       rm -r /tmp/LibreOffice_5.3.6_Linux_x86-64_rpm.tar.gz /tmp/LibreOffice_5.3.6.1_Linux_x86-64_rpm
-      alias libreoffice="libreoffice5.3"
   "/etc/nginx/conf.d/proxy.conf" :
     mode: "000755"
     owner: root
diff --git a/lib/file_uploader.rb b/lib/file_uploader.rb
index fde5c3bb5..549e5ffe6 100644
--- a/lib/file_uploader.rb
+++ b/lib/file_uploader.rb
@@ -80,7 +80,7 @@ def open_spreadsheet(file)
       case File.extname(file.original_filename)
       when '.csv', '.txt', '.text' then convert(file.path)
       when '.xls', '.xlsx', '.ods'
-        system "libreoffice --calc --headless --nologo --invisible --convert-to csv #{file.path} --outdir /tmp/rsense > /dev/null 2>&1"
+        system "libreoffice5.3 --calc --headless --nologo --invisible --convert-to csv #{file.path} --outdir /tmp/rsense > /dev/null 2>&1"
         @converted_csv = "/tmp/rsense/#{file.path.gsub('/tmp/', '')}.csv"
         convert(@converted_csv)
       when '.gpx' then GpxParser.new.convert(file.path)

From 464617be1b799a5b90918aa46f5601d807d8350f Mon Sep 17 00:00:00 2001
From: doug-salvati <dougiesal@gmail.com>
Date: Fri, 22 Sep 2017 11:10:34 -0400
Subject: [PATCH 12/12] Fixes tests

---
 lib/file_uploader.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/file_uploader.rb b/lib/file_uploader.rb
index 549e5ffe6..fde5c3bb5 100644
--- a/lib/file_uploader.rb
+++ b/lib/file_uploader.rb
@@ -80,7 +80,7 @@ def open_spreadsheet(file)
       case File.extname(file.original_filename)
       when '.csv', '.txt', '.text' then convert(file.path)
       when '.xls', '.xlsx', '.ods'
-        system "libreoffice5.3 --calc --headless --nologo --invisible --convert-to csv #{file.path} --outdir /tmp/rsense > /dev/null 2>&1"
+        system "libreoffice --calc --headless --nologo --invisible --convert-to csv #{file.path} --outdir /tmp/rsense > /dev/null 2>&1"
         @converted_csv = "/tmp/rsense/#{file.path.gsub('/tmp/', '')}.csv"
         convert(@converted_csv)
       when '.gpx' then GpxParser.new.convert(file.path)