Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
gutenye committed Jun 12, 2014
1 parent d2a3eb5 commit 9cd6bc1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
1 change: 0 additions & 1 deletion libexec/oldtime
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
set -e
export -n CDPATH


VERSION="2.0.0"

if [ -n "$OLDTIME_DEBUG" ]; then
Expand Down
8 changes: 4 additions & 4 deletions libexec/oldtime-backup
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
# Usage: oldtime backup [options] <profile> [instance] [rsync_options]
#
# [OPTIONS]
# -d # oldtime config directory, default is /oldtime
# -c # oldtime config directory, default is /oldtime
#
# Default working directory is /oldtime/work.
#
# Examples:
#
# oldtime backup hello
# oldtime backup hello vm
# oldtime backup -d myoldtime hello --dry-run
# oldtime backup -c myoldtime hello --dry-run
#

set -e
Expand Down Expand Up @@ -84,9 +84,9 @@ if [[ -z "$1" ]]; then
exit 1
fi

while getopts "d:" opt; do
while getopts "c:" opt; do
case $opt in
d ) OLDTIME_DIR=$OPTARG ;;
c ) OLDTIME_DIR=$OPTARG ;;
esac
done
shift $(( OPTIND - 1 ))
Expand Down
2 changes: 1 addition & 1 deletion libexec/oldtime-help
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ print_help() {
eval "$(documentation_for "$command")"
[[ -n "$help" ]] || help="$summary"

if [[ -n "$usage" -o -n "$summary" ]]; then
if [[ -n "$usage" || -n "$summary" ]]; then
if [[ -n "$usage" ]]; then
echo "$usage"
else
Expand Down
13 changes: 7 additions & 6 deletions libexec/oldtime-restore
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
# Usage: oldtime restore [options] <profile> [instance] [rsync_options]
#
# [OPTIONS]
# -d # oldtime config directory, default is /oldtime
# -c # oldtime config directory, default is /oldtime
#
# Default working directory is /oldtime/work.
#
# Examples:
#
# oldtime restore hello vm
# oldtime restore -d myoldtime hello vm --dry-run
# oldtime restore -c myoldtime hello vm --dry-run
#

set -e
Expand All @@ -22,7 +22,7 @@ source "$OLDTIME_ROOT/libexec/lib.sh"
source "$OLDTIME_ROOT/libexec/helpers.sh"

invoke_rsync() {
end_cmd=$(sed "1s~\\$SRC~$SRC~;s~\\$DEST~$DEST~;q" "$1")
end_cmd=$(sed "1s~\$SRC~$SRC~;s~\$DEST~$DEST~;q" "$1")
end_cmd=$(echo $end_cmd | awk '{print $2, $1}')
cmd="$RESTORE_OPTIONS $RSYNC_OPTIONS $end_cmd"
echo ">> rsync $cmd"
Expand Down Expand Up @@ -51,23 +51,24 @@ if [[ -z "$1" ]]; then
exit 1
fi

while getopts "d:" opt; do
while getopts "c:" opt; do
case $opt in
d ) OLDTIME_DIR=$OPTARG ;;
c ) OLDTIME_DIR=$OPTARG ;;
esac
done
shift $(( OPTIND - 1 ))

profile="$1"
instance="$2"
conf="$OLDTIME_DIR/$profile.conf"
profile_dir=$(absolutename "$OLDTIME_DIR/$profile")

if [[ ! -e "$conf" ]]; then
echo "oldtime: config file doesn't exists -- $conf " >&2
exit 1
fi

profile_dir=$(absolutename "$OLDTIME_DIR/$profile")

[[ ! -d "$OLDTIME_DIR/work" ]] && mkdir "$OLDTIME_DIR/work"
[[ ! -d "$OLDTIME_DIR/work/tmp" ]] && mkdir "$OLDTIME_DIR/work/tmp"

Expand Down

0 comments on commit 9cd6bc1

Please sign in to comment.