scripts/repair in rvm-1.0.6 vs scripts/repair in rvm-1.0.7
- old
+ new
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
-source "$rvm_scripts_path/base"
+source "$rvm_path/scripts/base"
usage() {
echo "Usage: rvm repair {symlinks,environments,archives,all}" >&2
return 1
}
@@ -13,11 +13,11 @@
(
builtin cd "$rvm_bin_path"
for executable_name in $(\find \. -type l); do
[[ -e "$executable_name" || "$(readlink "$executable_name")" != "$rvm_wrappers_path/"* ]] && continue
if [[ -f "$executable_name" ]] ; then
- "$rvm_scripts_path/log" "info" \
+ "$rvm_path/scripts/log" "info" \
"Removing stale symlink from $(basename "$executable_name")"
\rm -f "$executable_name"
fi
done
)
@@ -25,23 +25,23 @@
# Regenerates each symlink file.
repair_environments() {
local environment_name environments
- environments=($(cd "$rvm_environments_path" ; find * -type f -maxdepth 0))
+ environments=($(cd "$rvm_environments_path" ; find . -maxdepth 1 -mindepth 1 -type f))
- for environment_name in "${environments[@]}" ; do
+ for environment_name in "${environments[@]//.\/}" ; do
[[ -L "$rvm_environments_path/$environment_name" ]] && continue
- "$rvm_scripts_path/log" "info" \
+ "$rvm_path/scripts/log" "info" \
"Regenerating environment file for '$environment_name'"
[[ -f "$rvm_environments_path/$environment_name" ]] && \rm -f "$rvm_environments_path/$environment_name"
(
- source "$rvm_scripts_path/base"
+ source "$rvm_path/scripts/base"
__rvm_become "$environment_name"
__rvm_ensure_has_environment_files
)
@@ -52,23 +52,23 @@
# Removes archives that have incorrect md5 sums.
repair_archives() {
local archive_file archives stored_md5sum
- archives=($(cd "$rvm_archives_path" ; find * -type f -maxdepth 0))
+ archives=($(cd "$rvm_archives_path" ; find . -maxdepth 1 -mindepth 1 -type f))
- for archive_file in "${archives[@]}" ; do
+ for archive_file in "${archives[@]//.\/}" ; do
[[ -f "$rvm_archives_path/$archive_file" ]] || continue
- stored_md5sum="$($rvm_scripts_path/db "$rvm_config_path/md5" "$archive_file" | head -n1)"
+ stored_md5sum="$($rvm_path/scripts/db "$rvm_config_path/md5" "$archive_file" | head -n1)"
if [[ -n "$stored_md5sum" ]] ; then
- if [[ ! "$rvm_scripts_path/md5" "$rvm_archives_path/$archive_file" "$stored_md5sum" ]] ; then
+ if [[ ! "$rvm_path/scripts/md5" "$rvm_archives_path/$archive_file" "$stored_md5sum" ]] ; then
- "$rvm_scripts_path/log" "info" "Removing archive for '$archive_file' - Incorrect md5 checksum."
+ "$rvm_path/scripts/log" "info" "Removing archive for '$archive_file' - Incorrect md5 checksum."
rm -rf "$rvm_archives_path/$archive_file"
fi
fi
done
@@ -82,10 +82,10 @@
repair_archives
repair_environments
- "$rvm_scripts_path/log" "info" \
+ "$rvm_path/scripts/log" "info" \
"symlinks, archives and environments have been repaired."
return 0
}