rvm 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,23 +4,22 @@ source "$rvm_scripts_path/base"
4
4
 
5
5
  rvm_help_path="${rvm_help_path:-"$rvm_path/help"}"
6
6
 
7
- command="$(echo $* | awk '{print $1}')"
8
- action="$(echo $* | awk '{print $2}')"
9
- # Reserved for future use:
10
- args=$(echo "$*" | awk '{$1=""; $2="" ; print}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
7
+ command="$1" ; shift
8
+ action="$1" ; shift
9
+ args="$(echo $*) " # Strip trailing / leading / extra spacing.
11
10
 
12
11
  if [[ ! -z "$command" ]] && [[ -s "${rvm_help_path}/${command}" ]] ; then
13
12
  if [[ ! -z "$action" ]] && [[ -s "${rvm_help_path}/${command}/${action}" ]] ; then
14
- ${PAGER:-less} "${rvm_help_path}/${command}/${action}"
13
+ "${PAGER:-less}" "${rvm_help_path}/${command}/${action}"
15
14
  else
16
- ${PAGER:-less} "${rvm_help_path}/${command}"
15
+ "${PAGER:-less}" "${rvm_help_path}/${command}"
17
16
  fi
18
17
  else
19
- ${PAGER:-less} "${rvm_path:-$HOME/.rvm}/README"
20
- $rvm_scripts_path/log "info" "Commands available with 'rvm help':\n\n $(builtin cd "${rvm_help_path}" ; \ls | \tr "\n" ' ')"
18
+ "${PAGER:-less}" "${rvm_path:-$HOME/.rvm}/README"
19
+ "$rvm_scripts_path/log" "info" "Commands available with 'rvm help':\n\n $(builtin cd "${rvm_help_path}" ; \ls | \tr "\n" ' ')"
21
20
  fi
22
21
 
23
- $rvm_scripts_path/log "info" "For additional information please visit RVM's documentation website:\n\n http://rvm.beginrescueend.com/"
24
- $rvm_scripts_path/log "info" "If you still cannot find what an answer to your question, find me 'wayneeseguin' in #rvm on irc.freenode.net:\n\n http://webchat.freenode.net/?channels=rvm\n"
22
+ "$rvm_scripts_path/log" "info" "For additional information please visit RVM's documentation website:\n\n http://rvm.beginrescueend.com/"
23
+ "$rvm_scripts_path/log" "info" "If you still cannot find what an answer to your question, find me 'wayneeseguin' in #rvm on irc.freenode.net:\n\n http://webchat.freenode.net/?channels=rvm\n"
25
24
 
26
25
  exit $?
@@ -2,7 +2,9 @@
2
2
 
3
3
  if [[ ! -z "$rvm_hook" ]] ; then
4
4
  if [[ -s "$rvm_hooks_path/$rvm_hook" ]] ; then
5
- if [[ "$rvm_verbose_flag" -eq 1 ]] || [[ "$rvm_debug_flag" -eq 1 ]] ; then $rvm_scripts_path/log "info" "running hook $rvm_hook" ; fi
5
+ if [[ "$rvm_verbose_flag" -eq 1 ]] || [[ "$rvm_debug_flag" -eq 1 ]] ; then
6
+ "$rvm_scripts_path/log" "info" "running hook $rvm_hook"
7
+ fi
6
8
  source "$rvm_hooks_path/$rvm_hook"
7
9
  fi
8
10
  fi ; unset rvm_hook
@@ -76,7 +76,7 @@ info_environment() {
76
76
 
77
77
  info_debug() {
78
78
  rvm_info=$(__rvm_version)
79
- rvm_info="$rvm_info\n$($rvm_scripts_path/info "$rvm_ruby_string" "" )"
79
+ rvm_info="$rvm_info\n$("$rvm_scripts_path/info" "$rvm_ruby_string" "" )"
80
80
  rvm_info="$rvm_info\nPATH:\n$(printf $PATH | awk -F":" '{print $1":"$2":"$3":"$4":"$5}' )"
81
81
  rvm_info="$rvm_info\nuname -a: $(uname -a)"
82
82
  rvm_info="$rvm_info\npermissions: $(\ls -la $rvm_path{,/rubies})"
@@ -113,17 +113,19 @@ info_debug() {
113
113
  }
114
114
 
115
115
  info_sections() {
116
- for section in $(echo $sections | \tr ',' ' ') ; do
116
+ for section in $(printf "${sections//,/ }") ; do
117
117
  unset rvm_info ; "info_${section}" ; printf "$rvm_info"
118
118
  done
119
119
  }
120
120
 
121
121
  args="$*"
122
- ruby_strings="$(echo "$args" | awk '{print $1}')"
123
- sections=$(echo "$args" | awk '{$1="" ; print}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
122
+ ruby_strings="${args/ */}"
123
+ sections="${args#* }"
124
+ sections="${sections#"${sections%%[![:space:]]*}"}" # strip leading whitespace
125
+ sections="${sections%"${sections##*[![:space:]]}"}" # strip trailing whitespace
124
126
  all_sections="system rvm ruby homes binaries environment"
125
127
 
126
- if $rvm_scripts_path/match "$all_sections debug" "${ruby_strings/,*/}" ; then
128
+ if "$rvm_scripts_path/match" "$all_sections debug" "${ruby_strings/,*/}" ; then
127
129
  sections="$ruby_strings"
128
130
  ruby_strings=""
129
131
  fi
@@ -134,7 +136,7 @@ if [[ -z "$ruby_strings" ]] ; then
134
136
  printf "$(__rvm_environment_identifier):\n"
135
137
  info_sections
136
138
  else
137
- for ruby_string in $(printf $ruby_strings | \tr ',' ' ') ; do
139
+ for ruby_string in $(printf ${ruby_strings//,/ }) ; do
138
140
  __rvm_become "$ruby_string"
139
141
  printf "$(__rvm_environment_identifier):\n"
140
142
  info_sections
@@ -76,7 +76,7 @@ if [[ -z "$rvm_path" ]] ; then rvm_path="${rvm_prefix}rvm" ; fi
76
76
 
77
77
  source scripts/initialize
78
78
 
79
- if \grep -q 'scripts/rvm' $HOME/.bash* 2>/dev/null || \grep -q 'scripts/rvm' $HOME/.zsh* 2>/dev/null; then
79
+ if \grep -q 'scripts/rvm' "$HOME"/.bash* 2>/dev/null || \grep -q 'scripts/rvm' "$HOME"/.zsh* 2>/dev/null; then
80
80
  if [[ -d "$rvm_path" ]] && [[ -s "${rvm_path}/scripts/rvm" ]] ; then
81
81
  export upgrade_flag=1
82
82
  else
@@ -93,7 +93,7 @@ __rvm_initialize
93
93
  #
94
94
  item="$(tput setaf 2)* $(tput sgr0)"
95
95
  question="\n$(tput setaf 2)<?>$(tput sgr0)"
96
- cwd=$PWD
96
+ cwd="$PWD"
97
97
  source_path="${source_path:-$cwd}"
98
98
  rvm_archives_path="${rvm_archives_path:-"$rvm_path/archives"}"
99
99
  rvm_src_path="${rvm_src_path:-"$rvm_path/src"}"
@@ -151,7 +151,7 @@ done ; unset dir_name
151
151
  spinner
152
152
  if [[ ! -s "$rvm_config_path/user" ]] ; then
153
153
  \mkdir -p "$rvm_config_path/"
154
- echo '# Users settings file, overrides db file settings and persists across installs.' >> $rvm_config_path/user
154
+ echo '# Users settings file, overrides db file settings and persists across installs.' >> "$rvm_config_path/user"
155
155
  fi
156
156
 
157
157
  scripts=("monitor" "match" "log" "install" "color" "db" "fetch" "log" "set" "package")
@@ -170,7 +170,7 @@ for file in rvm-prompt rvm rvmsudo rvm-shell rvm-auto-ruby ; do
170
170
  \cp -f "$source_path/binscripts/$file" $rvm_bin_path/
171
171
  done
172
172
  spinner
173
- chmod +x $rvm_bin_path/*
173
+ chmod +x "$rvm_bin_path"/*
174
174
 
175
175
  #
176
176
  # RC Files
@@ -179,17 +179,17 @@ spinner
179
179
  if [[ -n "$rvm_auto_flag" ]] ; then
180
180
  printf "Checking rc files... ($rvm_rc_files)"
181
181
  if [[ "$rvm_loaded_flag" != "1" ]] ; then
182
- for rcfile in $(echo $rvm_rc_files) ; do
182
+ for rcfile in $(printf $rvm_rc_files) ; do
183
183
  if [[ ! -f $rcfile ]] ; then \touch $rcfile ; fi
184
184
  if [[ -s "$HOME/.profile" ]] ; then
185
185
  if ! \grep -q '.profile' "$rcfile" ; then
186
186
  echo " Adding 'if [[ -s \$HOME/.profile ]] ; then source \$HOME ; fi' to $rcfile."
187
- printf "\n# rvm-install added line:\nif [[ -s \$HOME/.profile ]] ; then source \$HOME/.profile ; fi\n" >> $rcfile
187
+ printf "\n# rvm-install added line:\nif [[ -s \$HOME/.profile ]] ; then source \$HOME/.profile ; fi\n" >> "$rcfile"
188
188
  fi
189
189
  fi
190
190
  if ! \grep -q "scripts\/rvm" "$rcfile" ; then
191
191
  echo " Adding 'if [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi' to $rcfile."
192
- printf "\n# rvm-install added:\nif [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi\n" >> $rcfile
192
+ printf "\n# rvm-install added:\nif [[ -s $rvm_scripts_path/rvm ]] ; then source $rvm_scripts_path/rvm ; fi\n" >> "$rcfile"
193
193
  fi
194
194
  done
195
195
  fi
@@ -254,26 +254,27 @@ done
254
254
  spinner
255
255
  printf "\r*" # Stop spinner.
256
256
 
257
- for gemset in $rvm_path/gems/*\%* ; do
257
+ for gemset in "$rvm_path"/gems/*\%* ; do
258
258
  new_path=${gemset/\%/${rvm_gemset_separator}}
259
259
  if [[ -d "$gemset" ]] && [[ ! -d "$new_path" ]] ; then
260
- printf "\n Renaming $(basename $gemset) to $(basename $new_path) for new gemset separator."
261
- mv $gemset $new_path
260
+ printf "\n Renaming $(basename "$gemset") to $(basename "$new_path") for new gemset separator."
261
+ mv "$gemset" "$new_path"
262
262
  fi
263
263
  done
264
264
 
265
- for gemset in $rvm_path/gems/*\+* ; do
265
+ for gemset in "$rvm_path"/gems/*\+* ; do
266
266
  new_path=${gemset/\+/${rvm_gemset_separator}}
267
267
  if [[ -d "$gemset" ]] && [[ ! -d "$new_path" ]] ; then
268
- printf "\n Renaming $(basename $gemset) to $(basename $new_path) for new gemset separator."
268
+ printf "\n Renaming $(basename "$gemset") to $(basename "$new_path") for new gemset separator."
269
269
  mv $gemset $new_path
270
270
  fi
271
271
  done
272
- for gemset in $rvm_path/gems/*\@ ; do
272
+
273
+ for gemset in "$rvm_path"/gems/*\@ ; do
273
274
  new_path=$(echo $gemset | sed -e 's#\@$##')
274
275
  if [[ -d "$gemset" ]] && [[ ! -d "$new_path" ]] ; then
275
- printf "\n Fixing: $(basename $gemset) to $(basename $new_path) for new gemset separator."
276
- mv $gemset $new_path
276
+ printf "\n Fixing: $(basename "$gemset") to $(basename "$new_path") for new gemset separator."
277
+ mv "$gemset" "$new_path"
277
278
  fi
278
279
  done
279
280
 
@@ -281,18 +282,16 @@ done
281
282
  if [[ -s "$rvm_config_path/default" ]]; then
282
283
  original_version="$(basename "$(\grep GEM_HOME "$rvm_config_path/default" | awk -F"'" '{print $2}' | sed "s#\%#${rvm_gemset_separator}#")")"
283
284
  if [[ -n "$original_version" ]]; then
284
- $rvm_scripts_path/alias create default "$original_version" &> /dev/null
285
- fi
286
- unset original_version
285
+ "$rvm_scripts_path/alias" create default "$original_version" &> /dev/null
286
+ fi ; unset original_version
287
287
  \rm -rf "$rvm_config_path/default"
288
288
  fi
289
289
 
290
290
  #
291
291
  # End of gemset migration.
292
292
  #
293
-
294
293
  printf "\n Correct permissions for base binaries in $rvm_bin_path..."
295
- \mkdir -p $rvm_bin_path
294
+ \mkdir -p "$rvm_bin_path"
296
295
  for file in rvm rvmsudo rvm-shell rvm-auto-ruby; do
297
296
  [[ -s "$rvm_bin_path/$file" ]] && chmod +x "$rvm_bin_path/$file"
298
297
  done; unset file
@@ -14,17 +14,18 @@ list_gemsets() {
14
14
  local all_rubies="$(list_strings)"
15
15
 
16
16
  printf "rvm gemsets\n"
17
- for version in $(\ls $rvm_gems_path/ 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}') ; do
17
+ for version in $(\ls "$rvm_gems_path/" 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}') ; do
18
18
  ruby_version_name="$(echo "$version" | awk -F"$rvm_gemset_separator" '{print $1}')"
19
+
19
20
  [[ "$all_rubies" != *"$ruby_version_name"* ]] && continue
20
- if [[ -n "$(echo $version | awk '/^jruby-/')" ]] ; then
21
- string="[ $($rvm_rubies_path/$ruby_version_name/bin/ruby -v | awk '{print $NF}' | sed -e 's/\[//' -e 's/\]//') ]"
22
- elif [[ -n "$(echo $version | awk '/^maglev-|^macruby-/')" ]] ; then
21
+
22
+ if echo "$version" | \grep -q '^jruby-' ; then
23
+ string="[ $("$rvm_rubies_path/$ruby_version_name/bin/ruby" -v | awk '{print $NF}' | sed -e 's/\[//' -e 's/\]//') ]"
24
+ elif [[ -n "$(echo "$version" | awk '/^maglev-|^macruby-/')" ]] ; then
23
25
  string="[ x86_64 ]"
24
26
  else
25
- string="[ $(file $rvm_rubies_path/$ruby_version_name/bin/ruby | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
26
- fi
27
- unset ruby_version_name
27
+ string="[ $(file "$rvm_rubies_path/$ruby_version_name/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
28
+ fi ; unset ruby_version_name
28
29
  printf "\n"
29
30
  if [[ "$version" = "$current_ruby" ]]; then
30
31
  printf "=> "
@@ -34,29 +35,26 @@ list_gemsets() {
34
35
  printf "$(tput setaf 2)$version$(tput sgr0) $string"
35
36
  done ; unset version
36
37
 
37
- if [[ -f "$rvm_config_path/default" ]] && [[ -s $rvm_config_path/default ]] ; then
38
- version=$(\grep 'MY_RUBY_HOME' $rvm_config_path/default | head -n1 | awk -F"'" '{print $2}' | xargs basename --)
38
+ if [[ -f "$rvm_config_path/default" ]] && [[ -s "$rvm_config_path/default" ]] ; then
39
+ version=$(\grep 'MY_RUBY_HOME' "$rvm_config_path/default" | head -n1 | awk -F"'" '{print $2}' | xargs basename --)
39
40
  if [[ ! -z "$version" ]] ; then
40
41
  printf "\n\nDefault Ruby (for new shells)\n"
41
- string="[ $(file $rvm_rubies_path/$version/bin/ruby | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
42
+ string="[ $(file "$rvm_rubies_path/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
42
43
  printf "\n $(tput setaf 2)$version$(tput sgr0) $string"
43
44
  fi ; unset version
44
- fi
45
- printf "\n"
46
-
47
- unset current_ruby version selected system_ruby system_version string binary
48
- echo
45
+ fi ; unset current_ruby version selected system_ruby system_version string binary
46
+ printf "\n\n"
49
47
  }
50
48
 
51
49
  list_default() {
52
50
  if [[ "$1" = "string" ]] ; then
53
- $rvm_scripts_path/alias show default 2>/dev/null | awk -F"$rvm_gemset_separator" '{print $1}' | xargs basename --
51
+ "$rvm_scripts_path/alias" show default 2>/dev/null | awk -F"$rvm_gemset_separator" '{print $1}' | xargs basename --
54
52
  else
55
53
  if [[ -L "$rvm_rubies_path/default" ]]; then
56
- version=$($rvm_scripts_path/alias show default 2>/dev/null | awk -F"$rvm_gemset_separator" '{print $1}' | xargs basename --)
54
+ version=$("$rvm_scripts_path/alias" show default 2>/dev/null | awk -F"$rvm_gemset_separator" '{print $1}' | xargs basename --)
57
55
  if [[ ! -z "$version" ]] ; then
58
56
  printf "\n\nDefault Ruby (for new shells)\n"
59
- string="[ $(file $rvm_rubies_path/$version/bin/ruby | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
57
+ string="[ $(file "$rvm_rubies_path/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
60
58
  printf "\n $(tput setaf 2)$version$(tput sgr0) $string\n"
61
59
  fi ; unset version
62
60
  fi
@@ -75,13 +73,13 @@ list_ruby_svn_tags() {
75
73
  # Query for valid rvm ruby strings
76
74
  # This is meant to be used with scripting.
77
75
  list_strings() {
78
- echo $(\ls $rvm_rubies_path)
76
+ \ls "$rvm_rubies_path"
79
77
  }
80
78
 
81
79
  # This is meant to be used with scripting.
82
80
  list_gemset_strings() {
83
81
  local all_rubies="$(list_strings)"
84
- for gemset in $(\ls $rvm_gems_path/ 2>/dev/null | xargs -n1 basename -- | \grep -v '^\(@\|doc$\|cache$\|system$\)' | sort); do
82
+ for gemset in $(\ls "$rvm_gems_path/" 2>/dev/null | xargs -n1 basename -- | \grep -v '^\(@\|doc$\|cache$\|system$\)' | sort); do
85
83
  local ruby_name="$(echo "$gemset" | awk -F$rvm_gemset_separator '{print $1}')"
86
84
  [[ "$all_rubies" != *"$ruby_name"* ]] && continue
87
85
  echo "$gemset"
@@ -113,23 +111,18 @@ list_rubies_strings() {
113
111
 
114
112
  list_rubies() {
115
113
 
116
- if [[ "$1" = "strings" ]]; then
117
- list_rubies_strings
118
- return 0
119
- fi
120
-
121
- echo
114
+ if [[ "$1" = "strings" ]]; then list_rubies_strings ; return 0 ; fi
122
115
 
123
116
  current_ruby="$(__rvm_environment_identifier | awk -F"$rvm_gemset_separator" '{print $1}')"
124
117
 
125
- printf "rvm rubies\n"
126
- for version in $(\ls $rvm_rubies_path/ 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}') ; do
127
- if [[ ! -z "$(echo $version | awk '/^jruby-/')" ]] ; then
128
- string="[ $($rvm_rubies_path/$version/bin/ruby -v | awk '{print $NF}' | sed -e 's/\[//' -e 's/\]//') ]"
129
- elif [[ ! -z "$(echo $version | awk '/^maglev-|^macruby-/')" ]] ; then
118
+ printf "\nrvm rubies\n"
119
+ for version in $(\ls "$rvm_rubies_path/" 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}') ; do
120
+ if echo "$version" | \grep -q '^jruby-' ; then
121
+ string="[ $("$rvm_rubies_path/$version/bin/ruby" -v | awk '{print $NF}' | sed -e 's/\[//' -e 's/\]//') ]"
122
+ elif [[ ! -z "$(echo "$version" | awk '/^maglev-|^macruby-/')" ]] ; then
130
123
  string="[ x86_64 ]"
131
124
  else
132
- string="[ $(file $rvm_rubies_path/$version/bin/ruby | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
125
+ string="[ $(file "$rvm_rubies_path/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
133
126
  fi
134
127
  printf "\n"
135
128
  if [[ "$version" = "$current_ruby" ]]; then
@@ -137,21 +130,19 @@ list_rubies() {
137
130
  else
138
131
  printf " "
139
132
  fi
133
+ # TODO: Only use tput for interactive terminal sessions.
140
134
  printf "$(tput setaf 2)$version$(tput sgr0) $string"
141
135
  done ; unset version
142
136
 
143
- if [[ -f "$rvm_config_path/default" ]] && [[ -s $rvm_config_path/default ]] ; then
144
- version=$(\grep 'MY_RUBY_HOME' $rvm_config_path/default | head -n 1 | awk -F"'" '{print $2}' | xargs basename --)
137
+ if [[ -f "$rvm_config_path/default" ]] && [[ -s "$rvm_config_path/default" ]] ; then
138
+ version=$(\grep 'MY_RUBY_HOME' "$rvm_config_path/default" | head -n 1 | awk -F"'" '{print $2}' | xargs basename --)
145
139
  if [[ ! -z "$version" ]] ; then
146
140
  printf "\n\nDefault Ruby (for new shells)\n"
147
- string="[ $(file $rvm_rubies_path/$version/bin/ruby | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
141
+ string="[ $(file "$rvm_rubies_path/$version/bin/ruby" | awk '/x86.64/ {print "x86_64"} /386/ {print "i386"} /ppc/ {print "ppc"}' | \tr "\n" ' ')]"
148
142
  printf "\n $(tput setaf 2)$version$(tput sgr0) $string"
149
143
  fi ; unset version
150
- fi
151
- printf "\n"
152
-
153
- unset current_ruby version selected system_ruby system_version string binary
154
- echo
144
+ fi ; unset current_ruby version selected system_ruby system_version string binary
145
+ printf "\n\n"
155
146
  }
156
147
 
157
148
  # List all rvm installed rubies, default ruby and system ruby.
@@ -12,7 +12,7 @@ zipfile=${version}.zip
12
12
  case "$system" in
13
13
  Linux)
14
14
  if [[ "$(uname -sm)" != "Linux x86_64" ]]; then
15
- $rvm_scripts_path/log "error" "This script only works on a 64-bit Linux OS."
15
+ "$rvm_scripts_path/log" "error" "This script only works on a 64-bit Linux OS."
16
16
  echo "The result from \"uname -sm\" is \"`uname -sm`\" not \"Linux x86_64\""
17
17
  exit 1
18
18
  fi
@@ -26,19 +26,19 @@ case "$system" in
26
26
  #
27
27
  # Check the CPU and Mac OS profile.
28
28
  if [[ $CPU_TYPE != "i386" || $CPU_CAPABLE -ne 1 || $MAJOR -lt 10 || $MINOR -lt 5 ]] ; then
29
- $rvm_scripts_path/log "error" "This script requires Mac OS 10.5 or later on a 64-bit Intel CPU."
29
+ "$rvm_scripts_path/log" "error" "This script requires Mac OS 10.5 or later on a 64-bit Intel CPU."
30
30
  exit 1
31
31
  fi
32
32
  ;;
33
33
  Solaris-x86)
34
34
  if [[ "$(uname -sm)" != "SunOS i86pc" ]]; then
35
- $rvm_scripts_path/log "error" "This script only works on a 64-bit Solaris-x86 OS."
35
+ "$rvm_scripts_path/log" "error" "This script only works on a 64-bit Solaris-x86 OS."
36
36
  echo "The result from \"uname -sm\" is \"`uname -sm`\" not \"SunOS i86pc\""
37
37
  exit 1
38
38
  fi
39
39
  ;;
40
40
  *)
41
- $rvm_scripts_path/log "error" "This script only works on a 64-bit Linux, Mac OS X, or Solaris-x86 machine"
41
+ "$rvm_scripts_path/log" "error" "This script only works on a 64-bit Linux, Mac OS X, or Solaris-x86 machine"
42
42
  echo "The result from \"uname -sm\" is \"`uname -sm`\""
43
43
  exit 1
44
44
  ;;
@@ -46,23 +46,23 @@ esac
46
46
 
47
47
  # We should run this as a normal user, not root.
48
48
  if [[ `id | cut -f2 -d= | cut -f1 -d\(` -eq 0 ]]; then
49
- $rvm_scripts_path/log "error" "This script should be run as a normal user, not root."
49
+ "$rvm_scripts_path/log" "error" "This script should be run as a normal user, not root."
50
50
  exit 1
51
51
  fi
52
52
 
53
53
  # Check that the current directory is writable
54
54
  if [[ ! -w "." ]]; then
55
- $rvm_scripts_path/log "error" "This script requires write permission on your current directory."
55
+ "$rvm_scripts_path/log" "error" "This script requires write permission on your current directory."
56
56
  \ls -ld $PWD
57
57
  exit 1
58
58
  fi
59
59
 
60
60
  # We're good to go. Let user know.
61
61
  machine_name="`uname -n`"
62
- $rvm_scripts_path/log "info" "Starting installation of $version on $machine_name"
62
+ "$rvm_scripts_path/log" "info" "Starting installation of $version on $machine_name"
63
63
 
64
64
  # Figure out how much total memory is installed
65
- $rvm_scripts_path/log "info" "Setting up shared memory"
65
+ "$rvm_scripts_path/log" "info" "Setting up shared memory"
66
66
  #
67
67
  # Ref: http://wiki.finkproject.org/index.php/Shared_Memory_Regions_on_Darwin
68
68
  # Ref: http://developer.postgresql.org/pgdocs/postgres/kernel-resources.html
@@ -94,7 +94,7 @@ case "$system" in
94
94
  shmall=$(($shmmax / 4096))
95
95
  ;;
96
96
  *)
97
- $rvm_scripts_path/log "error" "Can't determine operating system. Check script."
97
+ "$rvm_scripts_path/log" "error" "Can't determine operating system. Check script."
98
98
  exit 1
99
99
  ;;
100
100
  esac
@@ -124,22 +124,22 @@ shmallNewMB=$(($shmallNew / 256))
124
124
 
125
125
  # Increase shmmax if appropriate
126
126
  if [[ $shmmaxNew -gt $shmmax ]]; then
127
- $rvm_scripts_path/log "info" "Increasing max shared memory segment size to $shmmaxNewMB MB"
127
+ "$rvm_scripts_path/log" "info" "Increasing max shared memory segment size to $shmmaxNewMB MB"
128
128
  [[ $system = "Darwin" ]] && sudo sysctl -w kern.sysv.shmmax=$shmmaxNew
129
129
  [[ $system = "Linux" ]] && sudo bash -c "echo $shmmaxNew > /proc/sys/kernel/shmmax"
130
130
  [[ $system = "Solaris-x86" ]] && echo "[[Warning]] shmmax must be set manually on Solaris-x86"
131
131
  else
132
- $rvm_scripts_path/log "info" "No need to increase max shared memory segment size"
132
+ "$rvm_scripts_path/log" "info" "No need to increase max shared memory segment size"
133
133
  fi
134
134
 
135
135
  # Increase shmall if appropriate
136
136
  if [[ $shmallNew -gt $shmall ]]; then
137
- $rvm_scripts_path/log "info" "Increasing max shared memory allowed to $shmallNewMB MB"
137
+ "$rvm_scripts_path/log" "info" "Increasing max shared memory allowed to $shmallNewMB MB"
138
138
  [[ $system = "Darwin" ]] && sudo sysctl -w kern.sysv.shmall=$shmallNew
139
139
  [[ $system = "Linux" ]] && sudo bash -c "echo $shmallNew > /proc/sys/kernel/shmall"
140
140
  [[ $system = "Solaris-x86" ]] && echo "[[Warning]]shmall must be set manually on Solaris-x86"
141
141
  else
142
- $rvm_scripts_path/log "info" "No need to increase max shared memory allowed"
142
+ "$rvm_scripts_path/log" "info" "No need to increase max shared memory allowed"
143
143
  fi
144
144
 
145
145
  # At this point, shared memory settings contain the values we want,
@@ -163,30 +163,30 @@ if [[ ! -f /etc/sysctl.conf ]] || [[ "$(\grep -sc "kern.*.shm" /etc/sysctl.conf)
163
163
  # Must configure shared memory settings manually.
164
164
  ;;
165
165
  *)
166
- $rvm_scripts_path/log "error" "Can't determine operating system. Check script."
166
+ "$rvm_scripts_path/log" "error" "Can't determine operating system. Check script."
167
167
  exit 1
168
168
  ;;
169
169
  esac
170
170
  # Do nothing on Solaris-x86 since /etc/sysctl.conf is ignored on Solaris 10.
171
171
  if [[ "$system" != "Solaris-x86" ]]; then
172
- $rvm_scripts_path/log "info" "Adding the following section to /etc/sysctl.conf"
172
+ "$rvm_scripts_path/log" "info" "Adding the following section to /etc/sysctl.conf"
173
173
  cat /tmp/sysctl.conf.$$
174
174
  sudo bash -c "cat /tmp/sysctl.conf.$$ >> /etc/sysctl.conf"
175
175
  /bin/rm -f /tmp/sysctl.conf.$$
176
176
  fi
177
177
  else
178
- $rvm_scripts_path/log "info" "The following shared memory settings already exist in /etc/sysctl.conf"
178
+ "$rvm_scripts_path/log" "info" "The following shared memory settings already exist in /etc/sysctl.conf"
179
179
  echo "To change them, remove the following lines from /etc/sysctl.conf and rerun this script"
180
180
  \grep "kern.*.shm" /etc/sysctl.conf
181
181
  fi
182
182
 
183
183
  # Now setup for NetLDI in case we ever need it.
184
- $rvm_scripts_path/log "info" "Setting up GemStone netldi service port"
184
+ "$rvm_scripts_path/log" "info" "Setting up GemStone netldi service port"
185
185
  if [[ $(\grep -sc "^gs64ldi" /etc/services) -eq 0 ]]; then
186
186
  echo '[[Info]] Adding "gs64ldi 50378/tcp" to /etc/services'
187
187
  sudo bash -c 'echo "gs64ldi 50378/tcp # Gemstone netldi" >> /etc/services'
188
188
  else
189
- $rvm_scripts_path/log "info" "GemStone netldi service port is already set in /etc/services"
189
+ "$rvm_scripts_path/log" "info" "GemStone netldi service port is already set in /etc/services"
190
190
  echo "To change it, remove the following line from /etc/services and rerun this script"
191
191
  \grep "^gs64ldi" /etc/services
192
192
  fi