LP#1743220: Update script to accommodate Ubuntu 16.04.
authorChris Sharp <csharp@georgialibraries.org>
Sun, 14 Jan 2018 13:39:53 +0000 (08:39 -0500)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 6 Feb 2018 22:06:27 +0000 (17:06 -0500)
- renamed the script to "install-ubuntu.sh"
- changed the hard-coded Ruby version to a variable
  that depends on the Ubuntu release (per the lsb_release
  command)
- saw the script work on my 16.04 server

Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Signed-off-by: Jason Stephenson <jason@sigio.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/edi_translator/install-ubuntu-trusty.sh [deleted file]
Open-ILS/src/edi_translator/install-ubuntu.sh [new file with mode: 0755]

diff --git a/Open-ILS/src/edi_translator/install-ubuntu-trusty.sh b/Open-ILS/src/edi_translator/install-ubuntu-trusty.sh
deleted file mode 100755 (executable)
index 6223070..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-# hopefully this is all temporary
-
-# install ruby via APT
-sudo apt-get install rubygems-integration ruby-dev
-
-# install gem dependencies
-sudo gem install parseconfig rspec edi4r edi4r-tdid json openils-mapper
-
-# clone berick's openils-mapper repo
-git clone https://github.com/berick/openils-mapper
-cd openils-mapper
-# move openils-mapper files into place
-git checkout -b GIR-segments-for-copy-data origin/GIR-segments-for-copy-data
-sudo cp lib/openils/mapper.rb /var/lib/gems/1.9.1/gems/openils-mapper-0.9.9/lib/openils/mapper.rb
-sudo cp lib/edi/mapper.rb /var/lib/gems/1.9.1/gems/openils-mapper-0.9.9/lib/edi/mapper.rb
diff --git a/Open-ILS/src/edi_translator/install-ubuntu.sh b/Open-ILS/src/edi_translator/install-ubuntu.sh
new file mode 100755 (executable)
index 0000000..56728db
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash
+# hopefully this is all temporary
+
+UBUNTU_RELEASE=$(lsb_release -sc)
+if [ "$UBUNTU_RELEASE" == "xenial" ]; then
+    RUBY_VERSION="2.3.0"
+elif [ "$UBUNTU_RELEASE" == "trusty" ]; then
+    RUBY_VERSION="1.9.1"
+else 
+    echo "Could not determine your Ubuntu release."
+    echo "Please consult $0 and install manually."
+    exit 1
+fi
+
+# install ruby via APT
+sudo apt-get install rubygems-integration ruby-dev
+
+# install gem dependencies
+sudo gem install parseconfig rspec edi4r edi4r-tdid json openils-mapper
+
+# clone berick's openils-mapper repo
+git clone https://github.com/berick/openils-mapper
+cd openils-mapper
+# move openils-mapper files into place
+git checkout -b GIR-segments-for-copy-data origin/GIR-segments-for-copy-data
+sudo cp lib/openils/mapper.rb /var/lib/gems/$RUBY_VERSION/gems/openils-mapper-0.9.9/lib/openils/mapper.rb
+sudo cp lib/edi/mapper.rb /var/lib/gems/$RUBY_VERSION/gems/openils-mapper-0.9.9/lib/edi/mapper.rb