scripts/snapshot in rvm-0.1.45 vs scripts/snapshot in rvm-0.1.46

- old
+ new

@@ -22,34 +22,34 @@ return 1 fi # Create the temporary directory. local snapshot_temp_path="$rvm_tmp_path/$$-snapshot" - rm -rf "$snapshot_temp_path" - mkdir -p "$snapshot_temp_path" + \rm -rf "$snapshot_temp_path" + \mkdir -p "$snapshot_temp_path" $rvm_scripts_path/log "info" "Backing up a list of aliases" - cp "$rvm_config_path/alias" "$snapshot_temp_path/" + \cp "$rvm_config_path/alias" "$snapshot_temp_path/" $rvm_scripts_path/log "info" "Backing up your user preferences" - cp "$rvm_config_path/user" "$snapshot_temp_path/" + \cp "$rvm_config_path/user" "$snapshot_temp_path/" $rvm_scripts_path/log "info" "Backing up your installed packages" cat "$rvm_config_path/packages" | sed -e 's/-//' -e 's/^lib//' | awk -F= '{print $1}' | sort | uniq > "$snapshot_temp_path/packages" $rvm_scripts_path/log "info" "Backing up all of your gemsets" - mkdir -p "$snapshot_temp_path/gems" + \mkdir -p "$snapshot_temp_path/gems" __rvm_pushpop "$snapshot_temp_path/gems" for snapshot_gemset in $($rvm_scripts_path/list gemsets strings) ; do __rvm_become "$snapshot_gemset" result="$?" __error_on_result "$result" "Error becoming ruby $snapshot_gemset" && return "$result" $rvm_scripts_path/gemsets export "${snapshot_gemset}.gems" >/dev/null result="$?" __error_on_result "$result" "Error exporting gemset contents for $snapshot_gemset" && return "$result" - mkdir -p "./$snapshot_gemset/" - [[ -d "$GEM_HOME/cache/" ]] && cp -R "$GEM_HOME/cache/" "./$snapshot_gemset/" + \mkdir -p "./$snapshot_gemset/" + [[ -d "$GEM_HOME/cache/" ]] && \cp -R "$GEM_HOME/cache/" "./$snapshot_gemset/" done; unset snapshot_gemset __rvm_pushpop $rvm_scripts_path/log "info" "Backing up all of your installed rubies" echo '#!/usr/bin/env bash -e' > "$snapshot_temp_path/install-rubies.sh" @@ -59,11 +59,11 @@ local snapshot_installable_file="$rvm_tmp_path/$$-installable" $rvm_scripts_path/alias list | awk -F ' => ' '{print $1}' | sort | uniq 2>/dev/null > "$snapshot_alias_name_file" $rvm_scripts_path/list strings | \tr ' ' '\n' | sort | uniq > "$snapshot_ruby_name_file" comm -2 -3 "$snapshot_ruby_name_file" "$snapshot_alias_name_file" > "$snapshot_installable_file" - rm -rf "$snapshot_ruby_name_file" "$snapshot_alias_name_file" + \rm -rf "$snapshot_ruby_name_file" "$snapshot_alias_name_file" local snapshot_primary_ruby="$(cat "$snapshot_installable_file" | grep '^\(ree\|ruby-1.8.7\)' | grep -v '-head$' | sort -r | head -n1)" local snapshot_ruby_order="$snapshot_primary_ruby $(cat "$snapshot_installable_file" | grep -v "$snapshot_primary_ruby")" for snapshot_ruby_name in $snapshot_ruby_order ; do snapshot_install_command="$(__rvm_recorded_install_command "$snapshot_ruby_name")" @@ -74,23 +74,23 @@ ruby "$rvm_path/lib/rvm/install_command_dumper.rb" >> "$snapshot_temp_path/install-rubies.sh" fi unset snapshot_install_command done; unset snapshot_ruby_name snapshot_primary_ruby - rm -rf "$snapshot_installable_file" + \rm -rf "$snapshot_installable_file" $rvm_scripts_path/log "info" "Compressing snapshotting" local destination_path="$PWD" __rvm_pushpop "$snapshot_temp_path" - rm -rf "$destination_path/$1.tar.gz" + \rm -rf "$destination_path/$1.tar.gz" tar czf "$destination_path/$1.tar.gz" . result="$?" __error_on_result "$result" "Error creating archive $destination_path/$1.tar.gz" && return "$result" __rvm_pushpop $rvm_scripts_path/log "info" "Cleaning up" - rm -rf "$snapshot_temp_path" + \rm -rf "$snapshot_temp_path" $rvm_scripts_path/log "info" "Snapshot complete" } @@ -108,22 +108,22 @@ return 1 fi local snapshot_temp_path="$rvm_tmp_path/$$-snapshot" - rm -rf "$snapshot_temp_path" - mkdir -p "$snapshot_temp_path" + \rm -rf "$snapshot_temp_path" + \mkdir -p "$snapshot_temp_path" $rvm_scripts_path/log "info" "Extracting snapshot" __rvm_pushpop "$snapshot_temp_path" tar xzf "$snapshot_archive" result="$?" __error_on_result "$result" "Error extracting the archive '$snapshot_archive'" && return "$result" __rvm_pushpop $rvm_scripts_path/log "info" "Restoring user settings" - cp -f "$snapshot_temp_path/user" "$rvm_config_path/user" + \cp -f "$snapshot_temp_path/user" "$rvm_config_path/user" $rvm_scripts_path/log "info" "Installing rvm-managed packages" for snapshot_package in $(cat "$snapshot_temp_path/packages"); do $rvm_scripts_path/package install "$snapshot_package" result="$?" @@ -141,12 +141,12 @@ __rvm_pushpop "$snapshot_temp_path/gems" for snapshot_gemset in $(\ls | grep '\.gems$' | sed 's/.gems$//'); do __rvm_become "$snapshot_gemset" result="$?" __error_on_result "$result" "Error becoming '$snapshot_gemset'" && return "$result" - mkdir -p "$GEM_HOME/cache/" - cp -Rf "$snapshot_gemset/" "$GEM_HOME/cache/" + \mkdir -p "$GEM_HOME/cache/" + \cp -Rf "$snapshot_gemset/" "$GEM_HOME/cache/" result="$?" __error_on_result "$result" "Error copying across cache for $snapshot_gemset" && return "$result" $rvm_scripts_path/gemsets import "$snapshot_gemset" >/dev/null 2>&1 result="$?" __error_on_result "$result" "Error importing gemset for $snapshot_gemset" && return "$result" @@ -165,10 +165,10 @@ fi done < "$snapshot_temp_path/alias" unset package_info $rvm_scripts_path/log "info" "Cleaning up load process" - rm -rf "$snapshot_temp_path" + \rm -rf "$snapshot_temp_path" $rvm_scripts_path/log "info" "Loaded snapshot from $(basename "$snapshot_archive")" } snapshot_usage() {