|
@@ -1,23 +1,14 @@ |
|
|
#!/bin/sh |
|
|
#!/bin/sh |
|
|
|
|
|
|
|
|
pull_backup() { |
|
|
|
|
|
check_args $# 2 |
|
|
|
|
|
if [ ! -d "$BACKUPS_PATH/$2" ]; then |
|
|
|
|
|
invalid_path_msg "$1:$2" |
|
|
|
|
|
return 1; |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
git -C $BACKUPS_PATH/$2 pull $1 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
push_backup() { |
|
|
|
|
|
|
|
|
gitcmd() { |
|
|
|
|
|
#First arg should be the name of the subdirectory, second arg should be command |
|
|
check_args $# 2 |
|
|
check_args $# 2 |
|
|
if [ ! -d "$BACKUPS_PATH/$2" ]; then |
|
|
|
|
|
invalid_path_msg "$1:$2" |
|
|
|
|
|
|
|
|
if [ ! -d "$BACKUPS_PATH/$1" ]; then |
|
|
|
|
|
invalid_path_msg "$1" |
|
|
return 1; |
|
|
return 1; |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
git -C $BACKUPS_PATH/$2 push $1 |
|
|
|
|
|
|
|
|
git -C $BACKUPS_PATH/$1 $2 |
|
|
|
|
|
printf "The command succeded\n" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
overwrite_local() { |
|
|
overwrite_local() { |
|
@@ -65,8 +56,7 @@ case "$1" in |
|
|
;; |
|
|
;; |
|
|
overwrite-local) overwrite_local $2 $3;; |
|
|
overwrite-local) overwrite_local $2 $3;; |
|
|
overwrite-backup) overwrite_backup $2 $3;; |
|
|
overwrite-backup) overwrite_backup $2 $3;; |
|
|
pull-backup) pull_backup $2 $3;; |
|
|
|
|
|
push-backup) push_backup $2 $3;; |
|
|
|
|
|
|
|
|
gitcmd) gitcmd "$2" "$3";; |
|
|
push-backup) overwrite_backup $2 $3;; |
|
|
push-backup) overwrite_backup $2 $3;; |
|
|
*) printf "No such option\n";; |
|
|
*) printf "No such option\n";; |
|
|
esac |
|
|
esac |