rvm 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. data/lib/VERSION.yml +1 -1
  2. data/lib/rvm/environment.rb +1 -1
  3. data/lib/rvm/shell/shell_wrapper.sh +1 -1
  4. data/rvm.gemspec +3 -110
  5. metadata +4 -111
  6. data/binscripts/rvm +0 -76
  7. data/binscripts/rvm-auto-ruby +0 -24
  8. data/binscripts/rvm-prompt +0 -208
  9. data/binscripts/rvm-shell +0 -35
  10. data/binscripts/rvm-update-head +0 -58
  11. data/binscripts/rvm-update-latest +0 -27
  12. data/binscripts/rvmsudo +0 -20
  13. data/config/db +0 -71
  14. data/config/known +0 -54
  15. data/config/md5 +0 -139
  16. data/contrib/gemset_snapshot +0 -25
  17. data/contrib/install-system-wide +0 -221
  18. data/contrib/r +0 -44
  19. data/examples/rvmrc +0 -49
  20. data/gemsets/default.gems +0 -1
  21. data/gemsets/global.gems +0 -1
  22. data/help/alias +0 -46
  23. data/help/benchmark +0 -17
  24. data/help/cleanup +0 -23
  25. data/help/debug +0 -8
  26. data/help/disk-usage +0 -15
  27. data/help/docs +0 -22
  28. data/help/exec +0 -33
  29. data/help/fetch +0 -5
  30. data/help/gem +0 -0
  31. data/help/gemdir +0 -0
  32. data/help/gemset +0 -14
  33. data/help/implode +0 -0
  34. data/help/info +0 -62
  35. data/help/install +0 -0
  36. data/help/list +0 -0
  37. data/help/migrate +0 -15
  38. data/help/monitor +0 -0
  39. data/help/notes +0 -0
  40. data/help/package +0 -0
  41. data/help/rake +0 -14
  42. data/help/remove +0 -0
  43. data/help/repair +0 -23
  44. data/help/reset +0 -0
  45. data/help/ruby +0 -84
  46. data/help/rubygems +0 -11
  47. data/help/rvmrc +0 -34
  48. data/help/snapshot +0 -15
  49. data/help/specs +0 -0
  50. data/help/srcdir +0 -0
  51. data/help/tests +0 -0
  52. data/help/tools +0 -22
  53. data/help/uninstall +0 -0
  54. data/help/update +0 -0
  55. data/help/upgrade +0 -18
  56. data/help/use +0 -0
  57. data/help/wrapper +0 -41
  58. data/install +0 -667
  59. data/man/man1/rvm.1 +0 -380
  60. data/man/man1/rvm.1.gz +0 -0
  61. data/scripts/alias +0 -226
  62. data/scripts/aliases +0 -4
  63. data/scripts/array +0 -32
  64. data/scripts/base +0 -57
  65. data/scripts/cd +0 -94
  66. data/scripts/cleanup +0 -58
  67. data/scripts/cli +0 -798
  68. data/scripts/color +0 -49
  69. data/scripts/completion +0 -151
  70. data/scripts/db +0 -87
  71. data/scripts/default +0 -64
  72. data/scripts/disk-usage +0 -60
  73. data/scripts/docs +0 -115
  74. data/scripts/env +0 -46
  75. data/scripts/environment-convertor +0 -74
  76. data/scripts/fetch +0 -231
  77. data/scripts/gemsets +0 -1045
  78. data/scripts/get +0 -126
  79. data/scripts/hash +0 -37
  80. data/scripts/help +0 -46
  81. data/scripts/hook +0 -23
  82. data/scripts/info +0 -213
  83. data/scripts/initialize +0 -29
  84. data/scripts/install +0 -667
  85. data/scripts/irbrc +0 -13
  86. data/scripts/irbrc.rb +0 -64
  87. data/scripts/list +0 -315
  88. data/scripts/log +0 -38
  89. data/scripts/maglev +0 -193
  90. data/scripts/manage +0 -2157
  91. data/scripts/match +0 -6
  92. data/scripts/md5 +0 -22
  93. data/scripts/migrate +0 -175
  94. data/scripts/monitor +0 -105
  95. data/scripts/notes +0 -140
  96. data/scripts/override_gem +0 -14
  97. data/scripts/package +0 -302
  98. data/scripts/patches +0 -64
  99. data/scripts/patchsets +0 -87
  100. data/scripts/repair +0 -199
  101. data/scripts/rubygems +0 -157
  102. data/scripts/rvm +0 -128
  103. data/scripts/rvm-install +0 -667
  104. data/scripts/selector +0 -904
  105. data/scripts/set +0 -301
  106. data/scripts/snapshot +0 -262
  107. data/scripts/tools +0 -58
  108. data/scripts/update +0 -667
  109. data/scripts/upgrade +0 -144
  110. data/scripts/utility +0 -1499
  111. data/scripts/version +0 -17
  112. data/scripts/wrapper +0 -210
@@ -1,13 +0,0 @@
1
-
2
- # This loads some niceties for irb, courtesy of rvm.
3
- # It also loads your custom ~/.irbrc if it exists.
4
- # If you want to customize the irbrc for ONLY this version of
5
- # ruby then edit this file. It will only be deleted if you do
6
- # an "rvm install" over this ruby version.
7
-
8
- if ENV["rvm_path"].nil?
9
- require File.join(ENV["HOME"], "irbrc")
10
- else
11
- require File.join(ENV["rvm_path"], "scripts", "irbrc")
12
- end
13
-
@@ -1,64 +0,0 @@
1
- # This is the common irbrc file used by all rvm ruby installations.
2
- # This file will be overriden every time you update rvm.
3
-
4
- # Turn on completion.
5
- begin
6
- require "readline"
7
-
8
- require "irb/completion" rescue nil
9
-
10
- # Turn on history saving.
11
- # require "irb/ext/save-history"
12
- # IRB.conf[:HISTORY_FILE] = File.join(ENV["HOME"], ".irb-history")
13
-
14
- # Use an alternate way to on history saving until save-history is fixed.
15
- #
16
- # bug: http://redmine.ruby-lang.org/issues/show/1556
17
- # patch: http://pastie.org/513500
18
- #
19
- # This technique was adopted from /etc/irbrc on OS X.
20
- histfile = File.expand_path(".irb-history", ENV["HOME"])
21
-
22
- if File.exists?(histfile)
23
- lines = IO.readlines(histfile).collect { |line| line.chomp }
24
- Readline::HISTORY.push(*lines)
25
- end
26
-
27
- Kernel::at_exit do
28
- maxhistsize = 100
29
- histfile = File::expand_path(".irb-history", ENV["HOME"])
30
- lines = Readline::HISTORY.to_a.reverse.uniq.reverse
31
- lines = lines[-maxhistsize, maxhistsize] if lines.compact.length > maxhistsize
32
- File::open(histfile, "w+") { |io| io.puts lines.join("\n") }
33
- end
34
-
35
- rescue LoadError
36
- puts "Readline was unable to be required, if you need completion or history install readline then reinstall the ruby.\nYou may follow 'rvm notes' for dependencies and/or read the docs page http://rvm.beginrescueend.com/packages/readline/ . Be sure you 'rvm remove X ; rvm install X' to re-compile your ruby with readline support after obtaining the readline libraries."
37
- end
38
-
39
- # Calculate the ruby string.
40
- rvm_ruby_string = ENV["rvm_ruby_string"] || `rvm tools identifier`.strip.split("@", 2)[0]
41
-
42
- # Set up the prompt to be RVM specific.
43
- @prompt = {
44
- :PROMPT_I => "#{rvm_ruby_string} > ", # default prompt
45
- :PROMPT_S => "#{rvm_ruby_string}%l> ", # known continuation
46
- :PROMPT_C => "#{rvm_ruby_string} > ",
47
- :PROMPT_N => "#{rvm_ruby_string} ?> ", # unknown continuation
48
- :RETURN => " => %s \n",
49
- :AUTO_INDENT => true
50
- }
51
- IRB.conf[:PROMPT] ||= {}
52
- IRB.conf[:PROMPT][:RVM] = @prompt
53
- IRB.conf[:PROMPT_MODE] = :RVM
54
-
55
- # Load the user's irbrc file, if possible.
56
- # Report any errors that occur.
57
- begin
58
- load File.join(ENV["HOME"], ".irbrc") if File.exists?("#{ENV["HOME"]}/.irbrc")
59
- rescue LoadError => load_error
60
- puts load_error
61
- rescue => exception
62
- puts "Error : 'load #{ENV["HOME"]}/.irbrc' : #{exception.message}"
63
- end
64
-
@@ -1,315 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- rvm_base_except="selector"
4
-
5
- source "$rvm_path/scripts/base"
6
-
7
- usage()
8
- {
9
- printf "
10
- Usage:
11
-
12
- rvm list [action]
13
-
14
- Actions:
15
-
16
- {help,known,gemsets,default [string],rubies,strings,known_strings,ruby_svn_tags}
17
-
18
- "
19
-
20
- return 0
21
- }
22
-
23
- list_gemsets()
24
- {
25
- local all_rubies version versions ruby_version_name current_ruby selected system_ruby system_version string binary
26
-
27
- if [[ "${1:-""}" = "strings" ]]; then
28
- list_gemset_strings
29
- return 0
30
- fi
31
-
32
- current_ruby="$(__rvm_environment_identifier)"
33
-
34
- all_rubies="$(list_strings)"
35
-
36
- printf "\nrvm gemsets\n"
37
-
38
- versions=($(builtin cd "${rvm_gems_path:-"$rvm_path/gems"}/" ; find . -maxdepth 1 -mindepth 1 -type d -print 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}'))
39
-
40
- for version in "${versions[@]//.\/}" ; do
41
-
42
- ruby_version_name="$(echo "$version" | awk -F"${rvm_gemset_separator:-"@"}" '{print $1}')"
43
-
44
- [[ "$all_rubies" != *"$ruby_version_name"* ]] && continue
45
-
46
- if echo "$version" | grep -q '^jruby-' ; then
47
- string="[ $("$rvm_path/rubies/$ruby_version_name/bin/ruby" -v | awk '{print $NF}' | sed -e 's/\[//' -e 's/\]//') ]"
48
-
49
- elif [[ -n "$(echo "$version" | awk '/^maglev-|^macruby-/')" ]] ; then
50
- string="[ x86_64 ]"
51
-
52
- else
53
- string="[ $(file "$rvm_path/rubies/$ruby_version_name/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
54
- fi
55
-
56
- printf "\n"
57
-
58
- if [[ "$version" = "$current_ruby" ]]; then
59
- printf "=> "
60
- else
61
- printf " "
62
- fi
63
-
64
- if [[ ${rvm_pretty_print_flag:-0} -eq 1 ]] ; then
65
-
66
- printf "$(tput setaf 2)$version$(tput sgr0) $string"
67
- else
68
- printf "$version $string"
69
- fi
70
-
71
- done
72
-
73
- if [[ -f "$rvm_path/config/default" && -s "$rvm_path/config/default" ]] ; then
74
-
75
- version=$(grep 'MY_RUBY_HOME' "$rvm_path/config/default" | head -n1 | awk -F"'" '{print $2}' | xargs basename --)
76
-
77
- if [[ -n "$version" ]] ; then
78
-
79
- printf "\nDefault Ruby (for new shells)\n"
80
-
81
- string="[ $(file "$rvm_path/rubies/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
82
-
83
- if [[ ${rvm_pretty_print_flag:-0} -eq 1 ]] ; then
84
-
85
- printf "\n $(tput setaf 2)$version$(tput sgr0) $string\n"
86
- else
87
- printf "\n $version $string\n"
88
- fi
89
-
90
- fi
91
-
92
- fi
93
-
94
- printf "\n\n"
95
-
96
- return 0
97
- }
98
-
99
- list_default()
100
- {
101
-
102
- local version string
103
-
104
- if [[ "${args[0]:-""}" = "string" ]] ; then
105
-
106
- "$rvm_path/scripts/alias" show default 2>/dev/null | awk -F"${rvm_gemset_separator:-"@"}" '{print $1}' | xargs basename --
107
-
108
- else
109
- if [[ -L "$rvm_path/rubies/default" ]]; then
110
-
111
- version=$("$rvm_path/scripts/alias" show default 2>/dev/null | awk -F"${rvm_gemset_separator:-"@"}" '{print $1}' | xargs basename --)
112
-
113
- if [[ -n "$version" ]] ; then
114
-
115
- printf "\nDefault Ruby (for new shells)\n"
116
-
117
- string="[ $(file "$rvm_path/rubies/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
118
-
119
- if [[ ${rvm_pretty_print_flag:-0} -eq 1 ]] ; then
120
-
121
- printf "\n $(tput setaf 2)$version$(tput sgr0) $string\n"
122
-
123
- else
124
- printf "\n $version $string\n"
125
- fi
126
- fi
127
- fi
128
- fi
129
-
130
- printf "\n"
131
-
132
- return 0
133
- }
134
-
135
- list_ruby_svn_tags()
136
- {
137
- local prefix tag
138
-
139
- while read -r tag
140
- do
141
- prefix="$(echo ${tag/\//} | sed 's#^v1_##' | awk -F'_' '{print "(ruby-)1."$1"."$2}' | sed 's#p$##')"
142
-
143
- echo "${prefix}-t${tag/\//}"
144
-
145
- done < <(svn list http://svn.ruby-lang.org/repos/ruby/tags/ | awk '/^v1_[8|9]/')
146
-
147
- return 0
148
- }
149
-
150
- # Query for valid rvm ruby strings
151
- # This is meant to be used with scripting.
152
- list_strings()
153
- {
154
- (
155
- cd "$rvm_path/rubies"
156
-
157
- find . -maxdepth 1 -mindepth 1 -type d | sed -e 's#./##g'
158
- )
159
-
160
- return $?
161
- }
162
-
163
- # This is meant to be used with scripting.
164
- list_gemset_strings()
165
- {
166
- local all_rubies ruby_name gemset gemsets
167
-
168
- all_rubies="$(list_strings)"
169
-
170
- gemsets=($(builtin cd "${rvm_gems_path:-"$rvm_path/gems"}" ; find . -maxdepth 1 -mindepth 1 -type d 2>/dev/null | xargs -n1 basename -- | \grep -v '^\(@\|doc$\|cache$\|system$\)' | sort))
171
-
172
- for gemset in "${gemsets[@]//.\/}" ; do
173
-
174
- ruby_name="${gemset//${rvm_gemset_separator:-"@"}*}"
175
-
176
- [[ "$all_rubies" != *"$ruby_name"* ]] && continue
177
-
178
- echo "$gemset"
179
- done
180
-
181
- return 0
182
- }
183
-
184
- # This is meant to be used with scripting.
185
- list_known_strings()
186
- {
187
- sed -e 's/#.*$//g' -e 's#\[##g' -e 's#\]##g' < "$rvm_path/config/known" | sort -r | uniq
188
-
189
- return $?
190
- }
191
-
192
- list_known()
193
- {
194
- if [[ "${1:-""}" = "strings" ]]; then
195
-
196
- list_known_strings
197
-
198
- return 0
199
- fi
200
-
201
- if [[ ${rvm_interactive_flag:-0} -eq 0 ]] ; then
202
-
203
- cat "$rvm_path/config/known"
204
-
205
- else
206
-
207
- eval "${PAGER:-less -X} '$rvm_path/config/known'"
208
-
209
- fi
210
-
211
- return $?
212
- }
213
-
214
- list_rubies_strings()
215
- {
216
- ( builtin cd "$rvm_path/rubies" ; find -maxdepth 0 -type d | tail -n+2 | xargs -n1 basename -- | __rvm_strip )
217
-
218
- return $?
219
- }
220
-
221
- list_rubies()
222
- {
223
- local current_ruby rubies version selected system_ruby system_version string binary
224
-
225
- if [[ "${1:-""}" = "strings" ]]; then list_rubies_strings ; return 0 ; fi
226
-
227
- current_ruby="$(__rvm_environment_identifier | awk -F"${rvm_gemset_separator:-"@"}" '{print $1}')"
228
-
229
- printf "\nrvm rubies\n"
230
-
231
- rubies=($(builtin cd "$rvm_path/rubies/" ; find . -maxdepth 1 -mindepth 1 -type d 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}'))
232
-
233
- for version in "${rubies[@]//.\/}" ; do
234
-
235
- [[ ! -x "$rvm_path/rubies/$version/bin/ruby" ]] && continue
236
-
237
- if echo "$version" | grep -q '^jruby-' ; then
238
-
239
- string="[ $("$rvm_path/rubies/$version/bin/ruby" -v | awk '{print $NF}' | sed -e 's/\[//' -e 's/\]//') ]"
240
-
241
- elif [[ ! -z "$(echo "$version" | awk '/^maglev-|^macruby-/')" ]] ; then
242
-
243
- string="[ x86_64 ]"
244
-
245
- else
246
-
247
- string="[ $(file "$rvm_path/rubies/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | tr "\n" ' ')]"
248
- fi
249
-
250
- printf "\n"
251
-
252
- if [[ "$version" = "$current_ruby" ]]; then
253
- printf "=> "
254
- else
255
- printf " "
256
- fi
257
-
258
- # TODO: Only use tput for interactive terminal sessions.
259
- if [[ ${rvm_pretty_print_flag:-0} -eq 1 ]] ; then
260
-
261
- printf "$(tput setaf 2)$version$(tput sgr0) $string"
262
- else
263
- printf "$version $string"
264
- fi
265
-
266
- done
267
-
268
- if [[ -f "$rvm_path/config/default" ]] && [[ -s "$rvm_path/config/default" ]] ; then
269
-
270
- version=$(grep 'MY_RUBY_HOME' "$rvm_path/config/default" | head -n 1 | awk -F"'" '{print $2}' | xargs basename --)
271
-
272
- if [[ -n "$version" ]] ; then
273
-
274
- printf "Default Ruby (for new shells)\n"
275
-
276
- string="[ $(file "$rvm_path/rubies/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
277
-
278
- if [[ ${rvm_pretty_print_flag:-0} -eq 1 ]] ; then
279
- printf " $(tput setaf 2)$version$(tput sgr0) $string\n"
280
- else
281
- printf " $version $string\n"
282
- fi
283
-
284
- fi
285
-
286
- fi
287
-
288
- printf "\n\n"
289
-
290
- return 0
291
- }
292
-
293
- # List all rvm installed rubies, default ruby and system ruby.
294
- # Display the rubies, indicate their architecture and indicate which is currently used.
295
- # This is not meant to be used with scripting. This is for interactive mode usage only.
296
- args=($*)
297
- action="${args[0]:-""}"
298
- args=${args[@]:1} # Strip trailing / leading / extra spacing.
299
-
300
-
301
- if [[ -z "$action" ]] ; then list_rubies ; exit 0 ; fi
302
-
303
- case "$action" in
304
- known) list_known ;;
305
- known_strings) list_known_strings ;;
306
- gemsets) list_gemsets "$args" ;;
307
- default) list_default ;;
308
- rubies) list_rubies "$args" ;;
309
- strings) list_strings ;;
310
- ruby_svn_tags) list_ruby_svn_tags ;;
311
- help) usage ;;
312
- *) usage ; exit 1 ;;
313
- esac
314
-
315
- exit $?
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # When rvm_silence_logging is set, don't show anything.
4
- [[ -n "$rvm_silence_logging" ]] && exit 0
5
-
6
- if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi
7
-
8
- if [[ ! -z "$2" ]] ; then level=$1 ; shift ; else level="info" ; fi
9
-
10
- message="${1//\%/%%}"
11
-
12
- if [[ ${rvm_pretty_print_flag:-0} -eq 0 ]] ; then
13
-
14
- if [[ ${rvm_verbose_flag:-0} -gt 0 && -n "$level" ]] ; then
15
- message="$level: $message"
16
- fi
17
-
18
- case "$level" in
19
- info) printf -- "${message#*: }\n" ;;
20
- debug|warn) printf -- "$message\n" ;;
21
- error|fail) printf -- "$message\n" >&2 ;;
22
- *) printf "$message\n"
23
- esac
24
-
25
- else
26
-
27
- case "$level" in
28
- debug) printf -- "$(tput setaf 5)$level$(tput sgr0): $message\n" ;;
29
- info) printf -- "$(tput setaf 2)$level$(tput sgr0): $message\n" ;;
30
- warn) printf -- "$(tput setaf 3)$level$(tput sgr0): $message\n" ;;
31
- error) printf -- "$(tput setaf 1)$level$(tput sgr0): $message\n" >&2 ;;
32
- fail) printf -- "$(tput setaf 1)$level$(tput sgr0): $message\n" >&2 ;;
33
- *) printf -- "$message\n"
34
- esac
35
-
36
- fi
37
-
38
- exit 0
@@ -1,193 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi
4
-
5
- system="$(uname -s)"
6
- if [[ $system = "SunOS" ]] && [[ "$(uname -m)" = "i86pc" ]] ; then system="Solaris-x86" ; fi
7
- version="MagLev-${1}.${system}"
8
- gsname="GemStone-${1}.${system}"
9
- zipfile=${version}.zip
10
-
11
- # Check we're on a suitable 64-bit machine
12
- case "$system" in
13
- Linux)
14
- if [[ "$(uname -sm)" != "Linux x86_64" ]]; then
15
- "$rvm_path/scripts/log" "error" "This script only works on a 64-bit Linux OS."
16
- echo "The result from \"uname -sm\" is \"`uname -sm`\" not \"Linux x86_64\""
17
- exit 1
18
- fi
19
- ;;
20
- Darwin)
21
- system_version="$(sw_vers -productVersion)"
22
- MAJOR="$(echo $system_version | cut -f1 -d.)"
23
- MINOR="$(echo $system_version | cut -f2 -d.)"
24
- CPU_TYPE="$(uname -p)"
25
- CPU_CAPABLE="$(sysctl hw.cpu64bit_capable | cut -f2 -d' ')"
26
- #
27
- # Check the CPU and Mac OS profile.
28
- if [[ $CPU_TYPE != "i386" || $CPU_CAPABLE -ne 1 || $MAJOR -lt 10 || $MINOR -lt 5 ]] ; then
29
- "$rvm_path/scripts/log" "error" "This script requires Mac OS 10.5 or later on a 64-bit Intel CPU."
30
- exit 1
31
- fi
32
- ;;
33
- Solaris-x86)
34
- if [[ "$(uname -sm)" != "SunOS i86pc" ]]; then
35
- "$rvm_path/scripts/log" "error" "This script only works on a 64-bit Solaris-x86 OS."
36
- echo "The result from \"uname -sm\" is \"`uname -sm`\" not \"SunOS i86pc\""
37
- exit 1
38
- fi
39
- ;;
40
- *)
41
- "$rvm_path/scripts/log" "error" "This script only works on a 64-bit Linux, Mac OS X, or Solaris-x86 machine"
42
- echo "The result from \"uname -sm\" is \"`uname -sm`\""
43
- exit 1
44
- ;;
45
- esac
46
-
47
- # We should run this as a normal user, not root.
48
- if [[ `id | cut -f2 -d= | cut -f1 -d\(` -eq 0 ]]; then
49
- "$rvm_path/scripts/log" "error" "This script should be run as a normal user, not root."
50
- exit 1
51
- fi
52
-
53
- # Check that the current directory is writable
54
- if [[ ! -w "." ]]; then
55
- "$rvm_path/scripts/log" "error" "This script requires write permission on your current directory."
56
- \ls -ld $PWD
57
- exit 1
58
- fi
59
-
60
- # We're good to go. Let user know.
61
- machine_name="`uname -n`"
62
- "$rvm_path/scripts/log" "info" "Starting installation of $version on $machine_name"
63
-
64
- # Figure out how much total memory is installed
65
- "$rvm_path/scripts/log" "info" "Setting up shared memory"
66
- #
67
- # Ref: http://wiki.finkproject.org/index.php/Shared_Memory_Regions_on_Darwin
68
- # Ref: http://developer.postgresql.org/pgdocs/postgres/kernel-resources.html
69
- # Ref: http://www.idevelopment.info/data/Oracle/DBA_tips/Linux/LINUX_8.shtml
70
- #
71
- case "$system" in
72
- Linux)
73
- # use TotalMem: kB because Ubuntu doesn't have Mem: in Bytes
74
- totalMemKB=`awk '/MemTotal:/{print($2);}' /proc/meminfo`
75
- totalMem=$(($totalMemKB * 1024))
76
- # Figure out the max shared memory segment size currently allowed
77
- shmmax=`cat /proc/sys/kernel/shmmax`
78
- # Figure out the max shared memory currently allowed
79
- shmall=`cat /proc/sys/kernel/shmall`
80
- ;;
81
- Darwin)
82
- totalMem="`sysctl hw.memsize | cut -f2 -d' '`"
83
- # Figure out the max shared memory segment size currently allowed
84
- shmmax="`sysctl kern.sysv.shmmax | cut -f2 -d' '`"
85
- # Figure out the max shared memory currently allowed
86
- shmall="`sysctl kern.sysv.shmall | cut -f2 -d' '`"
87
- ;;
88
- Solaris-x86)
89
- # TODO: figure memory needs for Solaris-x86
90
- # Investigate project.max-shm-memory
91
- totalMemMB="`/usr/sbin/prtconf | \grep Memory | cut -f3 -d' '`"
92
- totalMem=$(($totalMemMB * 1048576))
93
- shmmax=$(($totalMem / 4))
94
- shmall=$(($shmmax / 4096))
95
- ;;
96
- *)
97
- "$rvm_path/scripts/log" "error" "Can't determine operating system. Check script."
98
- exit 1
99
- ;;
100
- esac
101
- totalMemMB=$(($totalMem / 1048576))
102
- shmmaxMB=$(($shmmax / 1048576))
103
- shmallMB=$(($shmall / 256))
104
-
105
- # Print current values
106
- echo " Total memory available is $totalMemMB MB"
107
- echo " Max shared memory segment size is $shmmaxMB MB"
108
- echo " Max shared memory allowed is $shmallMB MB"
109
-
110
- # Figure out the max shared memory segment size (shmmax) we want
111
- # Use 75% of available memory but not more than 2GB
112
- shmmaxNew=$(($totalMem * 3/4))
113
- [[ $shmmaxNew -gt 2147483648 ]] && shmmaxNew=2147483648
114
- shmmaxNewMB=$(($shmmaxNew / 1048576))
115
-
116
- # Figure out the max shared memory allowed (shmall) we want
117
- # The Darwin (OSX) default is 4MB, way too small
118
- # The Linux default is 2097152 or 8GB, so we should never need this
119
- # but things will certainly break if it's been reset too small
120
- # so ensure it's at least big enough to hold a fullsize shared memory segment
121
- shmallNew=$(($shmmaxNew / 4096))
122
- [[ $shmallNew -lt $shmall ]] && shmallNew=$shmall
123
- shmallNewMB=$(($shmallNew / 256))
124
-
125
- # Increase shmmax if appropriate
126
- if [[ $shmmaxNew -gt $shmmax ]]; then
127
- "$rvm_path/scripts/log" "info" "Increasing max shared memory segment size to $shmmaxNewMB MB"
128
- [[ $system = "Darwin" ]] && sudo sysctl -w kern.sysv.shmmax=$shmmaxNew
129
- [[ $system = "Linux" ]] && sudo bash -c "echo $shmmaxNew > /proc/sys/kernel/shmmax"
130
- [[ $system = "Solaris-x86" ]] && echo "[[Warning]] shmmax must be set manually on Solaris-x86"
131
- else
132
- "$rvm_path/scripts/log" "info" "No need to increase max shared memory segment size"
133
- fi
134
-
135
- # Increase shmall if appropriate
136
- if [[ $shmallNew -gt $shmall ]]; then
137
- "$rvm_path/scripts/log" "info" "Increasing max shared memory allowed to $shmallNewMB MB"
138
- [[ $system = "Darwin" ]] && sudo sysctl -w kern.sysv.shmall=$shmallNew
139
- [[ $system = "Linux" ]] && sudo bash -c "echo $shmallNew > /proc/sys/kernel/shmall"
140
- [[ $system = "Solaris-x86" ]] && echo "[[Warning]]shmall must be set manually on Solaris-x86"
141
- else
142
- "$rvm_path/scripts/log" "info" "No need to increase max shared memory allowed"
143
- fi
144
-
145
- # At this point, shared memory settings contain the values we want,
146
- # put them in sysctl.conf so they are preserved.
147
- if [[ ! -f /etc/sysctl.conf ]] || [[ "$(\grep -sc "kern.*.shm" /etc/sysctl.conf)" -eq 0 ]] ; then
148
- case "$system" in
149
- Linux)
150
- echo "# kernel.shm* settings added by MagLev installation" > /tmp/sysctl.conf.$$
151
- echo "kernel.shmmax=$(cat /proc/sys/kernel/shmmax)" >> /tmp/sysctl.conf.$$
152
- echo "kernel.shmall=$(cat /proc/sys/kernel/shmall)" >> /tmp/sysctl.conf.$$
153
- ;;
154
- Darwin)
155
- # On Mac OS X Leopard, you must have all five settings in sysctl.conf
156
- # before they will take effect.
157
- echo "# kern.sysv.shm* settings added by MagLev installation" > /tmp/sysctl.conf.$$
158
- sysctl kern.sysv.shmmax kern.sysv.shmall kern.sysv.shmmin kern.sysv.shmmni \
159
- kern.sysv.shmseg | \tr ":" "=" | \tr -d " " >> /tmp/sysctl.conf.$$
160
- ;;
161
- Solaris-x86)
162
- # Do nothing in Solaris-x86 since /etc/sysctl.conf is ignored on Solaris 10.
163
- # Must configure shared memory settings manually.
164
- ;;
165
- *)
166
- "$rvm_path/scripts/log" "error" "Can't determine operating system. Check script."
167
- exit 1
168
- ;;
169
- esac
170
- # Do nothing on Solaris-x86 since /etc/sysctl.conf is ignored on Solaris 10.
171
- if [[ "$system" != "Solaris-x86" ]]; then
172
- "$rvm_path/scripts/log" "info" "Adding the following section to /etc/sysctl.conf"
173
- cat /tmp/sysctl.conf.$$
174
- sudo bash -c "cat /tmp/sysctl.conf.$$ >> /etc/sysctl.conf"
175
- /bin/rm -f /tmp/sysctl.conf.$$
176
- fi
177
- else
178
- "$rvm_path/scripts/log" "info" "The following shared memory settings already exist in /etc/sysctl.conf"
179
- echo "To change them, remove the following lines from /etc/sysctl.conf and rerun this script"
180
- \grep "kern.*.shm" /etc/sysctl.conf
181
- fi
182
-
183
- # Now setup for NetLDI in case we ever need it.
184
- "$rvm_path/scripts/log" "info" "Setting up GemStone netldi service port"
185
- if [[ $(\grep -sc "^gs64ldi" /etc/services) -eq 0 ]]; then
186
- echo '[[Info]] Adding "gs64ldi 50378/tcp" to /etc/services'
187
- sudo bash -c 'echo "gs64ldi 50378/tcp # Gemstone netldi" >> /etc/services'
188
- else
189
- "$rvm_path/scripts/log" "info" "GemStone netldi service port is already set in /etc/services"
190
- echo "To change it, remove the following line from /etc/services and rerun this script"
191
- \grep "^gs64ldi" /etc/services
192
- fi
193
-