omf_rc 6.1.6.pre.2 → 6.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/init/run_omf_rc.sh +60 -34
  2. metadata +10 -7
data/init/run_omf_rc.sh CHANGED
@@ -12,51 +12,77 @@ die() { echo "ERROR: $@" 1>&2 ; exit 1; }
12
12
  RUBY_VER="ruby-1.9.3-p286"
13
13
  RUBY_BIN_SUFFIX=""
14
14
 
15
+ function compare_version {
16
+ echo $1
17
+ if [[ $1 == $2 ]]; then
18
+ return 0
19
+ fi
20
+ local IFS=.
21
+ local i ver1=($1) ver2=($2)
22
+ # fill empty fields in ver1 with zeros
23
+ for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)); do
24
+ ver1[i]=0
25
+ done
26
+ for ((i=0; i<${#ver1[@]}; i++)); do
27
+ if [[ -z ${ver2[i]} ]]; then
28
+ # fill empty fields in ver2 with zeros
29
+ ver2[i]=0
30
+ fi
31
+ if ((10#${ver1[i]} > 10#${ver2[i]})); then
32
+ return 1
33
+ fi
34
+ if ((10#${ver1[i]} < 10#${ver2[i]})); then
35
+ return 2
36
+ fi
37
+ done
38
+ return 0
39
+ }
40
+
15
41
  if [ `id -u` != "0" ]; then
16
- die "This script is intended to be run as 'root'"
42
+ die "This script is intended to be run as 'root'"
17
43
  fi
18
44
 
19
45
  if [ -e /etc/profile.d/rvm.sh ]; then
20
- # use RVM if installed
21
- echo "System-wide RVM installation detected"
22
- source /etc/profile.d/rvm.sh
23
- if [[ $? != 0 ]] ; then
24
- die "Failed to initialize RVM environment"
25
- fi
26
- rvm use $RUBY_VER@omf > /dev/null
27
- if [[ $? != 0 ]] ; then
28
- die "$RUBY_VER with gemset 'omf' is not installed in your RVM"
29
- fi
30
- ruby -v | grep 1.9.3 > /dev/null
31
- if [[ $? != 0 ]] ; then
32
- die "Could not run Ruby 1.9.3"
33
- fi
34
- gem list | grep omf_rc > /dev/null
35
- if [[ $? != 0 ]] ; then
36
- die "The omf_rc gem is not installed in the 'omf' gemset"
37
- fi
46
+ # use RVM if installed
47
+ echo "System-wide RVM installation detected"
48
+ source /etc/profile.d/rvm.sh
49
+ if [[ $? != 0 ]] ; then
50
+ die "Failed to initialize RVM environment"
51
+ fi
52
+ rvm use $RUBY_VER@omf > /dev/null
53
+ if [[ $? != 0 ]] ; then
54
+ die "$RUBY_VER with gemset 'omf' is not installed in your RVM"
55
+ fi
56
+ ruby -v | grep 1.9.3 > /dev/null
57
+ if [[ $? != 0 ]] ; then
58
+ die "Could not run Ruby 1.9.3"
59
+ fi
60
+ gem list | grep omf_rc > /dev/null
61
+ if [[ $? != 0 ]] ; then
62
+ die "The omf_rc gem is not installed in the 'omf' gemset"
63
+ fi
38
64
  else
39
- # check for distro ruby when no RVM was found
40
- echo "No system-wide RVM installation detected"
41
- ruby -v | grep 1.9.3 > /dev/null
42
- if [[ $? != 0 ]] ; then
43
- ruby1.9.3 -v | grep 1.9.3 > /dev/null
44
- if [[ $? != 0 ]] ; then
45
- die "Could not run system Ruby 1.9.3. No useable Ruby installation found."
46
- fi
47
- RUBY_BIN_SUFFIX="1.9.3"
48
- fi
49
- echo "Ruby 1.9.3 found"
50
- gem$RUBY_BIN_SUFFIX list | grep omf_rc > /dev/null
65
+ # check for distro ruby when no RVM was found
66
+ echo "No system-wide RVM installation detected"
67
+ compare_version `ruby -v | awk -F" p" '{ print $2; }'` 1.9.3
68
+ if [[ $? == 2 ]]; then
69
+ ruby1.9.3 -v | grep 1.9.3 > /dev/null
51
70
  if [[ $? != 0 ]] ; then
52
- die "The omf_rc gem is not installed"
71
+ die "Could not run system Ruby 1.9.3. No suitable Ruby installation found."
53
72
  fi
73
+ RUBY_BIN_SUFFIX="1.9.3"
74
+ fi
75
+ echo "Ruby 1.9.3 + found"
76
+ gem$RUBY_BIN_SUFFIX list | grep omf_rc > /dev/null
77
+ if [[ $? != 0 ]] ; then
78
+ die "The omf_rc gem is not installed"
79
+ fi
54
80
  fi
55
81
 
56
82
  RC=`which omf_rc`
57
83
  if [[ $? != 0 ]] ; then
58
- die "could not find omf_rc executable"
84
+ die "could not find omf_rc executable"
59
85
  fi
60
86
 
61
87
  echo "Running OMF6 RC"
62
- exec /usr/bin/env ruby$RUBY_BIN_SUFFIX $RC -c /etc/omf_rc/config.yml $@
88
+ exec /usr/bin/env ruby$RUBY_BIN_SUFFIX $RC -c /etc/omf_rc/config.yml $@
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omf_rc
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.6.pre.2
5
- prerelease: 6
4
+ version: 6.1.6
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - NICTA
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-09-05 00:00:00.000000000 Z
12
+ date: 2014-09-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
@@ -82,7 +82,7 @@ dependencies:
82
82
  requirements:
83
83
  - - '='
84
84
  - !ruby/object:Gem::Version
85
- version: 6.1.6.pre.2
85
+ version: 6.1.6
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,7 +90,7 @@ dependencies:
90
90
  requirements:
91
91
  - - '='
92
92
  - !ruby/object:Gem::Version
93
- version: 6.1.6.pre.2
93
+ version: 6.1.6
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: cocaine
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -225,9 +225,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
225
225
  required_rubygems_version: !ruby/object:Gem::Requirement
226
226
  none: false
227
227
  requirements:
228
- - - ! '>'
228
+ - - ! '>='
229
229
  - !ruby/object:Gem::Version
230
- version: 1.3.1
230
+ version: '0'
231
+ segments:
232
+ - 0
233
+ hash: -4194814647316536832
231
234
  requirements: []
232
235
  rubyforge_project: omf_rc
233
236
  rubygems_version: 1.8.23